Bug 334276

Summary: Equality operators for GeoDataSnippet, GeoDataLookAt and GeoDataFeature
Product: [Applications] marble Reporter: Dennis Nienhüser <nienhueser>
Component: generalAssignee: Cruceru Calin-Cristian <crucerucalincristian>
Status: RESOLVED FIXED    
Severity: task CC: crucerucalincristian
Priority: NOR Keywords: junior-jobs
Version: 1.7 (KDE 4.12)   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 334285    

Description Dennis Nienhüser 2014-05-03 12:22:30 UTC
Add operator== and operator!= to the classes GeoDataSnippet and GeoDataLookAt. Have GeoDataFeature override the equals() method of GeoDataObject. Inside call its parent's equals method and check the members (see GeoDataFeature_p.h). The static ones and ref should be ignored. Instead of checking m_visualCategory and m_style, check that *style() == *other.style(). Be careful when checking m_styleMap since it is a pointer that can be 0 (i.e. don't call *m_styleMap if m_styleMap==0. You can do something like (!m_styleMap && !other.m_styleMap) || (m_styleMap && other.m_styleMap && *m_styleMap == *other.m_styleMap) if you want a short implementation). Similar for m_abstractView, which however is even more complicated because it does not have operator== directly -- cast it to camera and lookat depending on the nodeType and compare them.

Extend TestEquality for new unit test methods for GeoDataSnippet and GeoDataLookAt instances. Extend the existing methods for GeoDataFeature derived classes to set and check feature related properties in their checks as well.

Make sure to compile Marble with the BUILD_MARBLE_TESTS=TRUE option enabled and run the test case from the build folder (run tests/TestEquality). Submit a review request at https://git.reviewboard.kde.org.

Please leave a comment here (e.g. "I want to work on this task.") if you start working on this task to avoid multiple people working on it at the same time.
Comment 1 Cruceru Calin-Cristian 2014-05-03 12:24:38 UTC
I want to work on this task.
Comment 2 Cruceru Calin-Cristian 2014-05-04 10:35:47 UTC
Git commit 2cded666997407cc3e12c15244e33e9c9cd7a769 by Cruceru Calin-Cristian.
Committed on 04/05/2014 at 10:30.
Pushed by crucerucalincristian into branch 'master'.

Equality operators for GeoDataSnippet, GeoDataLookAt and GeoDataFeature
REVIEW: 117980

M  +65   -0    src/lib/marble/geodata/data/GeoDataFeature.cpp
M  +3    -0    src/lib/marble/geodata/data/GeoDataFeature.h
M  +12   -0    src/lib/marble/geodata/data/GeoDataLookAt.cpp
M  +3    -0    src/lib/marble/geodata/data/GeoDataLookAt.h
M  +10   -0    src/lib/marble/geodata/data/GeoDataSnippet.cpp
M  +8    -1    src/lib/marble/geodata/data/GeoDataSnippet.h
M  +2    -1    src/lib/marble/geodata/data/GeoDataTour.cpp
M  +258  -0    tests/TestEquality.cpp

http://commits.kde.org/marble/2cded666997407cc3e12c15244e33e9c9cd7a769