[Marble-commits] KDE/kdeedu/marble

Thibaut Gridel tgridel at free.fr
Wed Jan 5 23:04:47 CET 2011


SVN commit 1212141 by tgridel:

fix TestGeoDataWriter remaining tests

 M  +9 -0      src/lib/geodata/writers/kml/KmlDocumentTagWriter.cpp  
 M  +2 -3      tests/TestGeoDataWriter.cpp  
 M  +2 -2      tests/data/NewYork.kml  
 M  +2 -2      tests/data/NewYorkDocument.kml  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/writers/kml/KmlDocumentTagWriter.cpp #1212140:1212141
@@ -34,6 +34,15 @@
 {
     const GeoDataDocument &document = static_cast<const GeoDataDocument&>(node);
 
+    // when a document has only one feature and no styling
+    // the document tag is excused
+    if( (document.styles().count() == 0)
+        && (document.styleMaps().count() == 0)
+        && (document.featureList().count() == 1) ) {
+        writeElement( *document.featureList()[0], writer );
+        return true;
+    }
+
     writer.writeStartElement( kml::kmlTag_Document );
 
     foreach( const GeoDataStyle &style, document.styles() ) {
--- trunk/KDE/kdeedu/marble/tests/TestGeoDataWriter.cpp #1212140:1212141
@@ -89,7 +89,6 @@
 
     //Add feature parsers ( referenced by file name ) and their count of features
 
-//    This parser won't work because of the flaw that prevents single placemark files from loading
     QTest::newRow("New York") << parsers.value("NewYork.kml") << 1;
     QTest::newRow("New York Document") << parsers.value("NewYorkDocument.kml") << 2;
     QTest::newRow("CDATATest") << parsers.value("CDATATest.kml") << 1;
@@ -179,7 +178,7 @@
 {
     //save the file and compare it to the original
     QFETCH( QSharedPointer<GeoDataParser>, parser );
-    QFETCH( QString, origional );
+    QFETCH( QString, original );
 
     //attempt to save a file using the GeoWriter
     QTemporaryFile tempFile;
@@ -194,7 +193,7 @@
     QVERIFY( writer.write( &tempFile,
                            *dynamic_cast<GeoDataFeature*>(parser->activeDocument() ) ) );
 
-    QFile file( dataDir.filePath( origional ) );
+    QFile file( dataDir.filePath( original ) );
     QVERIFY( file.open( QIODevice::ReadOnly ) );
     QVERIFY( tempFile.reset() );
     QTextStream oldFile( &file );
--- trunk/KDE/kdeedu/marble/tests/data/NewYork.kml #1212140:1212141
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<kml xmlns="http://www.opengis.net/kml/2.2">
+<kml xmlns="http://earth.google.com/kml/2.2">
 <Placemark>
   <name>New York City</name>
   <description>New York City</description>
   <Point>
-    <coordinates>-74.006393,40.714172</coordinates>
+    <coordinates>-74.0063930000,40.7141720000</coordinates>
   </Point>
 </Placemark>
 </kml>
--- trunk/KDE/kdeedu/marble/tests/data/NewYorkDocument.kml #1212140:1212141
@@ -5,14 +5,14 @@
     <name>New York City</name>
     <description>New York City</description>
     <Point>
-      <coordinates>-74.006393,40.714172</coordinates>
+      <coordinates>-74.0063930000,40.7141720000</coordinates>
     </Point>
   </Placemark>
   <Placemark>
     <name>New York City 2</name>
     <description>New York City</description>
     <Point>
-      <coordinates>-74.006,40.714,0</coordinates>
+      <coordinates>-74.0060000000,40.7140000000</coordinates>
     </Point>
     </Placemark>
 </Document>


More information about the Marble-commits mailing list