Merge lp:~mhr3/unity/fix-scope-tests into lp:unity
- fix-scope-tests
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3435 |
Proposed branch: | lp:~mhr3/unity/fix-scope-tests |
Merge into: | lp:unity |
Diff against target: |
1005 lines (+115/-613) 11 files modified
debian/control (+2/-1) tests/CMakeLists.txt (+2/-4) tests/dummy-dbus-test-runner.sh (+0/-62) tests/test_categories.cpp (+20/-17) tests/test_scope_impl.c (+30/-449) tests/test_scope_impl.h (+6/-36) tests/test_scope_proxy.cpp (+3/-3) tests/test_service_main.cpp (+16/-12) tests/test_service_model.cpp (+19/-5) tests/test_service_scope.cpp (+13/-21) tests/test_service_scope.h (+4/-3) |
To merge this branch: | bzr merge lp:~mhr3/unity/fix-scope-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Marco Trevisan (Treviño) | Approve | ||
Review via email: mp+174447@code.launchpad.net |
Commit message
Fix scope-related tests.
Description of the change
Fix scope-related tests.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
This is awesome, thanks!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3425
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2426
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3426
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3426
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3427
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3428
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3429
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3430
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
You would probably merge this against lp:~3v1n0/unity/gdbus-interface-fix-ref-unref at this point, also what about continuing using the crafted dbus launch script?
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3431
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michal Hruby (mhr3) wrote : | # |
> You would probably merge this against lp:~3v1n0/unity/gdbus-interface-fix-ref-
> unref at this point, also what about continuing using the crafted dbus launch
> script?
Looks like CI is fine with the dbus-test-runner, so I'd rather keep it, afterall it has some nice features that the script doesn't (like the timeout, clear separation of what's coming from the server and the client, waiting for a name before starting a task...)
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Looks great, thanks!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Michal Hruby (mhr3) wrote : | # |
Disabled the TestCategoriesC
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3432
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3433
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3434
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
So unfortunately the new libdee is not in the local repo that jenkins is using for building this during CI, so we have to wait until it reaches the daily ppa... :(
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3434
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Michal Hruby (mhr3) wrote : | # |
> So unfortunately the new libdee is not in the local repo that jenkins is using
> for building this during CI, so we have to wait until it reaches the daily
> ppa... :(
Seems it's released now, let's try again.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2013-07-15 10:00:58 +0000 | |||
3 | +++ debian/control 2013-07-19 11:30:33 +0000 | |||
4 | @@ -5,6 +5,7 @@ | |||
5 | 5 | Build-Depends: cmake, | 5 | Build-Depends: cmake, |
6 | 6 | compiz-dev (>= 1:0.9.9~daily13.01.25bzr3586), | 6 | compiz-dev (>= 1:0.9.9~daily13.01.25bzr3586), |
7 | 7 | debhelper (>= 9.0.0~), | 7 | debhelper (>= 9.0.0~), |
8 | 8 | dbus-test-runner, | ||
9 | 8 | dh-migrations, | 9 | dh-migrations, |
10 | 9 | dh-translations (>= 94), | 10 | dh-translations (>= 94), |
11 | 10 | google-mock (>= 1.6.0+svn437), | 11 | google-mock (>= 1.6.0+svn437), |
12 | @@ -18,7 +19,7 @@ | |||
13 | 18 | libcairo2-dev, | 19 | libcairo2-dev, |
14 | 19 | libcompizconfig0-dev (>= 1:0.9.9~daily12.12.05-0ubuntu2), | 20 | libcompizconfig0-dev (>= 1:0.9.9~daily12.12.05-0ubuntu2), |
15 | 20 | libdbusmenu-glib-dev (>= 0.3.91), | 21 | libdbusmenu-glib-dev (>= 0.3.91), |
17 | 21 | libdee-dev (>= 1.0.0), | 22 | libdee-dev (>= 1.2.6), |
18 | 22 | libgee-dev (>= 0.5.0), | 23 | libgee-dev (>= 0.5.0), |
19 | 23 | libgeis-dev (>= 2.0.10), | 24 | libgeis-dev (>= 2.0.10), |
20 | 24 | libgl1-mesa-dri, | 25 | libgl1-mesa-dri, |
21 | 25 | 26 | ||
22 | === modified file 'tests/CMakeLists.txt' | |||
23 | --- tests/CMakeLists.txt 2013-07-12 19:37:48 +0000 | |||
24 | +++ tests/CMakeLists.txt 2013-07-19 11:30:33 +0000 | |||
25 | @@ -353,7 +353,6 @@ | |||
26 | 353 | set (TEST_RESULT_DIR ${CMAKE_BINARY_DIR}/tests) | 353 | set (TEST_RESULT_DIR ${CMAKE_BINARY_DIR}/tests) |
27 | 354 | set (TEST_RESULT_XML ${TEST_RESULT_DIR}/test-results.xml) | 354 | set (TEST_RESULT_XML ${TEST_RESULT_DIR}/test-results.xml) |
28 | 355 | set (TEST_RESULT_HTML ${TEST_RESULT_DIR}/test-results.html) | 355 | set (TEST_RESULT_HTML ${TEST_RESULT_DIR}/test-results.html) |
29 | 356 | set (DUMMY_DBUS_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-dbus-test-runner.sh) | ||
30 | 357 | set (DUMMY_XORG_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-xorg-test-runner.sh) | 356 | set (DUMMY_XORG_TEST_RUNNER ${CMAKE_CURRENT_SOURCE_DIR}/dummy-xorg-test-runner.sh) |
31 | 358 | if (ENABLE_X_SUPPORT) | 357 | if (ENABLE_X_SUPPORT) |
32 | 359 | set (GTEST_TEST_COMMAND ./test-gtest --gtest_output=xml:./test-gtest.xml) | 358 | set (GTEST_TEST_COMMAND ./test-gtest --gtest_output=xml:./test-gtest.xml) |
33 | @@ -361,13 +360,12 @@ | |||
34 | 361 | endif (ENABLE_X_SUPPORT) | 360 | endif (ENABLE_X_SUPPORT) |
35 | 362 | set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless --gtest_output=xml:./test-gtest-xless.xml) | 361 | set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless --gtest_output=xml:./test-gtest-xless.xml) |
36 | 363 | set (GTEST_TEST_COMMAND_SLOW ./test-gtest-slow --gtest_output=xml:./test-gtest-slow.xml) | 362 | set (GTEST_TEST_COMMAND_SLOW ./test-gtest-slow --gtest_output=xml:./test-gtest-slow.xml) |
38 | 364 | set (GTEST_TEST_COMMAND_DBUS ${DUMMY_DBUS_TEST_RUNNER} ./test-gtest-service ./test-gtest-dbus --gtest_output=xml:./test-gtest-dbus.xml) | 363 | set (GTEST_TEST_COMMAND_DBUS dbus-test-runner --max-wait=300 --task ./test-gtest-service --task-name test-service --task=./test-gtest-dbus --task-name=test-dbus --wait-for=com.canonical.Unity.Test.Scope --parameter=--gtest_output=xml:./test-gtest-dbus.xml --parameter=--gtest_filter=-TestCategoriesChanging*) |
39 | 365 | 364 | ||
40 | 366 | set (TEST_COMMAND_XLESS | 365 | set (TEST_COMMAND_XLESS |
41 | 367 | ${GTEST_TEST_COMMAND_XLESS} | 366 | ${GTEST_TEST_COMMAND_XLESS} |
42 | 368 | && ${GTEST_TEST_COMMAND_GESTURES} | 367 | && ${GTEST_TEST_COMMAND_GESTURES} |
45 | 369 | && ${GTEST_TEST_COMMAND_DBUS} --gtest_filter=-TestScope* | 368 | && ${GTEST_TEST_COMMAND_DBUS}) |
44 | 370 | && echo "Warning, TestScope* DBus test cases are disabled!!") | ||
46 | 371 | 369 | ||
47 | 372 | set (TEST_COMMAND | 370 | set (TEST_COMMAND |
48 | 373 | ${GTEST_TEST_COMMAND} | 371 | ${GTEST_TEST_COMMAND} |
49 | 374 | 372 | ||
50 | === removed file 'tests/dummy-dbus-test-runner.sh' | |||
51 | --- tests/dummy-dbus-test-runner.sh 2013-07-11 02:01:58 +0000 | |||
52 | +++ tests/dummy-dbus-test-runner.sh 1970-01-01 00:00:00 +0000 | |||
53 | @@ -1,62 +0,0 @@ | |||
54 | 1 | #!/bin/bash | ||
55 | 2 | # Copyright (C) 2013 Canonical Ltd | ||
56 | 3 | # | ||
57 | 4 | # This program is free software: you can redistribute it and/or modify | ||
58 | 5 | # it under the terms of the GNU General Public License version 3 as | ||
59 | 6 | # published by the Free Software Foundation. | ||
60 | 7 | # | ||
61 | 8 | # This program is distributed in the hope that it will be useful, | ||
62 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
63 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
64 | 11 | # GNU General Public License for more details. | ||
65 | 12 | # | ||
66 | 13 | # You should have received a copy of the GNU General Public License | ||
67 | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
68 | 15 | # | ||
69 | 16 | # Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
70 | 17 | |||
71 | 18 | function check_command() | ||
72 | 19 | { | ||
73 | 20 | local binary=$(which $1) | ||
74 | 21 | |||
75 | 22 | if [ -z "$binary" ]; then | ||
76 | 23 | if [ -z "$1" ]; then | ||
77 | 24 | echo "Invalid $2 submitted" | ||
78 | 25 | elif [ ! -x "$1" ]; then | ||
79 | 26 | echo "The provided $1 is not executable" | ||
80 | 27 | fi | ||
81 | 28 | |||
82 | 29 | exit 1 | ||
83 | 30 | fi | ||
84 | 31 | } | ||
85 | 32 | |||
86 | 33 | check_command "$1" "service" | ||
87 | 34 | service=$1 | ||
88 | 35 | for p in $(pidof $(basename $service)); do kill $p; done | ||
89 | 36 | |||
90 | 37 | shift | ||
91 | 38 | check_command "$1" "test" | ||
92 | 39 | binary=$1 | ||
93 | 40 | |||
94 | 41 | dbusfile=$(mktemp -t dummy.dbus.sh.XXXXXXXX) | ||
95 | 42 | dbus-launch --sh-syntax > $dbusfile | ||
96 | 43 | source $dbusfile | ||
97 | 44 | |||
98 | 45 | function do_cleanup() | ||
99 | 46 | { | ||
100 | 47 | if [ -n "$service_pid" ] && (kill -0 $service_pid &> /dev/null); then kill $service_pid; fi | ||
101 | 48 | kill $DBUS_SESSION_BUS_PID | ||
102 | 49 | rm $dbusfile | ||
103 | 50 | } | ||
104 | 51 | |||
105 | 52 | trap "do_cleanup; exit 1" SIGHUP SIGINT SIGSEGV SIGTERM | ||
106 | 53 | |||
107 | 54 | $service &> /dev/null & | ||
108 | 55 | service_pid=$! | ||
109 | 56 | |||
110 | 57 | shift | ||
111 | 58 | $binary $@ | ||
112 | 59 | ret_val=$? | ||
113 | 60 | |||
114 | 61 | do_cleanup | ||
115 | 62 | exit $ret_val | ||
116 | 63 | 0 | ||
117 | === modified file 'tests/test_categories.cpp' | |||
118 | --- tests/test_categories.cpp 2013-07-10 16:01:34 +0000 | |||
119 | +++ tests/test_categories.cpp 2013-07-19 11:30:33 +0000 | |||
120 | @@ -12,8 +12,6 @@ | |||
121 | 12 | namespace | 12 | namespace |
122 | 13 | { | 13 | { |
123 | 14 | 14 | ||
124 | 15 | static const string swarm_name = "com.canonical.test.categoriesmodel"; | ||
125 | 16 | static const string swarm_name_changing = "com.canonical.test.categoriesmodel_changing"; | ||
126 | 17 | static const unsigned int n_rows = 5; | 15 | static const unsigned int n_rows = 5; |
127 | 18 | 16 | ||
128 | 19 | static void WaitForSynchronize(Categories& model) | 17 | static void WaitForSynchronize(Categories& model) |
129 | @@ -25,7 +23,17 @@ | |||
130 | 25 | { | 23 | { |
131 | 26 | TestCategories() | 24 | TestCategories() |
132 | 27 | { | 25 | { |
134 | 28 | model.swarm_name = swarm_name; | 26 | model.swarm_name = "com.canonical.test.categoriesmodel"; |
135 | 27 | } | ||
136 | 28 | |||
137 | 29 | Categories model; | ||
138 | 30 | }; | ||
139 | 31 | |||
140 | 32 | struct TestCategoriesChanging : testing::Test | ||
141 | 33 | { | ||
142 | 34 | TestCategoriesChanging() | ||
143 | 35 | { | ||
144 | 36 | model.swarm_name = "com.canonical.test.categoriesmodel_changing"; | ||
145 | 29 | } | 37 | } |
146 | 30 | 38 | ||
147 | 31 | Categories model; | 39 | Categories model; |
148 | @@ -33,7 +41,7 @@ | |||
149 | 33 | 41 | ||
150 | 34 | TEST_F(TestCategories, TestConstruction) | 42 | TEST_F(TestCategories, TestConstruction) |
151 | 35 | { | 43 | { |
153 | 36 | EXPECT_EQ(model.swarm_name(), swarm_name); | 44 | EXPECT_EQ(model.swarm_name(), "com.canonical.test.categoriesmodel"); |
154 | 37 | } | 45 | } |
155 | 38 | 46 | ||
156 | 39 | TEST_F(TestCategories, TestSignalProxyAdded) | 47 | TEST_F(TestCategories, TestSignalProxyAdded) |
157 | @@ -122,42 +130,38 @@ | |||
158 | 122 | } | 130 | } |
159 | 123 | 131 | ||
160 | 124 | // We're testing the model's ability to store and retrieve random pointers | 132 | // We're testing the model's ability to store and retrieve random pointers |
162 | 125 | TEST_F(TestCategories, TestOnRowChanged) | 133 | TEST_F(TestCategoriesChanging, TestOnRowChanged) |
163 | 126 | { | 134 | { |
164 | 127 | model.swarm_name = swarm_name_changing; | ||
165 | 128 | WaitForSynchronize(model); | 135 | WaitForSynchronize(model); |
166 | 129 | 136 | ||
167 | 130 | unsigned changed = 0; | 137 | unsigned changed = 0; |
168 | 131 | model.category_changed.connect([&changed] (Category const&) { ++changed; }); | 138 | model.category_changed.connect([&changed] (Category const&) { ++changed; }); |
170 | 132 | Utils::WaitUntil([&changed] { return changed == 1; }, true, 2, "Did not detect row change from "+swarm_name_changing+"."); | 139 | Utils::WaitUntil([&changed] { return changed == 1; }, true, 2, "Did not detect row change."); |
171 | 133 | } | 140 | } |
172 | 134 | 141 | ||
173 | 135 | 142 | ||
174 | 136 | // We're testing the model's ability to store and retrieve random pointers | 143 | // We're testing the model's ability to store and retrieve random pointers |
176 | 137 | TEST_F(TestCategories, TestOnRowAdded) | 144 | TEST_F(TestCategoriesChanging, TestOnRowAdded) |
177 | 138 | { | 145 | { |
178 | 139 | model.swarm_name = swarm_name_changing; | ||
179 | 140 | WaitForSynchronize(model); | 146 | WaitForSynchronize(model); |
180 | 141 | 147 | ||
181 | 142 | unsigned added = 0; | 148 | unsigned added = 0; |
182 | 143 | model.category_added.connect([&added] (Category const&) { ++added;}); | 149 | model.category_added.connect([&added] (Category const&) { ++added;}); |
184 | 144 | Utils::WaitUntil([&added] { return added == 1; }, true, 2, "Did not detect row add "+swarm_name_changing+"."); | 150 | Utils::WaitUntil([&added] { return added == 1; }, true, 2, "Did not detect row add."); |
185 | 145 | } | 151 | } |
186 | 146 | 152 | ||
187 | 147 | // We're testing the model's ability to store and retrieve random pointers | 153 | // We're testing the model's ability to store and retrieve random pointers |
189 | 148 | TEST_F(TestCategories, TestOnRowRemoved) | 154 | TEST_F(TestCategoriesChanging, TestOnRowRemoved) |
190 | 149 | { | 155 | { |
191 | 150 | model.swarm_name = swarm_name_changing; | ||
192 | 151 | WaitForSynchronize(model); | 156 | WaitForSynchronize(model); |
193 | 152 | 157 | ||
194 | 153 | unsigned removed = 0; | 158 | unsigned removed = 0; |
195 | 154 | model.category_removed.connect([&removed] (Category const&) { ++removed; }); | 159 | model.category_removed.connect([&removed] (Category const&) { ++removed; }); |
197 | 155 | Utils::WaitUntil([&removed] { return removed == 1; }, true, 2, "Did not detect row removal "+swarm_name_changing+"."); | 160 | Utils::WaitUntil([&removed] { return removed == 1; }, true, 2, "Did not detect row removal."); |
198 | 156 | } | 161 | } |
199 | 157 | 162 | ||
201 | 158 | TEST_F(TestCategories, TestCategoryCopy) | 163 | TEST_F(TestCategoriesChanging, TestCategoryCopy) |
202 | 159 | { | 164 | { |
203 | 160 | model.swarm_name = swarm_name_changing; | ||
204 | 161 | WaitForSynchronize(model); | 165 | WaitForSynchronize(model); |
205 | 162 | 166 | ||
206 | 163 | Category category = model.RowAtIndex(0); | 167 | Category category = model.RowAtIndex(0); |
207 | @@ -170,9 +174,8 @@ | |||
208 | 170 | EXPECT_EQ(category.index(), category_2.index()); | 174 | EXPECT_EQ(category.index(), category_2.index()); |
209 | 171 | } | 175 | } |
210 | 172 | 176 | ||
212 | 173 | TEST_F(TestCategories, TestCategoryEqual) | 177 | TEST_F(TestCategoriesChanging, TestCategoryEqual) |
213 | 174 | { | 178 | { |
214 | 175 | model.swarm_name = swarm_name_changing; | ||
215 | 176 | WaitForSynchronize(model); | 179 | WaitForSynchronize(model); |
216 | 177 | 180 | ||
217 | 178 | Category category = model.RowAtIndex(0); | 181 | Category category = model.RowAtIndex(0); |
218 | 179 | 182 | ||
219 | === modified file 'tests/test_scope_impl.c' | |||
220 | --- tests/test_scope_impl.c 2013-03-27 17:26:54 +0000 | |||
221 | +++ tests/test_scope_impl.c 2013-07-19 11:30:33 +0000 | |||
222 | @@ -24,195 +24,7 @@ | |||
223 | 24 | 24 | ||
224 | 25 | #define TEST_DBUS_NAME "com.canonical.Unity.Test.Scope" | 25 | #define TEST_DBUS_NAME "com.canonical.Unity.Test.Scope" |
225 | 26 | 26 | ||
415 | 27 | #define _g_object_unref_safe(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) | 27 | static UnityAbstractPreview* test_scope_preview(UnityResultPreviewer* self, gpointer user_data) |
227 | 28 | #define _g_free_safe(var) (var = (g_free (var), NULL)) | ||
228 | 29 | |||
229 | 30 | /* ------------------ Test Searcher ---------------------- */ | ||
230 | 31 | |||
231 | 32 | #define TEST_TYPE_SEARCHER (test_searcher_get_type ()) | ||
232 | 33 | #define TEST_SCOPE_SEARCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_SEARCHER, TestSearcher)) | ||
233 | 34 | #define TEST_SEARCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_SEARCHER, TestSearcherClass)) | ||
234 | 35 | #define TEST_IS_SEARCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_SEARCHER)) | ||
235 | 36 | #define TEST_IS_SEARCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_TYPE_SEARCHER)) | ||
236 | 37 | #define TEST_SEARCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SEARCHER, TestSearcherClass)) | ||
237 | 38 | |||
238 | 39 | typedef struct _TestSearcher TestSearcher; | ||
239 | 40 | typedef struct _TestSearcherClass TestSearcherClass; | ||
240 | 41 | typedef struct _TestSearcherPrivate TestSearcherPrivate; | ||
241 | 42 | |||
242 | 43 | struct _TestSearcher { | ||
243 | 44 | UnityScopeSearchBase parent_instance; | ||
244 | 45 | TestSearcherPrivate * priv; | ||
245 | 46 | }; | ||
246 | 47 | |||
247 | 48 | struct _TestSearcherClass { | ||
248 | 49 | UnityScopeSearchBaseClass parent_class; | ||
249 | 50 | }; | ||
250 | 51 | |||
251 | 52 | struct _TestSearcherPrivate { | ||
252 | 53 | TestScope* _owner; | ||
253 | 54 | }; | ||
254 | 55 | |||
255 | 56 | typedef struct _SearcherRunData SearcherRunData; | ||
256 | 57 | |||
257 | 58 | G_DEFINE_TYPE(TestSearcher, test_searcher, UNITY_TYPE_SCOPE_SEARCH_BASE); | ||
258 | 59 | |||
259 | 60 | #define TEST_SEARCHER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_TYPE_SEARCHER, TestSearcherPrivate)) | ||
260 | 61 | enum { | ||
261 | 62 | TEST_SEARCHER_DUMMY_PROPERTY, | ||
262 | 63 | TEST_SEARCHER_OWNER | ||
263 | 64 | }; | ||
264 | 65 | |||
265 | 66 | static TestSearcher* test_searcher_new (TestScope* scope); | ||
266 | 67 | static void test_searcher_run (UnityScopeSearchBase* base); | ||
267 | 68 | static TestScope* test_searcher_get_owner (TestSearcher* self); | ||
268 | 69 | static void test_searcher_set_owner (TestSearcher* self, TestScope* value); | ||
269 | 70 | static void test_searcher_finalize (GObject* obj); | ||
270 | 71 | static void test_searcher_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); | ||
271 | 72 | static void test_searcher_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); | ||
272 | 73 | |||
273 | 74 | static TestSearcher* test_searcher_new (TestScope* scope) | ||
274 | 75 | { | ||
275 | 76 | return (TestSearcher*) g_object_new (TEST_TYPE_SEARCHER, "owner", scope, NULL); | ||
276 | 77 | } | ||
277 | 78 | |||
278 | 79 | static TestScope* test_searcher_get_owner (TestSearcher* self) | ||
279 | 80 | { | ||
280 | 81 | g_return_val_if_fail (self != NULL, NULL); | ||
281 | 82 | return self->priv->_owner; | ||
282 | 83 | } | ||
283 | 84 | |||
284 | 85 | static void test_searcher_set_owner (TestSearcher* self, TestScope* value) | ||
285 | 86 | { | ||
286 | 87 | g_return_if_fail (self != NULL); | ||
287 | 88 | self->priv->_owner = value; | ||
288 | 89 | g_object_notify ((GObject *) self, "owner"); | ||
289 | 90 | } | ||
290 | 91 | |||
291 | 92 | static void test_searcher_class_init (TestSearcherClass * klass) | ||
292 | 93 | { | ||
293 | 94 | g_type_class_add_private (klass, sizeof (TestSearcherPrivate)); | ||
294 | 95 | UNITY_SCOPE_SEARCH_BASE_CLASS (klass)->run = test_searcher_run; | ||
295 | 96 | G_OBJECT_CLASS (klass)->get_property = test_searcher_get_property; | ||
296 | 97 | G_OBJECT_CLASS (klass)->set_property = test_searcher_set_property; | ||
297 | 98 | G_OBJECT_CLASS (klass)->finalize = test_searcher_finalize; | ||
298 | 99 | g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_SEARCHER_OWNER, g_param_spec_object ("owner", "owner", "owner", TEST_TYPE_SCOPE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); | ||
299 | 100 | } | ||
300 | 101 | |||
301 | 102 | static void test_searcher_init(TestSearcher* self) | ||
302 | 103 | { | ||
303 | 104 | self->priv = TEST_SEARCHER_GET_PRIVATE (self); | ||
304 | 105 | } | ||
305 | 106 | |||
306 | 107 | static void test_searcher_finalize (GObject* obj) | ||
307 | 108 | { | ||
308 | 109 | TestSearcher * self; | ||
309 | 110 | self = TEST_SCOPE_SEARCHER (obj); | ||
310 | 111 | G_OBJECT_CLASS (test_searcher_parent_class)->finalize (obj); | ||
311 | 112 | } | ||
312 | 113 | |||
313 | 114 | static void test_searcher_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) | ||
314 | 115 | { | ||
315 | 116 | TestSearcher * self; | ||
316 | 117 | self = TEST_SCOPE_SEARCHER (object); | ||
317 | 118 | switch (property_id) { | ||
318 | 119 | case TEST_SEARCHER_OWNER: | ||
319 | 120 | g_value_set_object (value, test_searcher_get_owner (self)); | ||
320 | 121 | break; | ||
321 | 122 | default: | ||
322 | 123 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
323 | 124 | break; | ||
324 | 125 | } | ||
325 | 126 | } | ||
326 | 127 | |||
327 | 128 | static void test_searcher_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) | ||
328 | 129 | { | ||
329 | 130 | TestSearcher * self; | ||
330 | 131 | self = TEST_SCOPE_SEARCHER (object); | ||
331 | 132 | switch (property_id) { | ||
332 | 133 | case TEST_SEARCHER_OWNER: | ||
333 | 134 | test_searcher_set_owner (self, g_value_get_object (value)); | ||
334 | 135 | break; | ||
335 | 136 | default: | ||
336 | 137 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
337 | 138 | break; | ||
338 | 139 | } | ||
339 | 140 | } | ||
340 | 141 | |||
341 | 142 | struct _SearcherRunData | ||
342 | 143 | { | ||
343 | 144 | int _ref_count_; | ||
344 | 145 | TestSearcher * self; | ||
345 | 146 | GMainLoop* ml; | ||
346 | 147 | UnityScopeSearchBaseCallback async_callback; | ||
347 | 148 | void* async_callback_target; | ||
348 | 149 | }; | ||
349 | 150 | |||
350 | 151 | static SearcherRunData* run_data_ref (SearcherRunData* data) | ||
351 | 152 | { | ||
352 | 153 | g_atomic_int_inc (&data->_ref_count_); | ||
353 | 154 | return data; | ||
354 | 155 | } | ||
355 | 156 | |||
356 | 157 | static void run_data_unref (void * _userdata_) | ||
357 | 158 | { | ||
358 | 159 | SearcherRunData* data; | ||
359 | 160 | data = (SearcherRunData*) _userdata_; | ||
360 | 161 | if (g_atomic_int_dec_and_test (&data->_ref_count_)) | ||
361 | 162 | { | ||
362 | 163 | TestSearcher* self; | ||
363 | 164 | self = data->self; | ||
364 | 165 | g_main_loop_unref (data->ml); | ||
365 | 166 | g_object_unref (self); | ||
366 | 167 | g_slice_free (SearcherRunData, data); | ||
367 | 168 | } | ||
368 | 169 | } | ||
369 | 170 | |||
370 | 171 | static gboolean test_searcher_main_loop_func (gpointer data) | ||
371 | 172 | { | ||
372 | 173 | SearcherRunData* search_data; | ||
373 | 174 | search_data = (SearcherRunData*) data; | ||
374 | 175 | |||
375 | 176 | TestSearcher* self; | ||
376 | 177 | self = search_data->self; | ||
377 | 178 | UNITY_SCOPE_SEARCH_BASE_GET_CLASS (self)->run(UNITY_SCOPE_SEARCH_BASE (self)); | ||
378 | 179 | |||
379 | 180 | search_data->async_callback (UNITY_SCOPE_SEARCH_BASE (self), search_data->async_callback_target); | ||
380 | 181 | g_main_loop_quit (search_data->ml); | ||
381 | 182 | return FALSE; | ||
382 | 183 | } | ||
383 | 184 | |||
384 | 185 | static void test_searcher_run (UnityScopeSearchBase* base) | ||
385 | 186 | { | ||
386 | 187 | TestSearcher* self; | ||
387 | 188 | self = TEST_SCOPE_SEARCHER (base); | ||
388 | 189 | |||
389 | 190 | g_signal_emit_by_name (self->priv->_owner, "search", base); | ||
390 | 191 | } | ||
391 | 192 | |||
392 | 193 | /* ------------------ Test Result Previewer ---------------------- */ | ||
393 | 194 | |||
394 | 195 | #define TEST_TYPE_RESULT_PREVIEWER (test_result_previewer_get_type ()) | ||
395 | 196 | #define TEST_RESULT_PREVIEWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_RESULT_PREVIEWER, TestResultPreviewer)) | ||
396 | 197 | #define TEST_RESULT_PREVIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_RESULT_PREVIEWER, TestResultPreviewerClass)) | ||
397 | 198 | #define TEST_IS_RESULT_PREVIEWER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_RESULT_PREVIEWER)) | ||
398 | 199 | #define TEST_IS_RESULT_PREVIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_TYPE_RESULT_PREVIEWER)) | ||
399 | 200 | #define TEST_RESULT_PREVIEWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_RESULT_PREVIEWER, TestResultPreviewerClass)) | ||
400 | 201 | |||
401 | 202 | typedef struct _TestResultPreviewer TestResultPreviewer; | ||
402 | 203 | typedef struct _TestResultPreviewerClass TestResultPreviewerClass; | ||
403 | 204 | |||
404 | 205 | struct _TestResultPreviewer { | ||
405 | 206 | UnityResultPreviewer parent_instance; | ||
406 | 207 | }; | ||
407 | 208 | |||
408 | 209 | struct _TestResultPreviewerClass { | ||
409 | 210 | UnityResultPreviewerClass parent_class; | ||
410 | 211 | }; | ||
411 | 212 | |||
412 | 213 | G_DEFINE_TYPE(TestResultPreviewer, test_result_previewer, UNITY_TYPE_RESULT_PREVIEWER); | ||
413 | 214 | |||
414 | 215 | static UnityAbstractPreview* test_result_previewer_run(UnityResultPreviewer* self) | ||
416 | 216 | { | 28 | { |
417 | 217 | UnityAbstractPreview* preview; | 29 | UnityAbstractPreview* preview; |
418 | 218 | UnityPreviewAction* action; | 30 | UnityPreviewAction* action; |
419 | @@ -222,172 +34,17 @@ | |||
420 | 222 | unity_preview_add_action(UNITY_PREVIEW (preview), action); | 34 | unity_preview_add_action(UNITY_PREVIEW (preview), action); |
421 | 223 | 35 | ||
422 | 224 | action = unity_preview_action_new ("action2", "Action 2", NULL); | 36 | action = unity_preview_action_new ("action2", "Action 2", NULL); |
423 | 225 | // GHashTable* hints = unity_preview_action_get_hints(action); | ||
424 | 226 | |||
425 | 227 | unity_preview_add_action(UNITY_PREVIEW (preview), action); | 37 | unity_preview_add_action(UNITY_PREVIEW (preview), action); |
426 | 228 | 38 | ||
427 | 229 | return preview; | 39 | return preview; |
428 | 230 | } | 40 | } |
429 | 231 | 41 | ||
589 | 232 | static void test_result_previewer_class_init(TestResultPreviewerClass* klass) | 42 | static UnityActivationResponse* test_scope_activate(UnityScopeResult* result, UnitySearchMetadata* metadata, const gchar* action_id, gpointer data) |
590 | 233 | { | 43 | { |
591 | 234 | UNITY_RESULT_PREVIEWER_CLASS (klass)->run = test_result_previewer_run; | 44 | return unity_activation_response_new (UNITY_HANDLED_TYPE_HIDE_DASH, ""); |
592 | 235 | } | 45 | } |
593 | 236 | 46 | ||
594 | 237 | static void test_result_previewer_init(TestResultPreviewer* self) | 47 | static UnitySchema* test_scope_get_schema(void) |
436 | 238 | { | ||
437 | 239 | } | ||
438 | 240 | |||
439 | 241 | TestResultPreviewer* test_result_previewer_new () | ||
440 | 242 | { | ||
441 | 243 | return (TestResultPreviewer*) g_object_new (TEST_TYPE_RESULT_PREVIEWER, NULL); | ||
442 | 244 | } | ||
443 | 245 | |||
444 | 246 | /* ------------------ Test Scope ---------------------- */ | ||
445 | 247 | |||
446 | 248 | #define TEST_SCOPE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_TYPE_SCOPE, TestScopePrivate)) | ||
447 | 249 | |||
448 | 250 | G_DEFINE_TYPE(TestScope, test_scope, UNITY_TYPE_ABSTRACT_SCOPE); | ||
449 | 251 | |||
450 | 252 | struct _TestScopePrivate | ||
451 | 253 | { | ||
452 | 254 | gchar* _dbus_path; | ||
453 | 255 | UnityScopeDBusConnector* _connector; | ||
454 | 256 | UnityCategorySet* _categories; | ||
455 | 257 | UnityFilterSet* _filters; | ||
456 | 258 | }; | ||
457 | 259 | |||
458 | 260 | enum { | ||
459 | 261 | TEST_SCOPE_DUMMY_PROPERTY, | ||
460 | 262 | TEST_SCOPE_DBUS_PATH | ||
461 | 263 | }; | ||
462 | 264 | |||
463 | 265 | static UnityScopeSearchBase* test_scope_create_search_for_query(UnityAbstractScope* self, UnitySearchContext* search_context); | ||
464 | 266 | static UnityResultPreviewer* test_scope_create_previewer(UnityAbstractScope* self, UnityScopeResult* _result_, UnitySearchMetadata* metadata); | ||
465 | 267 | static UnityCategorySet* test_scope_get_categories(UnityAbstractScope* self); | ||
466 | 268 | static UnityFilterSet* test_scope_get_filters(UnityAbstractScope* self); | ||
467 | 269 | static UnitySchema* test_scope_get_schema(UnityAbstractScope* self); | ||
468 | 270 | static gchar* test_scope_get_search_hint(UnityAbstractScope* self); | ||
469 | 271 | static gchar* test_scope_get_group_name(UnityAbstractScope* self); | ||
470 | 272 | static gchar* test_scope_get_unique_name(UnityAbstractScope* self); | ||
471 | 273 | static UnityActivationResponse* test_scope_activate(UnityAbstractScope* self, UnityScopeResult* _result_, UnitySearchMetadata* metadata, const gchar* action_id); | ||
472 | 274 | static void test_scope_set_dbus_path (TestScope* self, const gchar* value); | ||
473 | 275 | static const gchar* test_scope_get_dbus_path (TestScope* self); | ||
474 | 276 | |||
475 | 277 | static void test_scope_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); | ||
476 | 278 | static void test_scope_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); | ||
477 | 279 | static void g_cclosure_user_marshal_OBJECT__STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); | ||
478 | 280 | |||
479 | 281 | static void test_scope_class_init(TestScopeClass* klass) | ||
480 | 282 | { | ||
481 | 283 | g_type_class_add_private (klass, sizeof (TestScopePrivate)); | ||
482 | 284 | |||
483 | 285 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->create_search_for_query = test_scope_create_search_for_query; | ||
484 | 286 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->create_previewer = test_scope_create_previewer; | ||
485 | 287 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->get_categories = test_scope_get_categories; | ||
486 | 288 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->get_filters = test_scope_get_filters; | ||
487 | 289 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->get_schema = test_scope_get_schema; | ||
488 | 290 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->get_search_hint = test_scope_get_search_hint; | ||
489 | 291 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->get_group_name = test_scope_get_group_name; | ||
490 | 292 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->get_unique_name = test_scope_get_unique_name; | ||
491 | 293 | UNITY_ABSTRACT_SCOPE_CLASS (klass)->activate = test_scope_activate; | ||
492 | 294 | G_OBJECT_CLASS (klass)->get_property = test_scope_get_property; | ||
493 | 295 | G_OBJECT_CLASS (klass)->set_property = test_scope_set_property; | ||
494 | 296 | |||
495 | 297 | g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_SCOPE_DBUS_PATH, g_param_spec_string ("dbus-path", "dbus-path", "dbus-path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); | ||
496 | 298 | g_signal_new ("search", TEST_TYPE_SCOPE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, UNITY_TYPE_SCOPE_SEARCH_BASE); | ||
497 | 299 | g_signal_new ("activate_uri", TEST_TYPE_SCOPE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_OBJECT__STRING, UNITY_TYPE_ACTIVATION_RESPONSE, 1, G_TYPE_STRING); | ||
498 | 300 | } | ||
499 | 301 | |||
500 | 302 | static void test_scope_init(TestScope* self) | ||
501 | 303 | { | ||
502 | 304 | self->priv = TEST_SCOPE_GET_PRIVATE (self); | ||
503 | 305 | |||
504 | 306 | self->priv->_dbus_path = NULL; | ||
505 | 307 | self->priv->_connector = NULL; | ||
506 | 308 | self->priv->_categories = NULL; | ||
507 | 309 | self->priv->_filters = NULL; | ||
508 | 310 | } | ||
509 | 311 | |||
510 | 312 | static void test_scope_finalize (GObject* obj) | ||
511 | 313 | { | ||
512 | 314 | TestScope * self; | ||
513 | 315 | self = G_TYPE_CHECK_INSTANCE_CAST (obj, TEST_TYPE_SCOPE, TestScope); | ||
514 | 316 | _g_free_safe (self->priv->_dbus_path); | ||
515 | 317 | _g_object_unref_safe (self->priv->_connector); | ||
516 | 318 | _g_object_unref_safe (self->priv->_categories); | ||
517 | 319 | G_OBJECT_CLASS (test_scope_parent_class)->finalize (obj); | ||
518 | 320 | } | ||
519 | 321 | |||
520 | 322 | static void test_scope_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) | ||
521 | 323 | { | ||
522 | 324 | TestScope * self; | ||
523 | 325 | self = G_TYPE_CHECK_INSTANCE_CAST (object, TEST_TYPE_SCOPE, TestScope); | ||
524 | 326 | switch (property_id) | ||
525 | 327 | { | ||
526 | 328 | case TEST_SCOPE_DBUS_PATH: | ||
527 | 329 | g_value_set_string (value, test_scope_get_dbus_path (self)); | ||
528 | 330 | break; | ||
529 | 331 | default: | ||
530 | 332 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
531 | 333 | break; | ||
532 | 334 | } | ||
533 | 335 | } | ||
534 | 336 | |||
535 | 337 | static void test_scope_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) | ||
536 | 338 | { | ||
537 | 339 | TestScope * self; | ||
538 | 340 | self = G_TYPE_CHECK_INSTANCE_CAST (object, TEST_TYPE_SCOPE, TestScope); | ||
539 | 341 | switch (property_id) { | ||
540 | 342 | case TEST_SCOPE_DBUS_PATH: | ||
541 | 343 | test_scope_set_dbus_path (self, g_value_get_string (value)); | ||
542 | 344 | break; | ||
543 | 345 | default: | ||
544 | 346 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
545 | 347 | break; | ||
546 | 348 | } | ||
547 | 349 | } | ||
548 | 350 | |||
549 | 351 | static UnityScopeSearchBase* test_scope_create_search_for_query(UnityAbstractScope* base, UnitySearchContext* search_context) | ||
550 | 352 | { | ||
551 | 353 | UnityScopeSearchBase* searcher; | ||
552 | 354 | TestScope* scope; | ||
553 | 355 | scope = (TestScope*) base; | ||
554 | 356 | searcher = (UnityScopeSearchBase*) test_searcher_new (scope); | ||
555 | 357 | |||
556 | 358 | UnitySearchContext ctx; | ||
557 | 359 | ctx = *search_context; | ||
558 | 360 | unity_scope_search_base_set_search_context (searcher, &ctx); | ||
559 | 361 | return searcher; | ||
560 | 362 | } | ||
561 | 363 | |||
562 | 364 | static UnityResultPreviewer* test_scope_create_previewer(UnityAbstractScope* self, UnityScopeResult* result, UnitySearchMetadata* metadata) | ||
563 | 365 | { | ||
564 | 366 | UnityResultPreviewer* previewer; | ||
565 | 367 | previewer = UNITY_RESULT_PREVIEWER (test_result_previewer_new()); | ||
566 | 368 | unity_scope_result_copy(result, &previewer->result); | ||
567 | 369 | return previewer; | ||
568 | 370 | } | ||
569 | 371 | |||
570 | 372 | static UnityCategorySet* test_scope_get_categories(UnityAbstractScope* base) | ||
571 | 373 | { | ||
572 | 374 | TestScope* self; | ||
573 | 375 | self = G_TYPE_CHECK_INSTANCE_CAST (base, TEST_TYPE_SCOPE, TestScope); | ||
574 | 376 | g_return_if_fail (self != NULL); | ||
575 | 377 | |||
576 | 378 | return self->priv->_categories; | ||
577 | 379 | } | ||
578 | 380 | |||
579 | 381 | static UnityFilterSet* test_scope_get_filters(UnityAbstractScope* base) | ||
580 | 382 | { | ||
581 | 383 | TestScope* self; | ||
582 | 384 | self = G_TYPE_CHECK_INSTANCE_CAST (base, TEST_TYPE_SCOPE, TestScope); | ||
583 | 385 | g_return_if_fail (self != NULL); | ||
584 | 386 | |||
585 | 387 | return self->priv->_filters; | ||
586 | 388 | } | ||
587 | 389 | |||
588 | 390 | static UnitySchema* test_scope_get_schema(UnityAbstractScope* self) | ||
595 | 391 | { | 48 | { |
596 | 392 | UnitySchema* schema = unity_schema_new (); | 49 | UnitySchema* schema = unity_schema_new (); |
597 | 393 | unity_schema_add_field (schema, "required_string", "s", UNITY_SCHEMA_FIELD_TYPE_REQUIRED); | 50 | unity_schema_add_field (schema, "required_string", "s", UNITY_SCHEMA_FIELD_TYPE_REQUIRED); |
598 | @@ -396,102 +53,26 @@ | |||
599 | 396 | return schema; | 53 | return schema; |
600 | 397 | } | 54 | } |
601 | 398 | 55 | ||
602 | 399 | static gchar* test_scope_get_search_hint(UnityAbstractScope* self) | ||
603 | 400 | { | ||
604 | 401 | return g_strdup ("Search hint"); | ||
605 | 402 | } | ||
606 | 403 | |||
607 | 404 | static gchar* test_scope_get_group_name(UnityAbstractScope* self) | ||
608 | 405 | { | ||
609 | 406 | return g_strdup (TEST_DBUS_NAME); | ||
610 | 407 | } | ||
611 | 408 | |||
612 | 409 | static gchar* test_scope_get_unique_name(UnityAbstractScope* base) | ||
613 | 410 | { | ||
614 | 411 | TestScope * self; | ||
615 | 412 | self = (TestScope*) base; | ||
616 | 413 | return g_strdup (self->priv->_dbus_path); | ||
617 | 414 | } | ||
618 | 415 | |||
619 | 416 | static UnityActivationResponse* test_scope_activate(UnityAbstractScope* self, UnityScopeResult* result, UnitySearchMetadata* metadata, const gchar* action_id) | ||
620 | 417 | { | ||
621 | 418 | UnityActivationResponse* response = NULL; | ||
622 | 419 | g_signal_emit_by_name (self, "activate-uri", result->uri, &response); | ||
623 | 420 | return response; | ||
624 | 421 | } | ||
625 | 422 | |||
626 | 423 | static const gchar* test_scope_get_dbus_path (TestScope* self) | ||
627 | 424 | { | ||
628 | 425 | g_return_val_if_fail (self != NULL, NULL); | ||
629 | 426 | return self->priv->_dbus_path; | ||
630 | 427 | } | ||
631 | 428 | |||
632 | 429 | static void test_scope_set_dbus_path (TestScope* self, const gchar* value) | ||
633 | 430 | { | ||
634 | 431 | g_return_if_fail (self != NULL); | ||
635 | 432 | _g_free_safe (self->priv->_dbus_path); | ||
636 | 433 | self->priv->_dbus_path = g_strdup (value);; | ||
637 | 434 | g_object_notify ((GObject *) self, "dbus-path"); | ||
638 | 435 | } | ||
639 | 436 | |||
640 | 437 | static void g_cclosure_user_marshal_OBJECT__STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) | ||
641 | 438 | { | ||
642 | 439 | typedef gpointer (*GMarshalFunc_OBJECT__STRING) (gpointer data1, const char* arg_1, gpointer data2); | ||
643 | 440 | register GMarshalFunc_OBJECT__STRING callback; | ||
644 | 441 | register GCClosure * cc; | ||
645 | 442 | register gpointer data1; | ||
646 | 443 | register gpointer data2; | ||
647 | 444 | gpointer v_return; | ||
648 | 445 | cc = (GCClosure *) closure; | ||
649 | 446 | g_return_if_fail (return_value != NULL); | ||
650 | 447 | g_return_if_fail (n_param_values == 2); | ||
651 | 448 | if (G_CCLOSURE_SWAP_DATA (closure)) { | ||
652 | 449 | data1 = closure->data; | ||
653 | 450 | data2 = param_values->data[0].v_pointer; | ||
654 | 451 | } else { | ||
655 | 452 | data1 = param_values->data[0].v_pointer; | ||
656 | 453 | data2 = closure->data; | ||
657 | 454 | } | ||
658 | 455 | callback = (GMarshalFunc_OBJECT__STRING) (marshal_data ? marshal_data : cc->callback); | ||
659 | 456 | v_return = callback (data1, g_value_get_string (param_values + 1), data2); | ||
660 | 457 | g_value_take_object (return_value, v_return); | ||
661 | 458 | } | ||
662 | 459 | |||
663 | 460 | TestScope* test_scope_new (const gchar* dbus_path) | ||
664 | 461 | { | ||
665 | 462 | return (TestScope*) g_object_new (TEST_TYPE_SCOPE, "dbus-path", dbus_path, NULL); | ||
666 | 463 | } | ||
667 | 464 | |||
668 | 465 | void test_scope_set_categories(TestScope* self, UnityCategorySet* categories) | ||
669 | 466 | { | ||
670 | 467 | g_return_if_fail (self != NULL); | ||
671 | 468 | |||
672 | 469 | g_object_ref(categories); | ||
673 | 470 | self->priv->_categories = categories; | ||
674 | 471 | } | ||
675 | 472 | |||
676 | 473 | void test_scope_set_filters(TestScope* self, UnityFilterSet* filters) | ||
677 | 474 | { | ||
678 | 475 | g_return_if_fail (self != NULL); | ||
679 | 476 | |||
680 | 477 | g_object_ref(filters); | ||
681 | 478 | self->priv->_filters = filters; | ||
682 | 479 | } | ||
683 | 480 | |||
684 | 481 | void test_scope_export (TestScope* self, GError** error) | ||
685 | 482 | { | ||
686 | 483 | UnityScopeDBusConnector* connector; | ||
687 | 484 | g_return_if_fail (self != NULL); | ||
688 | 485 | |||
689 | 486 | connector = unity_scope_dbus_connector_new ((UnityAbstractScope*) self); | ||
690 | 487 | _g_object_unref_safe (self->priv->_connector); | ||
691 | 488 | self->priv->_connector = connector; | ||
692 | 489 | unity_scope_dbus_connector_export (connector, error); | ||
693 | 490 | } | ||
694 | 491 | |||
695 | 492 | void test_scope_unexport (TestScope* self) | ||
696 | 493 | { | ||
697 | 494 | g_return_if_fail (self != NULL); | ||
698 | 495 | g_return_if_fail (self->priv->_connector != NULL); | ||
699 | 496 | unity_scope_dbus_connector_unexport (self->priv->_connector); | ||
700 | 497 | } | ||
701 | 498 | \ No newline at end of file | 56 | \ No newline at end of file |
702 | 57 | UnityAbstractScope* test_scope_new (const gchar* dbus_path, | ||
703 | 58 | UnityCategorySet* category_set, | ||
704 | 59 | UnityFilterSet* filter_set, | ||
705 | 60 | UnitySimpleScopeSearchRunFunc search_func, | ||
706 | 61 | gpointer data) | ||
707 | 62 | { | ||
708 | 63 | UnitySimpleScope *scope = unity_simple_scope_new (); | ||
709 | 64 | |||
710 | 65 | unity_simple_scope_set_unique_name (scope, dbus_path); | ||
711 | 66 | unity_simple_scope_set_group_name (scope, TEST_DBUS_NAME); | ||
712 | 67 | unity_simple_scope_set_search_hint (scope, "Search hint"); | ||
713 | 68 | |||
714 | 69 | unity_simple_scope_set_category_set (scope, category_set); | ||
715 | 70 | unity_simple_scope_set_filter_set (scope, filter_set); | ||
716 | 71 | unity_simple_scope_set_schema (scope, test_scope_get_schema ()); | ||
717 | 72 | |||
718 | 73 | unity_simple_scope_set_search_func (scope, search_func, data, NULL); | ||
719 | 74 | unity_simple_scope_set_preview_func (scope, test_scope_preview, NULL, NULL); | ||
720 | 75 | unity_simple_scope_set_activate_func (scope, test_scope_activate, NULL, NULL); | ||
721 | 76 | |||
722 | 77 | return UNITY_ABSTRACT_SCOPE (scope); | ||
723 | 78 | } | ||
724 | 79 | |||
725 | 499 | 80 | ||
726 | === modified file 'tests/test_scope_impl.h' | |||
727 | --- tests/test_scope_impl.h 2013-03-13 10:31:19 +0000 | |||
728 | +++ tests/test_scope_impl.h 2013-07-19 11:30:33 +0000 | |||
729 | @@ -25,42 +25,12 @@ | |||
730 | 25 | 25 | ||
731 | 26 | G_BEGIN_DECLS | 26 | G_BEGIN_DECLS |
732 | 27 | 27 | ||
768 | 28 | #define TEST_TYPE_SCOPE (test_scope_get_type ()) | 28 | UnityAbstractScope* test_scope_new (const gchar* dbus_path, |
769 | 29 | #define TEST_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_SCOPE, TestScope)) | 29 | UnityCategorySet* category_set, |
770 | 30 | #define TEST_IS_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_SCOPE)) | 30 | UnityFilterSet* filter_set, |
771 | 31 | #define TEST_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_SCOPE, TestScopeClass)) | 31 | UnitySimpleScopeSearchRunFunc search_func, |
772 | 32 | #define TEST_IS_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_TYPE_SCOPE)) | 32 | gpointer user_data); |
738 | 33 | #define TEST_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SCOPE, TestScopeClass)) | ||
739 | 34 | |||
740 | 35 | typedef struct _TestScope TestScope; | ||
741 | 36 | typedef struct _TestScopeClass TestScopeClass; | ||
742 | 37 | typedef struct _TestScopePrivate TestScopePrivate; | ||
743 | 38 | |||
744 | 39 | struct _TestScope | ||
745 | 40 | { | ||
746 | 41 | UnityAbstractScope parent_instance; | ||
747 | 42 | |||
748 | 43 | /* instance members */ | ||
749 | 44 | TestScopePrivate * priv; | ||
750 | 45 | }; | ||
751 | 46 | |||
752 | 47 | struct _TestScopeClass | ||
753 | 48 | { | ||
754 | 49 | UnityAbstractScopeClass parent_class; | ||
755 | 50 | |||
756 | 51 | /* class members */ | ||
757 | 52 | }; | ||
758 | 53 | |||
759 | 54 | /* used by TEST_TYPE_SCOPE */ | ||
760 | 55 | GType test_scope_get_type (void); | ||
761 | 56 | |||
762 | 57 | TestScope* test_scope_new (const gchar* dbus_path); | ||
763 | 58 | |||
764 | 59 | void test_scope_set_categories(TestScope* self, UnityCategorySet* categories); | ||
765 | 60 | void test_scope_set_filters(TestScope* self, UnityFilterSet* filters); | ||
766 | 61 | void test_scope_export (TestScope* self, GError** error); | ||
767 | 62 | void test_scope_unexport (TestScope* self); | ||
773 | 63 | 33 | ||
774 | 64 | G_END_DECLS | 34 | G_END_DECLS |
775 | 65 | 35 | ||
776 | 66 | #endif /* _TEST_SCOPE_IMPL_H_ */ | ||
777 | 67 | \ No newline at end of file | 36 | \ No newline at end of file |
778 | 37 | #endif /* _TEST_SCOPE_IMPL_H_ */ | ||
779 | 68 | 38 | ||
780 | === modified file 'tests/test_scope_proxy.cpp' | |||
781 | --- tests/test_scope_proxy.cpp 2013-07-09 18:56:00 +0000 | |||
782 | +++ tests/test_scope_proxy.cpp 2013-07-19 11:30:33 +0000 | |||
783 | @@ -59,7 +59,7 @@ | |||
784 | 59 | 59 | ||
785 | 60 | TEST(TestScopeProxy, ConnectionFail) | 60 | TEST(TestScopeProxy, ConnectionFail) |
786 | 61 | { | 61 | { |
788 | 62 | ScopeProxyInterface::Ptr scope_proxy(new ScopeProxy(ScopeData::Ptr(new MockScopeData("fail", "this.is.a.fail.test", "this/is/a/fail/test")))); | 62 | ScopeProxyInterface::Ptr scope_proxy(new ScopeProxy(ScopeData::Ptr(new MockScopeData("fail", "this.is.a.fail.test", "/this/is/a/fail/test")))); |
789 | 63 | scope_proxy->ConnectProxy(); | 63 | scope_proxy->ConnectProxy(); |
790 | 64 | 64 | ||
791 | 65 | Utils::WaitForTimeoutMSec(1000); | 65 | Utils::WaitForTimeoutMSec(1000); |
792 | @@ -180,7 +180,7 @@ | |||
793 | 180 | 180 | ||
794 | 181 | TEST(TestScopeProxy, SearchFail) | 181 | TEST(TestScopeProxy, SearchFail) |
795 | 182 | { | 182 | { |
797 | 183 | ScopeProxyInterface::Ptr scope_proxy(new ScopeProxy(ScopeData::Ptr(new MockScopeData("fail", "this.is.a.fail.test", "this/is/a/fail/test")))); | 183 | ScopeProxyInterface::Ptr scope_proxy(new ScopeProxy(ScopeData::Ptr(new MockScopeData("fail", "this.is.a.fail.test", "/this/is/a/fail/test")))); |
798 | 184 | // Auto-connect on search | 184 | // Auto-connect on search |
799 | 185 | 185 | ||
800 | 186 | bool search_ok = false; | 186 | bool search_ok = false; |
801 | @@ -262,7 +262,7 @@ | |||
802 | 262 | activate_callback, | 262 | activate_callback, |
803 | 263 | nullptr); | 263 | nullptr); |
804 | 264 | 264 | ||
806 | 265 | Utils::WaitUntilMSec(activated_return, 3, "Failed to activate"); | 265 | Utils::WaitUntil(activated_return, 3, "Failed to activate"); |
807 | 266 | } | 266 | } |
808 | 267 | 267 | ||
809 | 268 | TEST(TestScopeProxy, Preview) | 268 | TEST(TestScopeProxy, Preview) |
810 | 269 | 269 | ||
811 | === modified file 'tests/test_service_main.cpp' | |||
812 | --- tests/test_service_main.cpp 2013-07-17 18:03:19 +0000 | |||
813 | +++ tests/test_service_main.cpp 2013-07-19 11:30:33 +0000 | |||
814 | @@ -1,5 +1,6 @@ | |||
815 | 1 | #include <Nux/Nux.h> | 1 | #include <Nux/Nux.h> |
816 | 2 | #include <NuxCore/Logger.h> | 2 | #include <NuxCore/Logger.h> |
817 | 3 | #include <unity.h> | ||
818 | 3 | 4 | ||
819 | 4 | #include "test_service_scope.h" | 5 | #include "test_service_scope.h" |
820 | 5 | #include "test_service_model.h" | 6 | #include "test_service_model.h" |
821 | @@ -44,8 +45,6 @@ | |||
822 | 44 | return 1; | 45 | return 1; |
823 | 45 | } | 46 | } |
824 | 46 | 47 | ||
825 | 47 | auto loop = g_main_loop_new(NULL, FALSE); | ||
826 | 48 | |||
827 | 49 | nux::NuxInitialize(0); | 48 | nux::NuxInitialize(0); |
828 | 50 | // Slightly higher as we're more likely to test things we know will fail | 49 | // Slightly higher as we're more likely to test things we know will fail |
829 | 51 | nux::logging::configure_logging("<root>=error"); | 50 | nux::logging::configure_logging("<root>=error"); |
830 | @@ -53,24 +52,29 @@ | |||
831 | 53 | // but you can still change it if you're debugging ;) | 52 | // but you can still change it if you're debugging ;) |
832 | 54 | nux::logging::configure_logging(::getenv("UNITY_TEST_LOG_SEVERITY")); | 53 | nux::logging::configure_logging(::getenv("UNITY_TEST_LOG_SEVERITY")); |
833 | 55 | 54 | ||
834 | 55 | service::Hud hud; | ||
835 | 56 | service::GDBus gdbus; | ||
836 | 57 | service::Panel panel; | ||
837 | 58 | service::Model model; | ||
838 | 59 | service::Scope scope(scope_id ? scope_id: "testscope1"); | ||
839 | 60 | |||
840 | 61 | // all the services might have requested dbus names, let's consider | ||
841 | 62 | // the controller name a "primary" name and we'll wait for it before running | ||
842 | 63 | // the actual dbus tests (since the other names were requested before this | ||
843 | 64 | // one they should be acquired before this one) | ||
844 | 56 | glib::DBusServer controller("com.canonical.Unity.Test"); | 65 | glib::DBusServer controller("com.canonical.Unity.Test"); |
845 | 57 | controller.AddObjects(introspection_xml, "/com/canonical/unity/test/controller"); | 66 | controller.AddObjects(introspection_xml, "/com/canonical/unity/test/controller"); |
846 | 58 | auto obj = controller.GetObjects().front(); | 67 | auto obj = controller.GetObjects().front(); |
848 | 59 | obj->SetMethodsCallsHandler([loop] (std::string const& method, GVariant*) { | 68 | obj->SetMethodsCallsHandler([] (std::string const& method, GVariant*) { |
849 | 60 | if (method == "Exit") | 69 | if (method == "Exit") |
851 | 61 | g_main_loop_quit(loop); | 70 | unity_scope_dbus_connector_quit(); |
852 | 62 | 71 | ||
853 | 63 | return static_cast<GVariant*>(nullptr); | 72 | return static_cast<GVariant*>(nullptr); |
854 | 64 | }); | 73 | }); |
855 | 65 | 74 | ||
864 | 66 | service::Hud hud; | 75 | // scope equivalent of running the main loop, needed as this also requests |
865 | 67 | service::GDBus gdbus; | 76 | // a dbus name the scope uses |
866 | 68 | service::Panel panel; | 77 | unity_scope_dbus_connector_run(); |
859 | 69 | service::Model model; | ||
860 | 70 | service::Scope scope(scope_id ? scope_id: "testscope1"); | ||
861 | 71 | |||
862 | 72 | g_main_loop_run(loop); | ||
863 | 73 | g_main_loop_unref(loop); | ||
867 | 74 | 78 | ||
868 | 75 | if (scope_id) g_free(scope_id); | 79 | if (scope_id) g_free(scope_id); |
869 | 76 | 80 | ||
870 | 77 | 81 | ||
871 | === modified file 'tests/test_service_model.cpp' | |||
872 | --- tests/test_service_model.cpp 2013-07-10 18:22:32 +0000 | |||
873 | +++ tests/test_service_model.cpp 2013-07-19 11:30:33 +0000 | |||
874 | @@ -8,12 +8,26 @@ | |||
875 | 8 | namespace service | 8 | namespace service |
876 | 9 | { | 9 | { |
877 | 10 | 10 | ||
878 | 11 | static DeeModel* create_read_only_model(const char* name) | ||
879 | 12 | { | ||
880 | 13 | // A shared model with the LEADER_WRITABLE flag will ignore any change | ||
881 | 14 | // requests from the peers | ||
882 | 15 | glib::Object<DeePeer> peer(dee_peer_new(name)); | ||
883 | 16 | glib::Object<DeeModel> backend(dee_sequence_model_new()); | ||
884 | 17 | auto access_mode = DEE_SHARED_MODEL_ACCESS_MODE_LEADER_WRITABLE; | ||
885 | 18 | return DEE_MODEL (g_object_new (DEE_TYPE_SHARED_MODEL, | ||
886 | 19 | "peer", peer.RawPtr(), | ||
887 | 20 | "back-end", backend.RawPtr(), | ||
888 | 21 | "access-mode", access_mode, | ||
889 | 22 | NULL)); | ||
890 | 23 | } | ||
891 | 24 | |||
892 | 11 | Model::Model() | 25 | Model::Model() |
898 | 12 | : model_(dee_shared_model_new("com.canonical.test.model")) | 26 | : model_(create_read_only_model("com.canonical.test.model")) |
899 | 13 | , results_model_(dee_shared_model_new("com.canonical.test.resultsmodel")) | 27 | , results_model_(create_read_only_model("com.canonical.test.resultsmodel")) |
900 | 14 | , categories_model_(dee_shared_model_new("com.canonical.test.categoriesmodel")) | 28 | , categories_model_(create_read_only_model("com.canonical.test.categoriesmodel")) |
901 | 15 | , categories_changing_model_(dee_shared_model_new("com.canonical.test.categoriesmodel_changing")) | 29 | , categories_changing_model_(create_read_only_model("com.canonical.test.categoriesmodel_changing")) |
902 | 16 | , tracks_model_(dee_shared_model_new("com.canonical.test.tracks")) | 30 | , tracks_model_(create_read_only_model("com.canonical.test.tracks")) |
903 | 17 | { | 31 | { |
904 | 18 | PopulateTestModel(); | 32 | PopulateTestModel(); |
905 | 19 | PopulateResultsModel(); | 33 | PopulateResultsModel(); |
906 | 20 | 34 | ||
907 | === modified file 'tests/test_service_scope.cpp' | |||
908 | --- tests/test_service_scope.cpp 2013-03-13 10:31:19 +0000 | |||
909 | +++ tests/test_service_scope.cpp 2013-07-19 11:30:33 +0000 | |||
910 | @@ -43,21 +43,20 @@ | |||
911 | 43 | "cat1", | 43 | "cat1", |
912 | 44 | "cat2" }; | 44 | "cat2" }; |
913 | 45 | 45 | ||
916 | 46 | static UnityActivationResponse* on_activate_uri(TestScope* scope, const char* uri, Scope* self); | 46 | static void on_scope_search (UnityScopeSearchBase* search_ctx, gpointer user_data); |
915 | 47 | static void on_scope_search (TestScope* scope, UnityScopeSearchBase* search_ctx, Scope* self); | ||
917 | 48 | 47 | ||
918 | 49 | Scope::Scope(std::string const& scope_id) | 48 | Scope::Scope(std::string const& scope_id) |
919 | 50 | : scope_(test_scope_new (("/com/canonical/unity/scope/"+scope_id).c_str())) | ||
920 | 51 | { | 49 | { |
926 | 52 | AddCategories(); | 50 | scope_ = test_scope_new (("/com/canonical/unity/scope/"+scope_id).c_str(), |
927 | 53 | AddFilters(); | 51 | CreateCategories(), |
928 | 54 | 52 | CreateFilters(), | |
929 | 55 | g_signal_connect(scope_, "activate-uri", G_CALLBACK(on_activate_uri), this); | 53 | on_scope_search, |
930 | 56 | g_signal_connect(scope_, "search", G_CALLBACK(on_scope_search), this); | 54 | NULL); |
931 | 57 | 55 | ||
932 | 58 | /* Export */ | 56 | /* Export */ |
933 | 59 | GError* error = NULL; | 57 | GError* error = NULL; |
935 | 60 | test_scope_export(scope_, &error); | 58 | connector_ = unity_scope_dbus_connector_new (scope_); |
936 | 59 | unity_scope_dbus_connector_export (connector_, &error); | ||
937 | 61 | if (error) | 60 | if (error) |
938 | 62 | { | 61 | { |
939 | 63 | g_error ("Unable to export Scope: %s", error->message); | 62 | g_error ("Unable to export Scope: %s", error->message); |
940 | @@ -70,7 +69,7 @@ | |||
941 | 70 | g_signal_handlers_disconnect_by_data(scope_, this); | 69 | g_signal_handlers_disconnect_by_data(scope_, this); |
942 | 71 | } | 70 | } |
943 | 72 | 71 | ||
945 | 73 | void Scope::AddCategories() | 72 | UnityCategorySet* Scope::CreateCategories() |
946 | 74 | { | 73 | { |
947 | 75 | UnityCategorySet* categories; | 74 | UnityCategorySet* categories; |
948 | 76 | GIcon *icon; | 75 | GIcon *icon; |
949 | @@ -96,11 +95,10 @@ | |||
950 | 96 | g_free(title); | 95 | g_free(title); |
951 | 97 | } | 96 | } |
952 | 98 | 97 | ||
955 | 99 | test_scope_set_categories(scope_, categories); | 98 | return categories; |
954 | 100 | g_object_unref (categories); | ||
956 | 101 | } | 99 | } |
957 | 102 | 100 | ||
959 | 103 | void Scope::AddFilters() | 101 | UnityFilterSet* Scope::CreateFilters() |
960 | 104 | { | 102 | { |
961 | 105 | UnityFilterSet *filters = NULL; | 103 | UnityFilterSet *filters = NULL; |
962 | 106 | UnityFilter *filter; | 104 | UnityFilter *filter; |
963 | @@ -159,20 +157,14 @@ | |||
964 | 159 | unity_filter_set_add (filters, filter); | 157 | unity_filter_set_add (filters, filter); |
965 | 160 | g_object_unref(filter); | 158 | g_object_unref(filter); |
966 | 161 | 159 | ||
974 | 162 | test_scope_set_filters(scope_, filters); | 160 | return filters; |
968 | 163 | g_object_unref (filters); | ||
969 | 164 | } | ||
970 | 165 | |||
971 | 166 | static UnityActivationResponse* on_activate_uri(TestScope* scope, const char* uri, Scope* self) | ||
972 | 167 | { | ||
973 | 168 | return unity_activation_response_new(UNITY_HANDLED_TYPE_HIDE_DASH, ""); | ||
975 | 169 | } | 161 | } |
976 | 170 | 162 | ||
977 | 171 | static void _g_variant_unref0_ (gpointer var) { | 163 | static void _g_variant_unref0_ (gpointer var) { |
978 | 172 | if (var) g_variant_unref ((GVariant*)var); | 164 | if (var) g_variant_unref ((GVariant*)var); |
979 | 173 | } | 165 | } |
980 | 174 | 166 | ||
982 | 175 | static void on_scope_search (TestScope* scope, UnityScopeSearchBase* search_base, Scope* self) | 167 | static void on_scope_search (UnityScopeSearchBase* search_base, gpointer self) |
983 | 176 | { | 168 | { |
984 | 177 | UnitySearchContext* search_ctx; | 169 | UnitySearchContext* search_ctx; |
985 | 178 | search_ctx = search_base->search_context; | 170 | search_ctx = search_base->search_context; |
986 | 179 | 171 | ||
987 | === modified file 'tests/test_service_scope.h' | |||
988 | --- tests/test_service_scope.h 2013-03-13 10:31:19 +0000 | |||
989 | +++ tests/test_service_scope.h 2013-07-19 11:30:33 +0000 | |||
990 | @@ -35,11 +35,12 @@ | |||
991 | 35 | ~Scope(); | 35 | ~Scope(); |
992 | 36 | 36 | ||
993 | 37 | private: | 37 | private: |
996 | 38 | void AddCategories(); | 38 | UnityCategorySet* CreateCategories(); |
997 | 39 | void AddFilters(); | 39 | UnityFilterSet* CreateFilters(); |
998 | 40 | 40 | ||
999 | 41 | private: | 41 | private: |
1001 | 42 | glib::Object<TestScope> scope_; | 42 | glib::Object<UnityAbstractScope> scope_; |
1002 | 43 | glib::Object<UnityScopeDBusConnector> connector_; | ||
1003 | 43 | }; | 44 | }; |
1004 | 44 | 45 | ||
1005 | 45 | } | 46 | } |
could you also re-enable te tests from tests/CMake so that the CI will check them as well? :)