Bug 334289 - Extend the GeoDataWriter unit test to test operator== of GeoDataDocument
Summary: Extend the GeoDataWriter unit test to test operator== of GeoDataDocument
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: 334286
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-03 16:51 UTC by Dennis Nienhüser
Modified: 2014-05-07 21:56 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-05-03 16:51:44 UTC
TestGeoDataWriter has a unit test method saveAndCompare (along with saveAndCompare_data) which iterates over all .kml files in tests/data and does the following:
- parse the file, retrieve the GeoDataDocument as result
- write the document to a KML file in memory (QBuffer/QByteArray)
- compare the XML contents of the original file and the file in memory for equality.

This is fine for simple cases, but limits the possible input .kml files: They cannot have tags with default values and the order of tags must be exactly the one which Marble uses internally. To allow adding .kml files in the future as test cases which are not limited by this, write a similar unit test which does the comparison using GeoDataDocument::operator== instead of the XML string comparison. Use the existing saveAndCompare unit test as a base for a new unit test saveAndCompareEquality(). Instead of doing the QTextStream based comparison, parse the QBuffer contents, retrieve the GeoDataDocument from the parser and compare it with the original one (make sure not to compare pointers).

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-05 20:41:05 UTC
I really want to work on this :).
Comment 2 Dennis Nienhüser 2014-05-05 21:08:48 UTC
Note the slight error in the end where it talks about TestEquality but means TestGeodataWriter.
Comment 3 Cruceru Calin-Cristian 2014-05-07 21:56:50 UTC
Git commit 68107fec8a3249d31fab9aa972c1ce7780958aef by Cruceru Calin-Cristian.
Committed on 07/05/2014 at 21:55.
Pushed by crucerucalincristian into branch 'master'.

Extend the GeoDataWriter unit test to test operator== of GeoDataDocument
REVIEW: 118042

M  +40   -0    tests/TestGeoDataWriter.cpp

http://commits.kde.org/marble/68107fec8a3249d31fab9aa972c1ce7780958aef