Bug 331666 - Test equality of GeoDataObject derived classes
Summary: Test equality of GeoDataObject derived classes
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: 1.7 (KDE 4.12)
Platform: unspecified Linux
: NOR task
Target Milestone: ---
Assignee: Cruceru Calin-Cristian
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2014-03-01 22:37 UTC by Dennis Nienhüser
Modified: 2014-03-02 17:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Nienhüser 2014-03-01 22:37:56 UTC
Currently operator== in GeoData* classes does check for equality of the id() and targetId() of GeoDataObject derived classes. This task should fix this.
- Add a protected method with the following signature to GeoDataObject.h:
  bool equals(const GeoDataObject &other) const;
- Implement the method like operator==, i.e. return true if d->m_id and d->m_targetId equal the ones of the other object each
- Find all GeoData* classes which have operator== implemented and are derived from GeoDataObject in some way. For example, GeoDataItemIcon is a direct child, GeoDataFlyTo is one because it inherits GeoDataTourPrimitive which inherits GeoDataObject. In their operator== implementation, call
equals( other )
before checking the members of the object, e.g.

bool GeoDataFlyTo::operator==( const GeoDataFlyTo& other ) const
{
    return equals( other ) &&
           d->m_duration == other.d->m_duration &&
           d->m_flyToMode == other.d->m_flyToMode &&
           d->m_view == other.d->m_view;
}

Make sure to compile Marble with the following cmake options enabled: BUILD_MARBLE_TESTS=TRUE, BUILD_MARBLE_TOOLS=TRUE. Execute tests/TestEquality and make sure no errors come up. Use tools/kml2kml to analyze errors and fix the tag writers, if needed. Submit a review request at https://git.reviewboard.kde.org with the marble group as reviewers.

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-03-01 22:40:55 UTC
I want to work on this task.
Comment 2 Dennis Nienhüser 2014-03-02 17:05:42 UTC
Git commit 3d15d235e779739d7e0651ab15b4ea4737589e79 by Dennis Nienhüser, on behalf of Cruceru Calin-Cristian.
Committed on 02/03/2014 at 16:27.
Pushed by nienhueser into branch 'master'.

Test equality of GeoDataObject derived classes

REVIEW: 116534

M  +5    -2    src/lib/marble/geodata/data/GeoDataBalloonStyle.cpp
M  +2    -1    src/lib/marble/geodata/data/GeoDataCamera.cpp
M  +1    -1    src/lib/marble/geodata/data/GeoDataColorStyle.cpp
M  +4    -1    src/lib/marble/geodata/data/GeoDataData.cpp
M  +3    -1    src/lib/marble/geodata/data/GeoDataExtendedData.cpp
M  +4    -1    src/lib/marble/geodata/data/GeoDataFlyTo.cpp
M  +4    -1    src/lib/marble/geodata/data/GeoDataHotSpot.cpp
M  +5    -1    src/lib/marble/geodata/data/GeoDataImagePyramid.cpp
M  +4    -1    src/lib/marble/geodata/data/GeoDataItemIcon.cpp
M  +8    -8    src/lib/marble/geodata/data/GeoDataLatLonAltBox.cpp
M  +5    -5    src/lib/marble/geodata/data/GeoDataLatLonBox.cpp
M  +9    -2    src/lib/marble/geodata/data/GeoDataLink.cpp
M  +5    -0    src/lib/marble/geodata/data/GeoDataObject.cpp
M  +7    -0    src/lib/marble/geodata/data/GeoDataObject.h
M  +1    -1    src/lib/marble/geodata/data/GeoDataPlacemark.cpp
M  +1    -1    src/lib/marble/geodata/data/GeoDataSimpleArrayData.cpp

http://commits.kde.org/marble/3d15d235e779739d7e0651ab15b4ea4737589e79