[kgraphviewer-devel] [KGraphViewer] b7302a5: Add unit test stub

Kevin Funk krf at electrostorm.net
Fri Dec 10 16:26:43 CET 2010


	A	 tests/kgraphviz/dotgraphtests.cpp	 [License: Trivialfile.]


	A	 tests/kgraphviz/CMakeLists.txt	 [License: Trivialfile.]


	A	 tests/CMakeLists.txt	 [License: Trivialfile.]

commit b7302a5dd9aa95ce4975df1eeeceaee42399da2e
Author: Kevin Funk <krf at electrostorm.net>
Date:   Fri Dec 10 16:24:13 2010 +0100

    Add unit test stub

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb50e63..7236b38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,5 +35,6 @@ include_directories(
 
 configure_file (config-kgraphviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kgraphviewer.h )
 
-add_subdirectory(src)
 add_subdirectory(doc)
+add_subdirectory(src)
+add_subdirectory(tests)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..c4efa7e
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,9 @@
+set(KGRAPHVIZ_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/kgraphviz)
+set(KGRAPHVIEWER_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
+
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${KGRAPHVIEWER_SOURCE_DIR}
+)
+
+add_subdirectory(kgraphviz)
\ No newline at end of file
diff --git a/tests/kgraphviz/CMakeLists.txt b/tests/kgraphviz/CMakeLists.txt
new file mode 100644
index 0000000..f391430
--- /dev/null
+++ b/tests/kgraphviz/CMakeLists.txt
@@ -0,0 +1,14 @@
+include_directories(
+  ${KGRAPHVIZ_SOURCE_DIR}
+)
+
+link_directories(
+  ${CMAKE_BINARY_DIR}/lib
+)
+
+set(dotgraphtests_SRCS
+  dotgraphtests.cpp
+)
+
+kde4_add_unit_test(dotgraphtests ${dotgraphtests_SRCS} )
+target_link_libraries(dotgraphtests ${KDE4_KDECORE_LIBS} ${QT_QTTEST_LIBRARY} kgraphviz)
diff --git a/tests/kgraphviz/dotgraphtests.cpp b/tests/kgraphviz/dotgraphtests.cpp
new file mode 100644
index 0000000..b30e603
--- /dev/null
+++ b/tests/kgraphviz/dotgraphtests.cpp
@@ -0,0 +1,25 @@
+#include <kgraphviz/dotgraph.h>
+
+#include <QtTest/QtTest>
+
+class DotGraphTests : public QObject
+{
+  Q_OBJECT
+
+private Q_SLOTS:
+  void testCreateGraph();
+};
+
+using namespace KGraphViewer;
+
+void DotGraphTests::testCreateGraph()
+{
+  DotGraph graph;
+
+  QVERIFY(graph.nodes().size() == 0);
+  QVERIFY(graph.edges().size() == 0);
+  QVERIFY(graph.subgraphs().size() == 0);
+}
+
+QTEST_MAIN(DotGraphTests)
+#include "dotgraphtests.moc"*/


More information about the kgraphviewer-devel mailing list