• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

rocs/RocsCore

  • sources
  • kde-4.12
  • kdeedu
  • rocs
  • RocsCore
  • LoadSave
  • Plugins
  • kmlFileFormat
  • Tests
KmlFileFormatTest.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Rocs.
3  Copyright 2010 Wagner Reck <wagner.reck@gmail.com>
4  Copyright 2012 Andreas Cord-Landwehr <cola@uni-paderborn.de>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "KmlFileFormatTest.h"
21 #include "../KmlFileFormatPlugin.h"
22 #include "DocumentManager.h"
23 #include "Data.h"
24 #include "Pointer.h"
25 #include <QtTest/QTest>
26 #include <KUrl>
27 
28 void KmlFileFormatTest::init()
29 {}
30 
31 void KmlFileFormatTest::serializeTest()
32 {
33  DocumentManager::self().addDocument(new Document("testSerialization"));
34  Document* document = DocumentManager::self().activeDocument();
35  QMap<QString, DataPtr> dataList;
36 
37  // Creates a simple Graph with 5 data elements and connect them with pointers.
38  DataStructurePtr ds = document->activeDataStructure();
39  ds->setProperty("name", "Graph1");
40  dataList.insert("a", ds->createData("first node", 0));
41  dataList.insert("b", ds->createData("b", 0));
42  dataList.insert("c", ds->createData("c", 0));
43  dataList.insert("d", ds->createData("d", 0));
44  dataList.insert("e", ds->createData("e", 0));
45 
46  ds->createPointer(dataList["a"], dataList["b"], 0)->setProperty("value", "test value");
47  ds->createPointer(dataList["b"], dataList["c"], 0);
48  ds->createPointer(dataList["c"], dataList["d"], 0);
49  ds->createPointer(dataList["d"], dataList["e"], 0);
50  ds->createPointer(dataList["e"], dataList["a"], 0);
51 
52  // create exporter plugin
53  KmlFileFormatPlugin serializer(this, QList<QVariant>());
54  serializer.setFile(KUrl::fromLocalFile("test.kml"));
55  serializer.writeFile(*document);
56  QVERIFY(serializer.hasError() == false);
57 }
58 
59 QTEST_MAIN(KmlFileFormatTest)
DocumentManager.h
DocumentManager::self
static DocumentManager & self()
Definition: DocumentManager.cpp:57
DataStructurePtr
boost::shared_ptr< DataStructure > DataStructurePtr
Definition: CoreTypes.h:38
GmlParser::document
Document * document
Definition: GmlGrammar.cpp:40
DocumentManager::activeDocument
Document * activeDocument() const
Returns the currently active document, or 0 if there document list is empty.
Definition: DocumentManager.cpp:96
Data.h
QTEST_MAIN
QTEST_MAIN(TestTgfFileFormatPlugin)
Document::activeDataStructure
DataStructurePtr activeDataStructure() const
Definition: Document.cpp:431
KmlFileFormatPlugin
class KmlFileFormatPlugin: Export and Import Plugin for KML files
Definition: KmlFileFormatPlugin.h:30
Document
Definition: Document.h:41
Pointer.h
KmlFileFormatTest.h
DocumentManager::addDocument
void addDocument(Document *document)
Add document to document list and set this document as active document.
Definition: DocumentManager.cpp:106
KmlFileFormatTest
Definition: KmlFileFormatTest.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

rocs/RocsCore

Skip menu "rocs/RocsCore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal