Merge lp:~larsu/gsettings-qt/add-basic-testing into lp:gsettings-qt

Proposed by Lars Karlitski
Status: Merged
Approved by: Ken VanDine
Approved revision: 9
Merged at revision: 9
Proposed branch: lp:~larsu/gsettings-qt/add-basic-testing
Merge into: lp:gsettings-qt
Diff against target: 124 lines (+65/-1)
8 files modified
GSettings/gsettings-qt.pro (+1/-0)
debian/control (+1/-0)
debian/rules (+3/-0)
gsettings-qt.pro (+1/-1)
tests/com.canonical.gsettings.test.gschema.xml (+17/-0)
tests/test.cpp (+3/-0)
tests/tests.pro (+16/-0)
tests/tst_GSettings.qml (+23/-0)
To merge this branch: bzr merge lp:~larsu/gsettings-qt/add-basic-testing
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+171295@code.launchpad.net

Commit message

Add basic testing

Description of the change

Add basic testing.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

merge conflicts

review: Needs Fixing
8. By Lars Karlitski

Merge trunk

Revision history for this message
Lars Karlitski (larsu) wrote :

Argh, I shouldn't have merged your branch first :P

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Ah, one more thing then i'll approve it. Using xvfb-run to run the tests, you should add a "-a" to automatically get a server port.

review: Needs Fixing
9. By Lars Karlitski

debian: run xvfb with -a

Revision history for this message
Lars Karlitski (larsu) wrote :

Thanks, done.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Great, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GSettings/gsettings-qt.pro'
2--- GSettings/gsettings-qt.pro 2013-06-25 12:52:19 +0000
3+++ GSettings/gsettings-qt.pro 2013-06-25 16:44:35 +0000
4@@ -1,6 +1,7 @@
5 TEMPLATE = lib
6 INCLUDEPATH += .
7 QT += qml
8+QT -= gui
9 CONFIG += qt plugin no_keywords link_pkgconfig
10 PKGCONFIG += gio-2.0
11
12
13=== modified file 'debian/control'
14--- debian/control 2013-06-21 18:30:54 +0000
15+++ debian/control 2013-06-25 16:44:35 +0000
16@@ -9,6 +9,7 @@
17 qtbase5-dev,
18 qtdeclarative5-dev,
19 qtdeclarative5-qtquick2-plugin,
20+ xvfb,
21 Standards-Version: 3.9.4
22 Section: libs
23 Homepage: https://launchpad.net/gsettings-qt
24
25=== modified file 'debian/rules'
26--- debian/rules 2013-06-20 19:24:56 +0000
27+++ debian/rules 2013-06-25 16:44:35 +0000
28@@ -8,5 +8,8 @@
29 override_dh_install:
30 dh_install --fail-missing
31
32+override_dh_auto_test:
33+ xvfb-run -a dh_auto_test
34+
35 %:
36 dh $@
37
38=== modified file 'gsettings-qt.pro'
39--- gsettings-qt.pro 2013-06-20 19:24:56 +0000
40+++ gsettings-qt.pro 2013-06-25 16:44:35 +0000
41@@ -1,2 +1,2 @@
42 TEMPLATE = subdirs
43-SUBDIRS += GSettings/gsettings-qt.pro
44+SUBDIRS += GSettings/gsettings-qt.pro tests/tests.pro
45
46=== added directory 'tests'
47=== added file 'tests/com.canonical.gsettings.test.gschema.xml'
48--- tests/com.canonical.gsettings.test.gschema.xml 1970-01-01 00:00:00 +0000
49+++ tests/com.canonical.gsettings.test.gschema.xml 2013-06-25 16:44:35 +0000
50@@ -0,0 +1,17 @@
51+<?xml version="1.0" encoding="UTF-8"?>
52+<schemalist>
53+ <schema id="com.canonical.gsettings.Test" path="/com/canonical/gsettings/test/">
54+ <key name="test-integer" type="i">
55+ <default>42</default>
56+ </key>
57+ <key name="test-double" type="d">
58+ <default>1.5</default>
59+ </key>
60+ <key name="test-boolean" type="b">
61+ <default>false</default>
62+ </key>
63+ <key name="test-string" type="s">
64+ <default>"hello"</default>
65+ </key>
66+ </schema>
67+</schemalist>
68
69=== added file 'tests/test.cpp'
70--- tests/test.cpp 1970-01-01 00:00:00 +0000
71+++ tests/test.cpp 2013-06-25 16:44:35 +0000
72@@ -0,0 +1,3 @@
73+#include <QtQuickTest/quicktest.h>
74+
75+QUICK_TEST_MAIN(GSettings)
76
77=== added file 'tests/tests.pro'
78--- tests/tests.pro 1970-01-01 00:00:00 +0000
79+++ tests/tests.pro 2013-06-25 16:44:35 +0000
80@@ -0,0 +1,16 @@
81+TEMPLATE = app
82+QT += qml testlib
83+QT -= gui
84+CONFIG += qmltestcase
85+TARGET = test
86+IMPORTPATH = $$PWD/..
87+SOURCES = test.cpp
88+
89+schema.target = gschemas.compiled
90+schema.commands = glib-compile-schemas $$PWD
91+schema.depends = com.canonical.gsettings.test.gschema.xml
92+QMAKE_EXTRA_TARGETS += schema
93+PRE_TARGETDEPS = gschemas.compiled
94+
95+# qmake prepends this to the command line executed by `make check`
96+check.commands = GSETTINGS_BACKEND=memory GSETTINGS_SCHEMA_DIR=$$PWD
97
98=== added file 'tests/tst_GSettings.qml'
99--- tests/tst_GSettings.qml 1970-01-01 00:00:00 +0000
100+++ tests/tst_GSettings.qml 2013-06-25 16:44:35 +0000
101@@ -0,0 +1,23 @@
102+
103+import QtTest 1.0
104+import GSettings 1.0
105+
106+TestCase {
107+ GSettings {
108+ id: settings
109+ schema: "com.canonical.gsettings.Test"
110+ }
111+
112+ function readWriteKey(key, expectedValue, newValue) {
113+ compare(settings[key], expectedValue, "read " + key);
114+ settings[key] = newValue;
115+ compare(settings[key], newValue, "write " + key);
116+ }
117+
118+ function test_types() {
119+ readWriteKey("testInteger", 42, 2);
120+ readWriteKey("testDouble", 1.5, 2.5);
121+ readWriteKey("testBoolean", false, true);
122+ readWriteKey("testString", "hello", "bye");
123+ }
124+}

Subscribers

People subscribed via source and target branches

to all changes: