[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace/previewsoc13] kcontrol/keyboard/tests: Unit tests for geometry parser
From:       Andriy Rysin <arysin () gmail ! com>
Date:       2013-07-30 21:18:22
Message-ID: E1V4HJG-0005Z8-UO () scm ! kde ! org
[Download RAW message or body]

Git commit fb0961c872617cf9c49f23fd102e15b3ee219d2c by Andriy Rysin.
Committed on 30/07/2013 at 20:34.
Pushed by rysin into branch 'previewsoc13'.

Unit tests for geometry parser

M  +12   -0    kcontrol/keyboard/tests/CMakeLists.txt
A  +55   -0    kcontrol/keyboard/tests/geometry_parser_test.cpp     [License: GPL (v2+)]

http://commits.kde.org/kde-workspace/fb0961c872617cf9c49f23fd102e15b3ee219d2c

diff --git a/kcontrol/keyboard/tests/CMakeLists.txt b/kcontrol/keyboard/tests/CMakeLists.txt
index b2bbedc..d06b1b4 100644
--- a/kcontrol/keyboard/tests/CMakeLists.txt
+++ b/kcontrol/keyboard/tests/CMakeLists.txt
@@ -14,6 +14,18 @@ ENDMACRO(KEYBOARD_DAEMON_UNIT_TESTS2)
 KEYBOARD_DAEMON_UNIT_TESTS(xkb_rules)
 KEYBOARD_DAEMON_UNIT_TESTS(iso_codes)
 
+if(Boost_FOUND)
+    include_directories("../preview")
+
+    set (CMAKE_CXX_FLAGS "-fexceptions")
+    set (CMAKE_CXX_FLAGS "-fpermissive")
+
+    ADD_DEFINITIONS(-DNEW_GEOMETRY=1)
+
+    kde4_add_unit_test(geometry_parser_test TESTNAME geometry_parser NOGUI \
../preview/geometry_parser.cpp ../preview/geometry_components.cpp geometry_parser_test.cpp) +    \
target_link_libraries(geometry_parser_test ${KDE4_KDEUI_LIBS} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES}) \
+endif(Boost_FOUND) +
 kde4_add_unit_test(flags_test TESTNAME kcm-keyboard-flags_test NOGUI flags_test.cpp ../flags.cpp \
../x11_helper.cpp ../keyboard_config.cpp ../xkb_rules.cpp)  target_link_libraries(flags_test \
${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_Xkbfile_LIB} ${X11_LIBRARIES} \
${text_paint_LIB})  
diff --git a/kcontrol/keyboard/tests/geometry_parser_test.cpp \
b/kcontrol/keyboard/tests/geometry_parser_test.cpp new file mode 100644
index 0000000..c1eff3b
--- /dev/null
+++ b/kcontrol/keyboard/tests/geometry_parser_test.cpp
@@ -0,0 +1,55 @@
+/*
+ *  Copyright (C) 2011 Andriy Rysin (rysin@kde.org)
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include <kdebug.h>
+#include <QtGui/QApplication>
+#include <qtest_kde.h>
+
+#include "geometry_parser.h"
+
+
+class GeometryParserTest : public QObject
+{
+    Q_OBJECT
+
+    Geometry geometry;
+
+private Q_SLOTS:
+    void initTestCase() {
+	QString model("pc104");
+	geometry = grammar::parseGeometry(model);
+    }
+
+    void cleanupTestCase() {
+//    	delete geometry;
+    }
+
+    void testGeometryParser() {
+        QVERIFY( geometry.getWidth() > 0 );
+        QVERIFY( geometry.getShapeCount() > 0 );
+//        QVERIFY( ! geometry.getName().isEmpty() );
+
+        QCOMPARE( geometry.getName(), QString("pc104") );
+    }
+
+};
+
+//TODO: something lighter than KDEMAIN ?
+QTEST_KDEMAIN( GeometryParserTest, NoGUI )
+
+#include "geometry_parser_test.moc"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic