Merge lp:~michihenning/unity-scopes-api/fix-acc-errors into lp:unity-scopes-api
- fix-acc-errors
- Merge into trunk
Proposed by
Michi Henning
Status: | Superseded |
---|---|
Proposed branch: | lp:~michihenning/unity-scopes-api/fix-acc-errors |
Merge into: | lp:unity-scopes-api |
Diff against target: |
1075 lines (+596/-25) 29 files modified
CMakeLists.txt (+1/-1) RELEASE_NOTES.md (+7/-3) STRUCTS (+3/-2) debian/changelog (+6/-0) debian/rules (+5/-0) demo/stand-alone/stand-alone-client.cpp (+9/-2) include/unity/scopes/ActivationResponse.h (+19/-0) include/unity/scopes/Result.h (+6/-0) include/unity/scopes/internal/ActivationResponseImpl.h (+4/-0) include/unity/scopes/internal/ResultImpl.h (+2/-0) src/scopes/ActivationResponse.cpp (+10/-0) src/scopes/PreviewWidget.cpp (+47/-0) src/scopes/Result.cpp (+5/-0) src/scopes/internal/ActivationResponseImpl.cpp (+48/-0) src/scopes/internal/RegistryConfig.cpp (+0/-4) src/scopes/internal/ResultImpl.cpp (+20/-0) src/scopes/internal/zmq_middleware/ZmqObject.cpp (+1/-1) test/abi-compliance/abi.xml.in (+27/-1) test/gtest/scopes/ActivationResponse/ActivationResponse_test.cpp (+51/-1) test/gtest/scopes/CMakeLists.txt (+1/-0) test/gtest/scopes/CategorisedResult/CategorisedResult_test.cpp (+32/-0) test/gtest/scopes/StandAloneScope/CMakeLists.txt (+15/-0) test/gtest/scopes/StandAloneScope/Runtime.ini.in (+2/-0) test/gtest/scopes/StandAloneScope/SimpleScope.cpp (+99/-0) test/gtest/scopes/StandAloneScope/SimpleScope.h (+37/-0) test/gtest/scopes/StandAloneScope/SimpleScope.ini.in (+4/-0) test/gtest/scopes/StandAloneScope/StandAloneScope_test.cpp (+132/-0) test/gtest/scopes/StandAloneScope/Zmq.ini.in (+2/-0) test/gtest/scopes/internal/RegistryConfig/RegistryConfig_test.cpp (+1/-10) |
To merge this branch: | bzr merge lp:~michihenning/unity-scopes-api/fix-acc-errors |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2015-08-27.
Commit message
Fixed a bunch of bogus errors from abi-compliance-
Description of the change
Fixed a bunch of bogus errors from abi-compliance-
To post a comment you must log in.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-08-17 14:07:35 +0000 |
3 | +++ CMakeLists.txt 2015-08-27 06:44:23 +0000 |
4 | @@ -218,7 +218,7 @@ |
5 | # API version |
6 | set(UNITY_SCOPES_MAJOR 1) # Major official release number |
7 | set(UNITY_SCOPES_MINOR 0) # Must be changed for ABI incompatible changes |
8 | -set(UNITY_SCOPES_MICRO 0) # For ABI compatible changes |
9 | +set(UNITY_SCOPES_MICRO 1) # For ABI compatible changes |
10 | set(UNITY_SCOPES_SOVERSION ${UNITY_SCOPES_MAJOR}.${UNITY_SCOPES_MINOR}) |
11 | |
12 | # Version for testing, with all symbols visible |
13 | |
14 | === modified file 'RELEASE_NOTES.md' |
15 | --- RELEASE_NOTES.md 2015-07-01 10:59:49 +0000 |
16 | +++ RELEASE_NOTES.md 2015-08-27 06:44:23 +0000 |
17 | @@ -1,6 +1,10 @@ |
18 | Release notes |
19 | ============= |
20 | |
21 | +Changes in version 0.6.20 |
22 | +========================= |
23 | + - Support preview widget updates via ActivationResponse. |
24 | + |
25 | Changes in version 0.6.19 |
26 | ========================= |
27 | - Support UNITY_SCOPES_CONFIG_DIR environment variable. |
28 | @@ -39,7 +43,7 @@ |
29 | swiping to the scope while the device has no network access, or the scope's |
30 | data source is off-line. |
31 | |
32 | - Note: This is change is ABI compatible with gcc and clang despite the addition |
33 | + Note: This is change is ABI compatible with gcc and clang despite the addition |
34 | a new virtual function. |
35 | |
36 | Changes in version 0.6.13 |
37 | @@ -116,7 +120,7 @@ |
38 | - New setting to enable/disable of location data being fed to scopes. |
39 | |
40 | - New DebugMode scope configuration option. |
41 | - |
42 | + |
43 | Changes in version 0.6.1 |
44 | ======================== |
45 | - Clear any signal masks inherited from the parent process when forking. |
46 | @@ -304,7 +308,7 @@ |
47 | |
48 | - Preliminary API for filters has been added via OptionSelectorFilter and |
49 | FilterState classes. This part of the API is not yet supported by Unity shell |
50 | - and should be considered highly experimental. |
51 | + and should be considered highly experimental. |
52 | |
53 | - ScopeBase::create_query() method now takes Query object instance instead of |
54 | just a search query string. Search query string is now encapsulated in the |
55 | |
56 | === modified file 'STRUCTS' |
57 | --- STRUCTS 2015-05-29 10:17:42 +0000 |
58 | +++ STRUCTS 2015-08-27 06:44:23 +0000 |
59 | @@ -88,12 +88,12 @@ |
60 | 'query_string' : string |
61 | 'department_id' : string |
62 | 'filter_state' : dictionary (serialized FilterState) |
63 | - |
64 | + |
65 | Link (returned by serialize()) |
66 | ============================== |
67 | 'label' : string |
68 | 'query' : Query |
69 | - |
70 | + |
71 | Annotation (returned by serialize()) |
72 | ==================================== |
73 | 'type' : string |
74 | @@ -160,6 +160,7 @@ |
75 | 'scope_data' : variant |
76 | 'query' : variant (optional) |
77 | 'updated_result' : variant (optional) |
78 | + 'updated_widgets': variant (optional) |
79 | |
80 | QueryMetadata (returned by serialize()) |
81 | ======================================= |
82 | |
83 | === modified file 'debian/changelog' |
84 | --- debian/changelog 2015-08-21 22:11:51 +0000 |
85 | +++ debian/changelog 2015-08-27 06:44:23 +0000 |
86 | @@ -1,3 +1,9 @@ |
87 | +unity-scopes-api (1.0.1-0ubuntu1) UNRELEASED; urgency=medium |
88 | + |
89 | + * Added support for preview widget updates via ActivationResponse. |
90 | + |
91 | + -- Pawel Stolowski <pawel.stolowski@canonical.com> Tue, 20 Jul 2015 17:15:39 +0200 |
92 | + |
93 | unity-scopes-api (1.0.0+15.10.20150821.3-0ubuntu1) wily; urgency=medium |
94 | |
95 | [ Michi Henning ] |
96 | |
97 | === modified file 'debian/rules' |
98 | --- debian/rules 2015-07-20 11:17:15 +0000 |
99 | +++ debian/rules 2015-08-27 06:44:23 +0000 |
100 | @@ -5,6 +5,9 @@ |
101 | #export DH_VERBOSE=1 |
102 | export DPKG_GENSYMBOLS_CHECK_LEVEL=4 |
103 | |
104 | +# Skip tests on the archs they are known to be flaky with current configuration |
105 | +testskip_architectures := powerpc ppc64el |
106 | + |
107 | %: |
108 | dh $@ --parallel --fail-missing --with click |
109 | |
110 | @@ -13,7 +16,9 @@ |
111 | |
112 | # Tests are not written to be run in parallel. |
113 | override_dh_auto_test: |
114 | +ifeq (,$(filter $(testskip_architectures),$(DEB_HOST_ARCH))) |
115 | dh_auto_test --max-parallel=1 -- ARGS="--verbose" |
116 | +endif |
117 | |
118 | override_dh_click: |
119 | dh_click --name scope |
120 | |
121 | === modified file 'demo/stand-alone/stand-alone-client.cpp' |
122 | --- demo/stand-alone/stand-alone-client.cpp 2014-07-28 08:30:35 +0000 |
123 | +++ demo/stand-alone/stand-alone-client.cpp 2015-08-27 06:44:23 +0000 |
124 | @@ -85,12 +85,19 @@ |
125 | // Syntax: ipc://<endpoint>#<identity>!<timeout>!<category> |
126 | // |
127 | // "ipc://" - prefix for all proxies |
128 | - // "/tmp/scope-A - endpoint at which the scope listens |
129 | + // "/path/scope-A - endpoint at which the scope listens |
130 | // "scope-A - scope ID (must be the same as last component of endpoint path) |
131 | // "t=300" - optional timeout (infinite if not specified) |
132 | // "c=Scope" - type of proxy (must be "c=Scope") |
133 | |
134 | - ObjectProxy p = rt->string_to_proxy("ipc:///tmp/scope-A#scope-A!t=300!c=Scope"); |
135 | + char* xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); |
136 | + if (!xdg_runtime_dir || *xdg_runtime_dir == '\0') |
137 | + { |
138 | + throw ConfigException("No endpoint directories specified, and XDG_RUNTIME_DIR " |
139 | + "environment variable not set"); |
140 | + } |
141 | + string stringified_proxy = string("ipc://") + xdg_runtime_dir + "/zmq/priv/scope-A#scope-A!t=300!c=Scope"; |
142 | + ObjectProxy p = rt->string_to_proxy(stringified_proxy); |
143 | assert(p); |
144 | |
145 | // The returned proxy is of type ObjectProxy and must be down-cast to a scope proxy: |
146 | |
147 | === modified file 'include/unity/scopes/ActivationResponse.h' |
148 | --- include/unity/scopes/ActivationResponse.h 2015-06-02 05:06:25 +0000 |
149 | +++ include/unity/scopes/ActivationResponse.h 2015-08-27 06:44:23 +0000 |
150 | @@ -21,6 +21,7 @@ |
151 | #include <unity/scopes/Variant.h> |
152 | #include <unity/scopes/CannedQuery.h> |
153 | #include <unity/scopes/Result.h> |
154 | +#include <unity/scopes/PreviewWidget.h> |
155 | #include <memory> |
156 | |
157 | namespace unity |
158 | @@ -53,6 +54,7 @@ |
159 | ShowPreview, /**< Preview should be requested for this result */ |
160 | PerformQuery, /**< Perform new search. This state is implied if creating ActivationResponse with CannedQuery object and is invalid otherwise */ |
161 | UpdateResult, /**< Update the result. This state is implied if creating ActivationResponse with Result object and is invalid otherwise */ |
162 | + UpdatePreview /**< Update the preview. This state is implied if creating ActivationResponse with PreviewWidgetList and is invalid otherwise */ |
163 | }; |
164 | |
165 | /** |
166 | @@ -77,6 +79,16 @@ |
167 | */ |
168 | ActivationResponse(Result const& updated_result); |
169 | |
170 | + /** |
171 | + \brief Creates ActivationResponse with status Status::UpdatePreview and an updated list of preview widgets |
172 | + that replace the original widgets in the preview. Widgets not included in this list stay intact and are still |
173 | + displayed in the preview. Responding with this type of ActivationResponse outside of a preview context will not |
174 | + have any effect. |
175 | + \param updated_widgets The updated widgets to replace the original widgets in the preview. |
176 | + \throws unity::InvalidArgumentException if updated_widgets list is empty. |
177 | + */ |
178 | + ActivationResponse(PreviewWidgetList const& updated_widgets); |
179 | + |
180 | /**@name Copy and assignment |
181 | Copy and assignment operators (move and non-move versions) have the usual value semantics. |
182 | */ |
183 | @@ -124,6 +136,13 @@ |
184 | */ |
185 | Result updated_result() const; |
186 | |
187 | + /** |
188 | + \brief The updated widgets if status is Status::UpdatePreview. |
189 | + \throws unity::LogicException if the status of this ActivationResponse is anything other than Status::UpdatePreview. |
190 | + \return The widgets to be displayed instead of the original widgets with same IDs. |
191 | + */ |
192 | + PreviewWidgetList updated_widgets() const; |
193 | + |
194 | /// @cond |
195 | VariantMap serialize() const; |
196 | |
197 | |
198 | === modified file 'include/unity/scopes/Result.h' |
199 | --- include/unity/scopes/Result.h 2015-07-13 08:44:43 +0000 |
200 | +++ include/unity/scopes/Result.h 2015-08-27 06:44:23 +0000 |
201 | @@ -240,6 +240,12 @@ |
202 | */ |
203 | bool is_account_login_result() const; |
204 | |
205 | + /** |
206 | + \brief Compare result. |
207 | + \return True if results have all attributes equal. |
208 | + */ |
209 | + bool operator==(Result const& other) const; |
210 | + |
211 | /// @cond |
212 | protected: |
213 | explicit Result(const VariantMap &variant_map); |
214 | |
215 | === modified file 'include/unity/scopes/internal/ActivationResponseImpl.h' |
216 | --- include/unity/scopes/internal/ActivationResponseImpl.h 2015-06-08 14:05:12 +0000 |
217 | +++ include/unity/scopes/internal/ActivationResponseImpl.h 2015-08-27 06:44:23 +0000 |
218 | @@ -21,6 +21,7 @@ |
219 | #include <unity/scopes/ActivationResponse.h> |
220 | #include <unity/scopes/CannedQuery.h> |
221 | #include <unity/scopes/Result.h> |
222 | +#include <unity/scopes/PreviewWidget.h> |
223 | |
224 | namespace unity |
225 | { |
226 | @@ -39,6 +40,7 @@ |
227 | ActivationResponseImpl(ActivationResponse::Status status); |
228 | ActivationResponseImpl(CannedQuery const& query); |
229 | ActivationResponseImpl(Result const& result); |
230 | + ActivationResponseImpl(PreviewWidgetList const& updated_widgets); |
231 | ActivationResponseImpl(VariantMap const& var, RuntimeImpl const* runtime); |
232 | ~ActivationResponseImpl() = default; |
233 | |
234 | @@ -52,6 +54,7 @@ |
235 | Variant scope_data() const; |
236 | CannedQuery query() const; |
237 | Result updated_result() const; |
238 | + PreviewWidgetList updated_widgets() const; |
239 | |
240 | VariantMap serialize() const; |
241 | |
242 | @@ -62,6 +65,7 @@ |
243 | CannedQuery::SPtr query_; |
244 | Variant scope_data_; |
245 | Result::SPtr updated_result_; |
246 | + std::shared_ptr<PreviewWidgetList> updated_widgets_; |
247 | }; |
248 | |
249 | } // namespace internal |
250 | |
251 | === modified file 'include/unity/scopes/internal/ResultImpl.h' |
252 | --- include/unity/scopes/internal/ResultImpl.h 2015-06-08 14:05:12 +0000 |
253 | +++ include/unity/scopes/internal/ResultImpl.h 2015-08-27 06:44:23 +0000 |
254 | @@ -81,6 +81,8 @@ |
255 | |
256 | VariantMap serialize() const; |
257 | |
258 | + bool compare(ResultImpl *other) const; |
259 | + |
260 | // a public static method, so there's access to the private constructor |
261 | // without the need to define too many classes as friends |
262 | static Result create_result(VariantMap const&); |
263 | |
264 | === modified file 'src/scopes/ActivationResponse.cpp' |
265 | --- src/scopes/ActivationResponse.cpp 2015-05-29 10:17:42 +0000 |
266 | +++ src/scopes/ActivationResponse.cpp 2015-08-27 06:44:23 +0000 |
267 | @@ -41,6 +41,11 @@ |
268 | { |
269 | } |
270 | |
271 | +ActivationResponse::ActivationResponse(PreviewWidgetList const& updated_widgets) |
272 | + :p(new internal::ActivationResponseImpl(updated_widgets)) |
273 | +{ |
274 | +} |
275 | + |
276 | /// @cond |
277 | ActivationResponse::ActivationResponse(internal::ActivationResponseImpl* pimpl) |
278 | : p(pimpl) |
279 | @@ -98,6 +103,11 @@ |
280 | return p->updated_result(); |
281 | } |
282 | |
283 | +PreviewWidgetList ActivationResponse::updated_widgets() const |
284 | +{ |
285 | + return p->updated_widgets(); |
286 | +} |
287 | + |
288 | } // namespace scopes |
289 | |
290 | } // namespace unity |
291 | |
292 | === modified file 'src/scopes/PreviewWidget.cpp' |
293 | --- src/scopes/PreviewWidget.cpp 2015-05-19 09:19:13 +0000 |
294 | +++ src/scopes/PreviewWidget.cpp 2015-08-27 06:44:23 +0000 |
295 | @@ -87,11 +87,14 @@ |
296 | \arg \c gallery |
297 | \arg \c header |
298 | \arg \c actions |
299 | +\arg \c icon-actions |
300 | \arg \c progress |
301 | \arg \c text |
302 | \arg \c rating-input |
303 | \arg \c rating-edit |
304 | \arg \c reviews |
305 | +\arg \c comment-input |
306 | +\arg \c comment |
307 | \arg \c expandable |
308 | |
309 | \subsection audio audio widget |
310 | @@ -242,6 +245,17 @@ |
311 | } |
312 | \endcode |
313 | |
314 | +\subsection icon-actions icon-actions widget |
315 | + |
316 | +The icon-actions widget displays one or more buttons represented by icons and/or labels. It's similar to actions widget, but uses different layout. |
317 | +Every button can provide an optional temporary icon to be displayed immediately after user taps it. |
318 | + |
319 | +List of attributes: |
320 | + |
321 | +\arg \c actions A composite attribute containing an array of tuples, where each tuple has at least |
322 | +these fields: \c id (a mandatory string that is passed to unity::scopes::ScopeBase::activate_preview_action()), |
323 | +\c label (optional string), \c icon (optional URI, required if label is missing), \c temporaryIcon (optional URI). |
324 | + |
325 | \subsection progress progress widget |
326 | |
327 | The progress widget displays the progress of an action, such as download progress. |
328 | @@ -378,6 +392,39 @@ |
329 | } |
330 | \endcode |
331 | |
332 | +\subsection comment-input comment-input widget |
333 | + |
334 | +The comment-input widget allows users to add comments. It displays an input box along with "Send" button. |
335 | + |
336 | +When a user presses the "Send" button, the scope receives a preview |
337 | +action activation with the id \c "commented". The actual comment |
338 | +can be accessed via unity::scopes::ActionMetadata::scope_data. |
339 | +The scope data will be a VariantMap with the \c "comment" field holding |
340 | +the text entered by the user. |
341 | + |
342 | +List of attributes: |
343 | + |
344 | +\arg \c submit-label String for the label of the submit button (optional, uses "Submit" by default). |
345 | + |
346 | +\code{.cpp} |
347 | +{ |
348 | + PreviewWidget w1("cmt", "comment-input"); |
349 | + |
350 | + w1.add_attribute_value("submit-label", Variant("Comment it!")); |
351 | + ... |
352 | +} |
353 | +\endcode |
354 | + |
355 | +\subsection comment comment widget |
356 | + |
357 | +The comment widget shows an avatar, author name, subtitle and a comment text. |
358 | + |
359 | +List of attributes: |
360 | +\arg \c source URI for an avatar icon (optional) |
361 | +\arg \c author A string specifying the author of the comment (mandatory) |
362 | +\arg \c subtitle A string for the subtitle (optional) |
363 | +\arg \c comment A string for the comment text (mandatory) |
364 | + |
365 | \subsection expandable expandable widget |
366 | |
367 | The expandable widget is used to group several widgets into an expandable pane. |
368 | |
369 | === modified file 'src/scopes/Result.cpp' |
370 | --- src/scopes/Result.cpp 2015-04-15 10:05:42 +0000 |
371 | +++ src/scopes/Result.cpp 2015-08-27 06:44:23 +0000 |
372 | @@ -119,6 +119,11 @@ |
373 | return p->value(key); |
374 | } |
375 | |
376 | +bool Result::operator==(Result const& other) const |
377 | +{ |
378 | + return p->compare(other.p.get()); |
379 | +} |
380 | + |
381 | std::string Result::uri() const noexcept |
382 | { |
383 | return p->uri(); |
384 | |
385 | === modified file 'src/scopes/internal/ActivationResponseImpl.cpp' |
386 | --- src/scopes/internal/ActivationResponseImpl.cpp 2015-06-08 14:05:12 +0000 |
387 | +++ src/scopes/internal/ActivationResponseImpl.cpp 2015-08-27 06:44:23 +0000 |
388 | @@ -17,6 +17,7 @@ |
389 | */ |
390 | |
391 | #include <unity/scopes/internal/ActivationResponseImpl.h> |
392 | +#include <unity/scopes/internal/PreviewWidgetImpl.h> |
393 | #include <unity/UnityExceptions.h> |
394 | #include <unity/scopes/internal/CannedQueryImpl.h> |
395 | #include <unity/scopes/internal/ResultImpl.h> |
396 | @@ -42,6 +43,10 @@ |
397 | { |
398 | throw unity::InvalidArgumentException("ActivationResponse(): Status::UpdateResult allowed only with Result object"); |
399 | } |
400 | + if (status == ActivationResponse::Status::UpdatePreview) |
401 | + { |
402 | + throw unity::InvalidArgumentException("ActivationResponse(): Status::UpdatePreview allowed only with PreviewWidgetList object"); |
403 | + } |
404 | } |
405 | |
406 | ActivationResponseImpl::ActivationResponseImpl(CannedQuery const& query) |
407 | @@ -56,6 +61,16 @@ |
408 | { |
409 | } |
410 | |
411 | +ActivationResponseImpl::ActivationResponseImpl(PreviewWidgetList const& updated_widgets) |
412 | + : status_(ActivationResponse::Status::UpdatePreview), |
413 | + updated_widgets_(std::make_shared<PreviewWidgetList>(updated_widgets)) |
414 | +{ |
415 | + if (updated_widgets.size() == 0) |
416 | + { |
417 | + throw InvalidArgumentException("ActivationResponse(): the list of widgets to update cannot be empty"); |
418 | + } |
419 | +} |
420 | + |
421 | ActivationResponseImpl::ActivationResponseImpl(VariantMap const& var, RuntimeImpl const* runtime) |
422 | { |
423 | auto it = var.find("scope_data"); |
424 | @@ -92,6 +107,20 @@ |
425 | impl->set_runtime(runtime); |
426 | updated_result_ = std::make_shared<Result>(ResultImpl::create_result(impl)); |
427 | } |
428 | + else if (status_ == ActivationResponse::Status::UpdatePreview) |
429 | + { |
430 | + it = var.find("updated_widgets"); |
431 | + if (it == var.end()) |
432 | + { |
433 | + throw LogicException("ActivationResponseImpl(): Invalid data, missing 'updated_widgets'"); |
434 | + } |
435 | + updated_widgets_.reset(new PreviewWidgetList()); |
436 | + VariantArray arr = it->second.get_array(); |
437 | + for (unsigned i = 0; i < arr.size(); i++) |
438 | + { |
439 | + updated_widgets_->emplace_back(PreviewWidgetImpl::create(arr[i].get_dict())); |
440 | + } |
441 | + } |
442 | } |
443 | |
444 | ActivationResponse::Status ActivationResponseImpl::status() const |
445 | @@ -129,6 +158,16 @@ |
446 | throw LogicException("ActivationResponse::updated_result(): updated result is only available for status of Status::UpdateResult"); |
447 | } |
448 | |
449 | +PreviewWidgetList ActivationResponseImpl::updated_widgets() const |
450 | +{ |
451 | + if (updated_widgets_) |
452 | + { |
453 | + assert(status_ == ActivationResponse::Status::UpdatePreview); |
454 | + return *updated_widgets_; |
455 | + } |
456 | + throw LogicException("ActivationResponse::updated_widgets(): updated widgets are only available for status of Status::UpdatePreview"); |
457 | +} |
458 | + |
459 | VariantMap ActivationResponseImpl::serialize() const |
460 | { |
461 | VariantMap vm; |
462 | @@ -142,6 +181,15 @@ |
463 | { |
464 | vm["updated_result"] = updated_result_->serialize(); |
465 | } |
466 | + else if (updated_widgets_) |
467 | + { |
468 | + VariantArray arr; |
469 | + for (auto const& widget : *updated_widgets_) |
470 | + { |
471 | + arr.push_back(Variant(widget.serialize())); |
472 | + } |
473 | + vm["updated_widgets"] = arr; |
474 | + } |
475 | return vm; |
476 | } |
477 | |
478 | |
479 | === modified file 'src/scopes/internal/RegistryConfig.cpp' |
480 | --- src/scopes/internal/RegistryConfig.cpp 2015-07-01 10:59:49 +0000 |
481 | +++ src/scopes/internal/RegistryConfig.cpp 2015-08-27 06:44:23 +0000 |
482 | @@ -51,10 +51,6 @@ |
483 | ConfigBase(configfile, DFLT_REGISTRY_INI) |
484 | { |
485 | identity_ = identity; |
486 | - if (identity.empty()) |
487 | - { |
488 | - throw InvalidArgumentException("Registry identity cannot be an empty string"); |
489 | - } |
490 | mw_kind_ = get_middleware(registry_config_group, mw_kind_key); |
491 | mw_configfile_ = get_optional_string(registry_config_group, mw_kind_ + configfile_key); |
492 | scope_installdir_ = get_optional_string(registry_config_group, scope_installdir_key, DFLT_SCOPE_INSTALL_DIR); |
493 | |
494 | === modified file 'src/scopes/internal/ResultImpl.cpp' |
495 | --- src/scopes/internal/ResultImpl.cpp 2015-06-08 14:05:12 +0000 |
496 | +++ src/scopes/internal/ResultImpl.cpp 2015-08-27 06:44:23 +0000 |
497 | @@ -474,6 +474,26 @@ |
498 | } |
499 | } |
500 | |
501 | +bool ResultImpl::compare(ResultImpl *other) const |
502 | +{ |
503 | + // Compare all attributes and stored result (if set). |
504 | + // Ignore origin, runtime and flags. |
505 | + if (this == other) |
506 | + { |
507 | + return true; |
508 | + } |
509 | + |
510 | + if ((stored_result_ == nullptr) != (other->stored_result_ == nullptr)) |
511 | + { |
512 | + return false; |
513 | + } |
514 | + if (stored_result_ != nullptr && *stored_result_ != *(other->stored_result_)) |
515 | + { |
516 | + return false; |
517 | + } |
518 | + return attrs_ == other->attrs_; |
519 | +} |
520 | + |
521 | Result ResultImpl::create_result(VariantMap const& variant_map) |
522 | { |
523 | return Result(variant_map); |
524 | |
525 | === modified file 'src/scopes/internal/zmq_middleware/ZmqObject.cpp' |
526 | --- src/scopes/internal/zmq_middleware/ZmqObject.cpp 2015-07-01 11:02:46 +0000 |
527 | +++ src/scopes/internal/zmq_middleware/ZmqObject.cpp 2015-08-27 06:44:23 +0000 |
528 | @@ -212,7 +212,7 @@ |
529 | |
530 | // If a registry is configured and this object is not a registry itself, |
531 | // attempt to locate the scope before invoking it. |
532 | - if (!this_is_registry && !this_is_ss_registry) |
533 | + if (registry_proxy && !this_is_registry && !this_is_ss_registry) |
534 | { |
535 | try |
536 | { |
537 | |
538 | === modified file 'test/abi-compliance/abi.xml.in' |
539 | --- test/abi-compliance/abi.xml.in 2014-08-28 02:36:35 +0000 |
540 | +++ test/abi-compliance/abi.xml.in 2015-08-27 06:44:23 +0000 |
541 | @@ -8,16 +8,36 @@ |
542 | @CMAKE_BINARY_DIR@/include/unity |
543 | </headers> |
544 | |
545 | +<!-- |
546 | +We skip the internal include directories because we have separate tests |
547 | +that already ensure that no public header includes an internal one. |
548 | +--> |
549 | +<skip_include_paths> |
550 | +@CMAKE_BINARY_DIR@/include/unity/scopes/internal |
551 | +@CMAKE_BINARY_DIR@/include/unity/scopes/internal/lttng |
552 | +@CMAKE_BINARY_DIR@/include/unity/scopes/internal/smartscopes |
553 | +@CMAKE_BINARY_DIR@/include/unity/scopes/internal/zmq_middleware |
554 | +@CMAKE_BINARY_DIR@/include/unity/scopes/qt/internal |
555 | +@CMAKE_BINARY_DIR@/include/unity/scopes/utility/internal |
556 | +@CMAKE_SOURCE_DIR@/src/scopes/internal |
557 | +@CMAKE_SOURCE_DIR@/src/scopes/internal/lttng |
558 | +@CMAKE_SOURCE_DIR@/src/scopes/internal/smartscopes |
559 | +@CMAKE_SOURCE_DIR@/src/scopes/qt/internal |
560 | +@CMAKE_SOURCE_DIR@/src/scopes/utility/internal |
561 | +</skip_include_paths> |
562 | + |
563 | <libs> |
564 | @CMAKE_BINARY_DIR@/libunity-scopes.so |
565 | </libs> |
566 | |
567 | <gcc_options> |
568 | --std=c++11 |
569 | +-std=c++11 -fPIC -D_ENABLE_QT_EXPERIMENTAL_ -DQT_NO_KEYWORDS |
570 | </gcc_options> |
571 | |
572 | <skip_namespaces> |
573 | unity::scopes::internal |
574 | +unity::scopes::qt::internal |
575 | +unity::scopes::utility::internal |
576 | </skip_namespaces> |
577 | |
578 | <skip_headers> |
579 | @@ -27,5 +47,11 @@ |
580 | @CMAKE_BINARY_DIR@/include/unity/scopes/internal/smartscopes/Makefile |
581 | @CMAKE_BINARY_DIR@/include/unity/scopes/internal/zmq_middleware/Makefile |
582 | @CMAKE_BINARY_DIR@/include/unity/scopes/Makefile |
583 | +@CMAKE_BINARY_DIR@/include/unity/scopes/qt/internal/Makefile |
584 | +@CMAKE_BINARY_DIR@/include/unity/scopes/qt/Makefile |
585 | @CMAKE_BINARY_DIR@/include/unity/scopes/testing/Makefile |
586 | +@CMAKE_BINARY_DIR@/include/unity/scopes/utility/internal/Makefile |
587 | +@CMAKE_BINARY_DIR@/include/unity/scopes/utility/Makefile |
588 | +@CMAKE_SOURCE_DIR@/include/unity/scopes/internal/lttng/SimpleTracepoint.h |
589 | +@CMAKE_SOURCE_DIR@/include/unity/scopes/internal/lttng/UnityScopes_tp.h |
590 | </skip_headers> |
591 | |
592 | === modified file 'test/gtest/scopes/ActivationResponse/ActivationResponse_test.cpp' |
593 | --- test/gtest/scopes/ActivationResponse/ActivationResponse_test.cpp 2015-06-08 14:20:04 +0000 |
594 | +++ test/gtest/scopes/ActivationResponse/ActivationResponse_test.cpp 2015-08-27 06:44:23 +0000 |
595 | @@ -68,7 +68,6 @@ |
596 | EXPECT_EQ(res.uri(), resp.updated_result().uri()); |
597 | } |
598 | |
599 | - |
600 | // Search only allowed with CannedQuery |
601 | { |
602 | try |
603 | @@ -88,10 +87,49 @@ |
604 | } |
605 | catch (unity::InvalidArgumentException const&) {} |
606 | } |
607 | + |
608 | + // UpdatePreview only allowed with PreviewWidgetList |
609 | + { |
610 | + try |
611 | + { |
612 | + ActivationResponse resp(ActivationResponse::Status::UpdatePreview); |
613 | + FAIL(); |
614 | + } |
615 | + catch (unity::InvalidArgumentException const&) {} |
616 | + } |
617 | +} |
618 | + |
619 | +TEST(ActivationResponse, with_updated_widgets) |
620 | +{ |
621 | + { |
622 | + PreviewWidget w("w1", "foo"); |
623 | + PreviewWidgetList const widgets {w}; |
624 | + |
625 | + ActivationResponse resp(widgets); |
626 | + EXPECT_EQ(ActivationResponse::Status::UpdatePreview, resp.status()); |
627 | + EXPECT_EQ(1, resp.updated_widgets().size()); |
628 | + EXPECT_EQ("w1", resp.updated_widgets().begin()->id()); |
629 | + } |
630 | + |
631 | + { |
632 | + PreviewWidgetList const widgets; |
633 | + |
634 | + try |
635 | + { |
636 | + ActivationResponse resp(widgets); |
637 | + FAIL(); |
638 | + } |
639 | + catch (unity::InvalidArgumentException const&) |
640 | + { |
641 | + } |
642 | + } |
643 | } |
644 | |
645 | TEST(ActivationResponse, serialize) |
646 | { |
647 | + // just to make ResultImpl::set_runtime() happy, runtime must not be null. |
648 | + auto runtime = internal::RuntimeImpl::create("fooscope", TEST_DIR "/Runtime.ini"); |
649 | + |
650 | { |
651 | ActivationResponse resp(ActivationResponse::Status::HideDash); |
652 | { |
653 | @@ -123,6 +161,18 @@ |
654 | EXPECT_EQ(ActivationResponse::Status::UpdateResult, static_cast<ActivationResponse::Status>(var["status"].get_int())); |
655 | EXPECT_EQ("foo", var["updated_result"].get_dict()["attrs"].get_dict()["uri"].get_string()); |
656 | } |
657 | + { |
658 | + PreviewWidget const w("w1", "foo"); |
659 | + PreviewWidgetList const widgets {w}; |
660 | + |
661 | + ActivationResponse resp(widgets); |
662 | + auto var = resp.serialize(); |
663 | + |
664 | + ActivationResponse resp2 = internal::ActivationResponseImpl::create(var, runtime.get()); |
665 | + EXPECT_EQ(ActivationResponse::Status::UpdatePreview, resp2.status()); |
666 | + EXPECT_EQ(1, resp2.updated_widgets().size()); |
667 | + EXPECT_EQ("w1", resp2.updated_widgets().begin()->id()); |
668 | + } |
669 | } |
670 | |
671 | TEST(ActivationResponse, deserialize) |
672 | |
673 | === modified file 'test/gtest/scopes/CMakeLists.txt' |
674 | --- test/gtest/scopes/CMakeLists.txt 2015-04-09 15:59:17 +0000 |
675 | +++ test/gtest/scopes/CMakeLists.txt 2015-08-27 06:44:23 +0000 |
676 | @@ -34,6 +34,7 @@ |
677 | add_subdirectory(Runtime) |
678 | add_subdirectory(ScopeBase) |
679 | add_subdirectory(ScopeExceptions) |
680 | +add_subdirectory(StandAloneScope) |
681 | add_subdirectory(StripLocation) |
682 | add_subdirectory(SwitchFilter) |
683 | add_subdirectory(ThrowingClient) |
684 | |
685 | === modified file 'test/gtest/scopes/CategorisedResult/CategorisedResult_test.cpp' |
686 | --- test/gtest/scopes/CategorisedResult/CategorisedResult_test.cpp 2015-02-25 03:38:29 +0000 |
687 | +++ test/gtest/scopes/CategorisedResult/CategorisedResult_test.cpp 2015-08-27 06:44:23 +0000 |
688 | @@ -105,6 +105,38 @@ |
689 | } |
690 | } |
691 | |
692 | +TEST(CategorisedResult, compare) |
693 | +{ |
694 | + CategoryRegistry reg; |
695 | + CategoryRenderer rdr; |
696 | + auto cat = reg.register_category("1", "title", "icon", nullptr, rdr); |
697 | + |
698 | + { |
699 | + CategorisedResult result1(cat); |
700 | + result1.set_uri("uri a"); |
701 | + result1.set_title("title a"); |
702 | + result1.set_art("icon a"); |
703 | + result1["common"] = "o"; |
704 | + |
705 | + CategorisedResult result2(cat); |
706 | + result2.set_uri("uri a"); |
707 | + result2.set_title("title a"); |
708 | + result2.set_art("icon a"); |
709 | + result2["common"] = "o"; |
710 | + |
711 | + EXPECT_TRUE(result1 == result2); |
712 | + |
713 | + CategorisedResult result3(cat); |
714 | + result3.set_uri("uri b"); |
715 | + result3.set_title("title a"); |
716 | + result3.set_art("icon a"); |
717 | + result3["common"] = "o"; |
718 | + |
719 | + EXPECT_FALSE(result1 == result3); |
720 | + EXPECT_FALSE(result2 == result3); |
721 | + } |
722 | +} |
723 | + |
724 | TEST(CategorisedResult, copy) |
725 | { |
726 | CategoryRegistry reg; |
727 | |
728 | === added directory 'test/gtest/scopes/StandAloneScope' |
729 | === added file 'test/gtest/scopes/StandAloneScope/CMakeLists.txt' |
730 | --- test/gtest/scopes/StandAloneScope/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
731 | +++ test/gtest/scopes/StandAloneScope/CMakeLists.txt 2015-08-27 06:44:23 +0000 |
732 | @@ -0,0 +1,15 @@ |
733 | +configure_file(Runtime.ini.in ${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini) |
734 | +configure_file(Zmq.ini.in ${CMAKE_CURRENT_BINARY_DIR}/Zmq.ini) |
735 | + |
736 | +add_definitions(-DTEST_RUNTIME_PATH="${CMAKE_CURRENT_BINARY_DIR}") |
737 | +add_definitions(-DTEST_RUNTIME_FILE="${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini") |
738 | +add_definitions(-DTEST_SCOPERUNNER_PATH="${PROJECT_BINARY_DIR}/scoperunner") |
739 | + |
740 | +add_executable(StandAloneScope_test StandAloneScope_test.cpp) |
741 | +target_link_libraries(StandAloneScope_test ${TESTLIBS}) |
742 | +add_dependencies(StandAloneScope_test scoperunner) |
743 | + |
744 | +add_test(StandAloneScope StandAloneScope_test) |
745 | + |
746 | +configure_file(SimpleScope.ini.in ${CMAKE_CURRENT_BINARY_DIR}/SimpleScope.ini) |
747 | +add_library(SimpleScope MODULE SimpleScope.cpp) |
748 | |
749 | === added file 'test/gtest/scopes/StandAloneScope/Runtime.ini.in' |
750 | --- test/gtest/scopes/StandAloneScope/Runtime.ini.in 1970-01-01 00:00:00 +0000 |
751 | +++ test/gtest/scopes/StandAloneScope/Runtime.ini.in 2015-08-27 06:44:23 +0000 |
752 | @@ -0,0 +1,2 @@ |
753 | +[Runtime] |
754 | +Zmq.ConfigFile=@CMAKE_CURRENT_BINARY_DIR@/Zmq.ini |
755 | |
756 | === added file 'test/gtest/scopes/StandAloneScope/SimpleScope.cpp' |
757 | --- test/gtest/scopes/StandAloneScope/SimpleScope.cpp 1970-01-01 00:00:00 +0000 |
758 | +++ test/gtest/scopes/StandAloneScope/SimpleScope.cpp 2015-08-27 06:44:23 +0000 |
759 | @@ -0,0 +1,99 @@ |
760 | +/* |
761 | + * Copyright (C) 2015 Canonical Ltd |
762 | + * |
763 | + * This program is free software: you can redistribute it and/or modify |
764 | + * it under the terms of the GNU Lesser General Public License version 3 as |
765 | + * published by the Free Software Foundation. |
766 | + * |
767 | + * This program is distributed in the hope that it will be useful, |
768 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
769 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
770 | + * GNU Lesser General Public License for more details. |
771 | + * |
772 | + * You should have received a copy of the GNU Lesser General Public License |
773 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
774 | + * |
775 | + * Authored by: Michi Henning <michi.henning@canonical.com> |
776 | + */ |
777 | + |
778 | +#include "SimpleScope.h" |
779 | + |
780 | +#include <unity/scopes/CategorisedResult.h> |
781 | +#include <unity/scopes/ScopeBase.h> |
782 | +#include <unity/scopes/SearchReply.h> |
783 | + |
784 | +using namespace std; |
785 | +using namespace unity; |
786 | +using namespace unity::scopes; |
787 | + |
788 | +namespace |
789 | +{ |
790 | + |
791 | +class TestQuery : public SearchQueryBase |
792 | +{ |
793 | +public: |
794 | + TestQuery(CannedQuery const& query, |
795 | + SearchMetadata const& metadata) |
796 | + : SearchQueryBase(query, metadata) |
797 | + { |
798 | + } |
799 | + |
800 | + virtual void cancelled() override |
801 | + { |
802 | + } |
803 | + |
804 | + virtual void run(SearchReplyProxy const& reply) override |
805 | + { |
806 | + auto cat = reply->register_category("cat", "", ""); |
807 | + CategorisedResult res(cat); |
808 | + res.set_uri("uri"); |
809 | + res.set_title(query().query_string()); |
810 | + if (valid()) |
811 | + { |
812 | + reply->push(res); |
813 | + } |
814 | + } |
815 | +}; |
816 | + |
817 | +} // namespace |
818 | + |
819 | +void EchoScope::start(string const& /* scope_id */) |
820 | +{ |
821 | +} |
822 | + |
823 | +void EchoScope::stop() |
824 | +{ |
825 | +} |
826 | + |
827 | +void EchoScope::run() |
828 | +{ |
829 | +} |
830 | + |
831 | +SearchQueryBase::UPtr EchoScope::search(CannedQuery const& query, SearchMetadata const& metadata) |
832 | +{ |
833 | + return SearchQueryBase::UPtr(new TestQuery(query, metadata)); |
834 | +} |
835 | + |
836 | +PreviewQueryBase::UPtr EchoScope::preview(Result const& /* result */, ActionMetadata const& /* metadata */) |
837 | +{ |
838 | + abort(); |
839 | + return nullptr; |
840 | +} |
841 | + |
842 | +extern "C" |
843 | +{ |
844 | + |
845 | + unity::scopes::ScopeBase* |
846 | + // cppcheck-suppress unusedFunction |
847 | + UNITY_SCOPE_CREATE_FUNCTION() |
848 | + { |
849 | + return new EchoScope; |
850 | + } |
851 | + |
852 | + void |
853 | + // cppcheck-suppress unusedFunction |
854 | + UNITY_SCOPE_DESTROY_FUNCTION(unity::scopes::ScopeBase* scope_base) |
855 | + { |
856 | + delete scope_base; |
857 | + } |
858 | +} |
859 | |
860 | === added file 'test/gtest/scopes/StandAloneScope/SimpleScope.h' |
861 | --- test/gtest/scopes/StandAloneScope/SimpleScope.h 1970-01-01 00:00:00 +0000 |
862 | +++ test/gtest/scopes/StandAloneScope/SimpleScope.h 2015-08-27 06:44:23 +0000 |
863 | @@ -0,0 +1,37 @@ |
864 | +/* |
865 | + * Copyright (C) 2015 Canonical Ltd |
866 | + * |
867 | + * This program is free software: you can redistribute it and/or modify |
868 | + * it under the terms of the GNU Lesser General Public License version 3 as |
869 | + * published by the Free Software Foundation. |
870 | + * |
871 | + * This program is distributed in the hope that it will be useful, |
872 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
873 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
874 | + * GNU Lesser General Public License for more details. |
875 | + * |
876 | + * You should have received a copy of the GNU Lesser General Public License |
877 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
878 | + * |
879 | + * Authored by: Michi Henning <michi.henning@canonical.com> |
880 | + */ |
881 | + |
882 | +#pragma once |
883 | + |
884 | +#include <unity/scopes/ScopeBase.h> |
885 | + |
886 | +class EchoScope : public unity::scopes::ScopeBase |
887 | +{ |
888 | +public: |
889 | + virtual void start(std::string const&) override; |
890 | + |
891 | + virtual void stop() override; |
892 | + |
893 | + virtual void run() override; |
894 | + |
895 | + virtual unity::scopes::SearchQueryBase::UPtr search(unity::scopes::CannedQuery const &, |
896 | + unity::scopes::SearchMetadata const &) override; |
897 | + |
898 | + virtual unity::scopes::PreviewQueryBase::UPtr preview(unity::scopes::Result const&, |
899 | + unity::scopes::ActionMetadata const &) override; |
900 | +}; |
901 | |
902 | === added file 'test/gtest/scopes/StandAloneScope/SimpleScope.ini.in' |
903 | --- test/gtest/scopes/StandAloneScope/SimpleScope.ini.in 1970-01-01 00:00:00 +0000 |
904 | +++ test/gtest/scopes/StandAloneScope/SimpleScope.ini.in 2015-08-27 06:44:23 +0000 |
905 | @@ -0,0 +1,4 @@ |
906 | +[ScopeConfig] |
907 | +DisplayName = SimpleScope |
908 | +Description = Simple scope. Returns a single result containing the query string. |
909 | +Author = Michi |
910 | |
911 | === added file 'test/gtest/scopes/StandAloneScope/StandAloneScope_test.cpp' |
912 | --- test/gtest/scopes/StandAloneScope/StandAloneScope_test.cpp 1970-01-01 00:00:00 +0000 |
913 | +++ test/gtest/scopes/StandAloneScope/StandAloneScope_test.cpp 2015-08-27 06:44:23 +0000 |
914 | @@ -0,0 +1,132 @@ |
915 | +/* |
916 | + * Copyright (C) 2015 Canonical Ltd |
917 | + * |
918 | + * This program is free software: you can redistribute it and/or modify |
919 | + * it under the terms of the GNU Lesser General Public License version 3 as |
920 | + * published by the Free Software Foundation. |
921 | + * |
922 | + * This program is distributed in the hope that it will be useful, |
923 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
924 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
925 | + * GNU Lesser General Public License for more details. |
926 | + * |
927 | + * You should have received a copy of the GNU Lesser General Public License |
928 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
929 | + * |
930 | + * Authored by: Michi Henning <michi.henning@canonical.com> |
931 | + */ |
932 | + |
933 | +#include <unity/scopes/Runtime.h> |
934 | +#include <unity/scopes/Scope.h> |
935 | +#include <unity/scopes/ScopeExceptions.h> |
936 | +#include <unity/scopes/SearchListenerBase.h> |
937 | +#include <unity/scopes/SearchMetadata.h> |
938 | + |
939 | +#include <gtest/gtest.h> |
940 | + |
941 | +#include <chrono> |
942 | +#include <condition_variable> |
943 | + |
944 | +using namespace std; |
945 | +using namespace unity::scopes; |
946 | + |
947 | +class Receiver : public SearchListenerBase |
948 | +{ |
949 | +public: |
950 | + Receiver() |
951 | + : done_(false) |
952 | + , finished_ok_(false) |
953 | + { |
954 | + } |
955 | + |
956 | + virtual void push(CategorisedResult /* result */) override |
957 | + { |
958 | + } |
959 | + |
960 | + virtual void finished(CompletionDetails const& details) override |
961 | + { |
962 | + std::lock_guard<std::mutex> lock(mutex_); |
963 | + |
964 | + EXPECT_EQ(CompletionDetails::OK, details.status()); |
965 | + EXPECT_EQ("", details.message()); |
966 | + finished_ok_ = details.status() == CompletionDetails::OK; |
967 | + done_ = true; |
968 | + cond_.notify_all(); |
969 | + } |
970 | + |
971 | + bool wait_until_finished() |
972 | + { |
973 | + std::unique_lock<std::mutex> lock(mutex_); |
974 | + auto now = std::chrono::steady_clock::now(); |
975 | + auto expiry_time = now + std::chrono::seconds(5); |
976 | + EXPECT_TRUE(cond_.wait_until(lock, expiry_time, [this]{ return done_; })) << "finished message not delivered"; |
977 | + done_ = false; |
978 | + return finished_ok_; |
979 | + } |
980 | + |
981 | +private: |
982 | + bool done_; |
983 | + bool finished_ok_; |
984 | + std::mutex mutex_; |
985 | + std::condition_variable cond_; |
986 | +}; |
987 | + |
988 | +TEST(StandAloneScope, reachable) |
989 | +{ |
990 | + Runtime::UPtr rt = Runtime::create(TEST_RUNTIME_FILE); // No registry configured. |
991 | + |
992 | + try |
993 | + { |
994 | + rt->registry(); |
995 | + FAIL(); |
996 | + } |
997 | + catch (ConfigException const& e) |
998 | + { |
999 | + ASSERT_STREQ("unity::scopes::ConfigException: registry(): no registry configured", e.what()); |
1000 | + } |
1001 | + |
1002 | + string stringified_proxy = "ipc:///tmp/priv/SimpleScope#SimpleScope!t=1000!c=Scope"; |
1003 | + ObjectProxy p = rt->string_to_proxy(stringified_proxy); |
1004 | + ASSERT_TRUE(bool(p)); |
1005 | + |
1006 | + ScopeProxy sp = dynamic_pointer_cast<Scope>(p); |
1007 | + ASSERT_TRUE(bool(sp)); |
1008 | + |
1009 | + // We must be able to reach the scope even though the registry is not running. |
1010 | + shared_ptr<Receiver> reply(new Receiver); |
1011 | + auto ctrl = sp->search("", SearchMetadata("", ""), reply); |
1012 | + EXPECT_TRUE(reply->wait_until_finished()); |
1013 | +} |
1014 | + |
1015 | +int main(int argc, char **argv) |
1016 | +{ |
1017 | + ::testing::InitGoogleTest(&argc, argv); |
1018 | + |
1019 | + int rc = 1; |
1020 | + |
1021 | + // Set the "TEST_DESKTOP_FILES_DIR" env var before forking as not to create desktop files in ~/.local |
1022 | + putenv(const_cast<char*>("TEST_DESKTOP_FILES_DIR=" TEST_RUNTIME_PATH)); |
1023 | + |
1024 | + auto rpid = fork(); |
1025 | + if (rpid == 0) |
1026 | + { |
1027 | + // Start a scoperunner without any registry config. |
1028 | + const char* const args[] = {"scoperunner [StandAloneScope test]", TEST_RUNTIME_FILE, "SimpleScope.ini", nullptr}; |
1029 | + if (execv(TEST_SCOPERUNNER_PATH "/scoperunner", const_cast<char* const*>(args)) < 0) |
1030 | + { |
1031 | + perror("Error starting scoperunner:"); |
1032 | + } |
1033 | + } |
1034 | + else if (rpid > 0) |
1035 | + { |
1036 | + rc = RUN_ALL_TESTS(); |
1037 | + kill(rpid, SIGTERM); |
1038 | + waitpid(rpid, nullptr, 0); |
1039 | + } |
1040 | + else |
1041 | + { |
1042 | + perror("Failed to fork:"); |
1043 | + } |
1044 | + |
1045 | + return rc; |
1046 | +} |
1047 | |
1048 | === added file 'test/gtest/scopes/StandAloneScope/Zmq.ini.in' |
1049 | --- test/gtest/scopes/StandAloneScope/Zmq.ini.in 1970-01-01 00:00:00 +0000 |
1050 | +++ test/gtest/scopes/StandAloneScope/Zmq.ini.in 2015-08-27 06:44:23 +0000 |
1051 | @@ -0,0 +1,2 @@ |
1052 | +[Zmq] |
1053 | +EndpointDir = /tmp |
1054 | |
1055 | === modified file 'test/gtest/scopes/internal/RegistryConfig/RegistryConfig_test.cpp' |
1056 | --- test/gtest/scopes/internal/RegistryConfig/RegistryConfig_test.cpp 2014-08-28 00:20:56 +0000 |
1057 | +++ test/gtest/scopes/internal/RegistryConfig/RegistryConfig_test.cpp 2015-08-27 06:44:23 +0000 |
1058 | @@ -39,16 +39,7 @@ |
1059 | |
1060 | TEST(RegistryConfig, RegistryIDEmpty) |
1061 | { |
1062 | - try |
1063 | - { |
1064 | - RegistryConfig c("", TEST_REGISTRY_PATH); |
1065 | - FAIL(); |
1066 | - } |
1067 | - catch (InvalidArgumentException const& e) |
1068 | - { |
1069 | - EXPECT_STREQ("unity::InvalidArgumentException: Registry identity cannot be an empty string", |
1070 | - e.what()); |
1071 | - } |
1072 | + RegistryConfig c("", TEST_REGISTRY_PATH); |
1073 | } |
1074 | |
1075 | TEST(RegistryConfig, HomeNotSet) |