Merge lp:~marcustomlinson/unity-scopes-api/metadata_childtags_attr into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Work in progress
Proposed branch: lp:~marcustomlinson/unity-scopes-api/metadata_childtags_attr
Merge into: lp:unity-scopes-api/devel
Diff against target: 690 lines (+188/-12)
23 files modified
CONFIGFILES (+13/-0)
RELEASE_NOTES.md (+1/-0)
STRUCTS (+1/-0)
debian/changelog (+2/-1)
debian/libunity-scopes3.symbols (+5/-0)
doc/tutorial.dox (+12/-7)
include/unity/scopes/ScopeMetadata.h (+14/-1)
include/unity/scopes/internal/ScopeConfig.h (+2/-0)
include/unity/scopes/internal/ScopeMetadataImpl.h (+3/-0)
include/unity/scopes/testing/ScopeMetadataBuilder.h (+1/-0)
scoperegistry/scoperegistry.cpp (+1/-0)
src/scopes/ScopeMetadata.cpp (+5/-0)
src/scopes/internal/ScopeConfig.cpp (+25/-1)
src/scopes/internal/ScopeMetadataImpl.cpp (+31/-0)
src/scopes/testing/ScopeMetadataBuilder.cpp (+9/-0)
test/gtest/scopes/Registry/Registry_test.cpp (+6/-0)
test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in (+1/-0)
test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt (+2/-0)
test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp (+20/-0)
test/gtest/scopes/internal/ScopeConfig/bad_child_tags.ini.in (+5/-0)
test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in (+1/-0)
test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp (+21/-1)
test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp (+7/-1)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/metadata_childtags_attr
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+243116@code.launchpad.net
To post a comment you must log in.
555. By Marcus Tomlinson

Updated symbols

Unmerged revisions

555. By Marcus Tomlinson

Updated symbols

554. By Marcus Tomlinson

IsolatedScope_test.cpp

553. By Marcus Tomlinson

Added missing keys to known_entries in ScopeConfig

552. By Marcus Tomlinson

ChildScopes -> ChildTags in testscopeA.ini.in

551. By Marcus Tomlinson

ScopeMetadataImpl_test.cpp

550. By Marcus Tomlinson

ScopeConfig_test.cpp

549. By Marcus Tomlinson

Registry_test.cpp

548. By Marcus Tomlinson

ScopeMetadataBuilder.cpp

547. By Marcus Tomlinson

ScopeMetadataImpl.cpp

546. By Marcus Tomlinson

ScopeConfig.cpp

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CONFIGFILES'
2--- CONFIGFILES 2014-11-25 13:24:01 +0000
3+++ CONFIGFILES 2014-11-28 07:21:08 +0000
4@@ -359,9 +359,22 @@
5 must be separated by semicolons. This list is translated to the names of
6 children scopes when in the scopes overview page of the Unity Dash.
7
8+ E.g. "ChildScopes = com.canonical.scopes.amazon;com.canonical.scopes.ebay"
9+
10 Note: make sure there are no trailing spaces following
11 the ids, as they will be preserved.
12
13+- ChildTags
14+
15+ The list of tags of scopes aggregated by this scope (if any). The values in this list
16+ must be separated by semicolons. This list is translated to the names of
17+ children scopes when in the scopes overview page of the Unity Dash.
18+
19+ E.g. "ChildTags = music;video"
20+
21+ Note: make sure there are no trailing spaces following
22+ the tags, as they will be preserved.
23+
24 - Invisible
25
26 Whether the scope is hidden in the UI. The default value is false.
27
28=== modified file 'RELEASE_NOTES.md'
29--- RELEASE_NOTES.md 2014-11-26 07:39:35 +0000
30+++ RELEASE_NOTES.md 2014-11-28 07:21:08 +0000
31@@ -12,6 +12,7 @@
32 - Added missing methods for settings_definitions(), location_data_needed(),
33 and child_scope_ids() to testing::ScopeMetadataBuilder.
34 - Added support for Tags scope .ini option.
35+ - Added support for ChildTags scope .ini option.
36
37 Changes in version 0.6.8
38 ========================
39
40=== modified file 'STRUCTS'
41--- STRUCTS 2014-11-25 13:24:01 +0000
42+++ STRUCTS 2014-11-28 07:21:08 +0000
43@@ -78,6 +78,7 @@
44 'settings_definitions' : dictionary, optional
45 'location_data_needed' : bool, optional
46 'child_scopes' : array of strings, optional
47+ 'child_tags' : array of strings, optional
48 'version' : int, optional
49 'tags' : array of strings, optional
50
51
52=== modified file 'debian/changelog'
53--- debian/changelog 2014-11-26 07:39:35 +0000
54+++ debian/changelog 2014-11-28 07:21:08 +0000
55@@ -13,8 +13,9 @@
56
57 [ Marcus Tomlinson ]
58 * Added support for Tags scope .ini option.
59+ * Added support for ChildTags scope .ini option.
60
61- -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Wed, 26 Nov 2014 09:36:56 +0200
62+ -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Fri, 28 Nov 2014 07:26:14 +0200
63
64 unity-scopes-api (0.6.8+15.04.20141119-0ubuntu1) vivid; urgency=medium
65
66
67=== modified file 'debian/libunity-scopes3.symbols'
68--- debian/libunity-scopes3.symbols 2014-11-27 05:38:10 +0000
69+++ debian/libunity-scopes3.symbols 2014-11-28 07:21:08 +0000
70@@ -442,6 +442,7 @@
71 (c++)"unity::scopes::internal::ScopeConfig::art() const@Base" 0.4.0+14.04.20140312.1
72 (c++)"unity::scopes::internal::ScopeConfig::author() const@Base" 0.4.0+14.04.20140312.1
73 (c++)"unity::scopes::internal::ScopeConfig::child_scope_ids() const@Base" 0replaceme
74+ (c++)"unity::scopes::internal::ScopeConfig::child_tags() const@Base" 0replaceme
75 (c++)"unity::scopes::internal::ScopeConfig::debug_mode() const@Base" 0.6.2+rtm+rtm+rtm+14.09.20140818
76 (c++)"unity::scopes::internal::ScopeConfig::description() const@Base" 0.4.0+14.04.20140312.1
77 (c++)"unity::scopes::internal::ScopeConfig::display_name() const@Base" 0.4.0+14.04.20140312.1
78@@ -483,6 +484,7 @@
79 (c++)"unity::scopes::internal::ScopeMetadataImpl::art() const@Base" 0.4.0+14.04.20140312.1
80 (c++)"unity::scopes::internal::ScopeMetadataImpl::author() const@Base" 0.4.0+14.04.20140312.1
81 (c++)"unity::scopes::internal::ScopeMetadataImpl::child_scope_ids() const@Base" 0replaceme
82+ (c++)"unity::scopes::internal::ScopeMetadataImpl::child_tags() const@Base" 0replaceme
83 (c++)"unity::scopes::internal::ScopeMetadataImpl::create(std::unique_ptr<unity::scopes::internal::ScopeMetadataImpl, std::default_delete<unity::scopes::internal::ScopeMetadataImpl> >)@Base" 0.4.0+14.04.20140312.1
84 (c++)"unity::scopes::internal::ScopeMetadataImpl::description() const@Base" 0.4.0+14.04.20140312.1
85 (c++)"unity::scopes::internal::ScopeMetadataImpl::deserialize(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unity::scopes::Variant, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unity::scopes::Variant> > > const&)@Base" 0.4.0+14.04.20140312.1
86@@ -505,6 +507,7 @@
87 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_art(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
88 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_author(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
89 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_child_scope_ids(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)@Base" 0replaceme
90+ (c++)"unity::scopes::internal::ScopeMetadataImpl::set_child_tags(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)@Base" 0replaceme
91 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_description(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
92 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_display_name(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
93 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_hot_key(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
94@@ -771,6 +774,7 @@
95 (c++)"unity::scopes::ScopeMetadata::art() const@Base" 0.4.0+14.04.20140312.1
96 (c++)"unity::scopes::ScopeMetadata::author() const@Base" 0.4.0+14.04.20140312.1
97 (c++)"unity::scopes::ScopeMetadata::child_scope_ids() const@Base" 0replaceme
98+ (c++)"unity::scopes::ScopeMetadata::child_tags() const@Base" 0replaceme
99 (c++)"unity::scopes::ScopeMetadata::description() const@Base" 0.4.0+14.04.20140312.1
100 (c++)"unity::scopes::ScopeMetadata::display_name() const@Base" 0.4.0+14.04.20140312.1
101 (c++)"unity::scopes::ScopeMetadata::hot_key() const@Base" 0.4.0+14.04.20140312.1
102@@ -864,6 +868,7 @@
103 (c++)"unity::scopes::testing::ScopeMetadataBuilder::art(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1
104 (c++)"unity::scopes::testing::ScopeMetadataBuilder::author(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.5.0+14.10.20140619
105 (c++)"unity::scopes::testing::ScopeMetadataBuilder::child_scope_ids(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)@Base" 0replaceme
106+ (c++)"unity::scopes::testing::ScopeMetadataBuilder::child_tags(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)@Base" 0replaceme
107 (c++)"unity::scopes::testing::ScopeMetadataBuilder::description(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
108 (c++)"unity::scopes::testing::ScopeMetadataBuilder::display_name(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
109 (c++)"unity::scopes::testing::ScopeMetadataBuilder::hot_key(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1
110
111=== modified file 'doc/tutorial.dox'
112--- doc/tutorial.dox 2014-11-25 13:34:02 +0000
113+++ doc/tutorial.dox 2014-11-28 07:21:08 +0000
114@@ -1061,6 +1061,7 @@
115 HotKey =
116 ResultsTtlType = None, Small, Medium, or Large
117 ChildScopes =
118+ ChildTags =
119 Tags =
120
121 [Appearance]
122@@ -1102,16 +1103,20 @@
123 <li>http://remote-server.com/path/to/image</li>
124 </ul>
125
126-The value of `ChildScopes` key is to be used by aggregator scopes. It must be a semicolon separated list of scope identifiers that
127-might be aggregated by this scope, for example:
128+The value of the `ChildScopes` and `ChildTags` keys are to be used by aggregator scopes. `ChildScopes` must be a semicolon
129+separated list of scope identifiers that might be aggregated by this scope, for example:
130
131 `ChildScopes = com.foo.bar;com.foo.bar2`
132
133-This list of scopes is translated to the names of children scopes when in the scopes overview page of the Unity Dash.
134-
135-The `Tags` key is optional, but we recommend that you use it. Tags are used by aggregators to collect results from scopes of
136-similar type (E.g. The Music scope will aggregate scopes with the tag "music", and so on). The value of `Tags` should specify a
137-list of tags your scope falls under. Like `ChildScopes`, this value must be a semicolon separated list (E.g. `Tags = music;video`).
138+and `ChildTags` must be a semicolon separated list of tags of scopes that might be aggregated by this scope, for example:
139+
140+`ChildTags = music;video`
141+
142+These lists are translated to the names of children scopes when in the scopes overview page of the Unity Dash.
143+
144+The `Tags` key is optional, but we recommend that you use it. The value of `Tags` should specify a list of tags your scope falls
145+under. Tags are used by aggregators to collect results from scopes of similar type (E.g. The Music scope will aggregate scopes
146+with the tag "music", and so on). Like `ChildTags`, this value must be a semicolon separated list (E.g. `Tags = music;video`).
147
148 \subsection scopetool The scope tool
149
150
151=== modified file 'include/unity/scopes/ScopeMetadata.h'
152--- include/unity/scopes/ScopeMetadata.h 2014-11-25 13:24:01 +0000
153+++ include/unity/scopes/ScopeMetadata.h 2014-11-28 07:21:08 +0000
154@@ -187,7 +187,7 @@
155 \brief Return the list of scope identifiers aggregated by this scope.
156
157 The list returned by this method comes from the .ini file.
158- The scope author must ensure that it contains all scopes that an aggregator
159+ The scope author must ensure that it contains all scopes that this aggregator
160 might collect results from. This list may contain scopes that are not currently
161 installed and are optional for proper functioning of the aggregator scope.
162
163@@ -196,6 +196,19 @@
164 std::vector<std::string> child_scope_ids() const;
165
166 /**
167+ \brief Return the list of scope tags aggregated by this scope.
168+
169+ The list returned by this method comes from the .ini file.
170+ The scope author must ensure that it contains all tags of the scopes that this
171+ aggregator might collect results from. This list may contain tags for scopes
172+ that are not currently installed and are optional for proper functioning of the
173+ aggregator scope.
174+
175+ \return The list of scopes tags aggregated by this scope.
176+ */
177+ std::vector<std::string> child_tags() const;
178+
179+ /**
180 \brief Return the version of the scope.
181
182 \return The version or, if the scope does not define its version,
183
184=== modified file 'include/unity/scopes/internal/ScopeConfig.h'
185--- include/unity/scopes/internal/ScopeConfig.h 2014-11-25 13:24:01 +0000
186+++ include/unity/scopes/internal/ScopeConfig.h 2014-11-28 07:21:08 +0000
187@@ -53,6 +53,7 @@
188 ScopeMetadata::ResultsTtlType results_ttl_type() const; // Optional, returns none if not present
189 bool debug_mode() const; // Optional, returns false if not present
190 std::vector<std::string> child_scope_ids() const; // Optional, returns an empty vector if no ids are present
191+ std::vector<std::string> child_tags() const; // Optional, returns an empty vector if no tags are present
192 int version() const; // Optional, returns 0 if not present
193 std::vector<std::string> tags() const; // Optional, returns an empty vector if no tags are present
194
195@@ -76,6 +77,7 @@
196 ScopeMetadata::ResultsTtlType results_ttl_type_;
197 bool debug_mode_;
198 std::vector<std::string> child_scope_ids_;
199+ std::vector<std::string> child_tags_;
200 int version_;
201 std::vector<std::string> tags_;
202
203
204=== modified file 'include/unity/scopes/internal/ScopeMetadataImpl.h'
205--- include/unity/scopes/internal/ScopeMetadataImpl.h 2014-11-25 13:24:01 +0000
206+++ include/unity/scopes/internal/ScopeMetadataImpl.h 2014-11-28 07:21:08 +0000
207@@ -58,6 +58,7 @@
208 VariantArray settings_definitions() const; // optional (default: empty array)
209 bool location_data_needed() const; // optional (default: false)
210 std::vector<std::string> child_scope_ids() const; // optional (default: empty array)
211+ std::vector<std::string> child_tags() const; // optional (default: empty array)
212 int version() const; // optional (default: 0)
213 std::vector<std::string> tags() const; // optional (default: empty array)
214
215@@ -77,6 +78,7 @@
216 void set_settings_definitions(VariantArray const& settings_definitions);
217 void set_location_data_needed(bool location_data_needed);
218 void set_child_scope_ids(std::vector<std::string> const& ids);
219+ void set_child_tags(std::vector<std::string> const& tags);
220 void set_version(int v);
221 void set_tags(std::vector<std::string> const& tags);
222
223@@ -104,6 +106,7 @@
224 std::unique_ptr<VariantArray> settings_definitions_; // Optional, hence a pointer
225 std::unique_ptr<bool> location_data_needed_; // Optional, hence a pointer
226 std::vector<std::string> child_scope_ids_;
227+ std::vector<std::string> child_tags_;
228 int version_;
229 std::vector<std::string> tags_;
230 };
231
232=== modified file 'include/unity/scopes/testing/ScopeMetadataBuilder.h'
233--- include/unity/scopes/testing/ScopeMetadataBuilder.h 2014-11-26 07:46:31 +0000
234+++ include/unity/scopes/testing/ScopeMetadataBuilder.h 2014-11-28 07:21:08 +0000
235@@ -96,6 +96,7 @@
236 ScopeMetadataBuilder& settings_definitions(Optional<VariantArray> const& value);
237 ScopeMetadataBuilder& location_data_needed(Optional<bool> const& value);
238 ScopeMetadataBuilder& child_scope_ids(Optional<std::vector<std::string>> const& value);
239+ ScopeMetadataBuilder& child_tags(Optional<std::vector<std::string>> const& value);
240 ScopeMetadataBuilder& version(Optional<int> const& value);
241 ScopeMetadataBuilder& tags(Optional<std::vector<std::string>> const& value);
242
243
244=== modified file 'scoperegistry/scoperegistry.cpp'
245--- scoperegistry/scoperegistry.cpp 2014-11-25 13:24:01 +0000
246+++ scoperegistry/scoperegistry.cpp 2014-11-28 07:21:08 +0000
247@@ -318,6 +318,7 @@
248 mi->set_invisible(sc.invisible());
249 mi->set_appearance_attributes(sc.appearance_attributes());
250 mi->set_child_scope_ids(sc.child_scope_ids());
251+ mi->set_child_tags(sc.child_tags());
252 mi->set_version(sc.version());
253 mi->set_tags(sc.tags());
254
255
256=== modified file 'src/scopes/ScopeMetadata.cpp'
257--- src/scopes/ScopeMetadata.cpp 2014-11-25 13:24:01 +0000
258+++ src/scopes/ScopeMetadata.cpp 2014-11-28 07:21:08 +0000
259@@ -152,6 +152,11 @@
260 return p->child_scope_ids();
261 }
262
263+std::vector<std::string> ScopeMetadata::child_tags() const
264+{
265+ return p->child_tags();
266+}
267+
268 int ScopeMetadata::version() const
269 {
270 return p->version();
271
272=== modified file 'src/scopes/internal/ScopeConfig.cpp'
273--- src/scopes/internal/ScopeConfig.cpp 2014-11-25 13:24:01 +0000
274+++ src/scopes/internal/ScopeConfig.cpp 2014-11-28 07:21:08 +0000
275@@ -57,6 +57,7 @@
276 const string results_ttl_key = "ResultsTtlType";
277 const string debug_mode_key = "DebugMode";
278 const string child_scope_ids_key = "ChildScopes";
279+ const string child_tags_key = "ChildTags";
280 const string version_key = "Version";
281 const string tags_key = "Tags";
282
283@@ -211,6 +212,22 @@
284
285 try
286 {
287+ child_tags_ = parser()->get_string_array(scope_config_group, child_tags_key);
288+ }
289+ catch (LogicException const&)
290+ {
291+ }
292+
293+ for (auto const& tag: child_tags_)
294+ {
295+ if (tag.empty())
296+ {
297+ throw_ex("Invalid empty tag string found in \"ChildTags\" list");
298+ }
299+ }
300+
301+ try
302+ {
303 version_ = get_int(scope_config_group, version_key);
304 if (version_ <= 0)
305 {
306@@ -277,7 +294,9 @@
307 results_ttl_key,
308 debug_mode_key,
309 child_scope_ids_key,
310- version_key
311+ child_tags_key,
312+ version_key,
313+ tags_key
314 }
315 },
316 { scope_appearance_group,
317@@ -456,6 +475,11 @@
318 return child_scope_ids_;
319 }
320
321+std::vector<std::string> ScopeConfig::child_tags() const
322+{
323+ return child_tags_;
324+}
325+
326 int ScopeConfig::version() const
327 {
328 return version_;
329
330=== modified file 'src/scopes/internal/ScopeMetadataImpl.cpp'
331--- src/scopes/internal/ScopeMetadataImpl.cpp 2014-11-25 13:24:01 +0000
332+++ src/scopes/internal/ScopeMetadataImpl.cpp 2014-11-28 07:21:08 +0000
333@@ -60,6 +60,7 @@
334 , appearance_attributes_(other.appearance_attributes_)
335 , results_ttl_type_(other.results_ttl_type_)
336 , child_scope_ids_(other.child_scope_ids_)
337+ , child_tags_(other.child_tags_)
338 , version_(other.version_)
339 , tags_(other.tags_)
340 {
341@@ -118,6 +119,7 @@
342 settings_definitions_.reset(rhs.settings_definitions_ ? new VariantArray(*rhs.settings_definitions_) : nullptr);
343 location_data_needed_.reset(rhs.location_data_needed_ ? new bool(*rhs.location_data_needed_) : nullptr);
344 child_scope_ids_ = rhs.child_scope_ids_;
345+ child_tags_ = rhs.child_tags_;
346 version_ = rhs.version_;
347 tags_ = rhs.tags_;
348 }
349@@ -236,6 +238,11 @@
350 return child_scope_ids_;
351 }
352
353+std::vector<std::string> ScopeMetadataImpl::child_tags() const
354+{
355+ return child_tags_;
356+}
357+
358 int ScopeMetadataImpl::version() const
359 {
360 return version_;
361@@ -326,6 +333,11 @@
362 child_scope_ids_ = ids;
363 }
364
365+void ScopeMetadataImpl::set_child_tags(std::vector<std::string> const& tags)
366+{
367+ child_tags_ = tags;
368+}
369+
370 void ScopeMetadataImpl::set_version(int v)
371 {
372 if (v < 0)
373@@ -425,6 +437,15 @@
374 }
375 var["child_scopes"] = Variant(va);
376 }
377+ if (child_tags_.size())
378+ {
379+ VariantArray va;
380+ for (auto const& tag: child_tags_)
381+ {
382+ va.push_back(Variant(tag));
383+ }
384+ var["child_tags"] = Variant(va);
385+ }
386 if (tags_.size())
387 {
388 VariantArray va;
389@@ -579,6 +600,16 @@
390 }
391 }
392
393+ child_tags_.clear();
394+ it = var.find("child_tags");
395+ if (it != var.end())
396+ {
397+ for (auto const& v: it->second.get_array())
398+ {
399+ child_tags_.push_back(v.get_string());
400+ }
401+ }
402+
403 tags_.clear();
404 it = var.find("tags");
405 if (it != var.end())
406
407=== modified file 'src/scopes/testing/ScopeMetadataBuilder.cpp'
408--- src/scopes/testing/ScopeMetadataBuilder.cpp 2014-11-26 07:46:31 +0000
409+++ src/scopes/testing/ScopeMetadataBuilder.cpp 2014-11-28 07:21:08 +0000
410@@ -47,6 +47,7 @@
411 Optional<VariantArray> settings_definitions;
412 Optional<bool> location_data_needed;
413 Optional<std::vector<std::string>> child_scope_ids;
414+ Optional<std::vector<std::string>> child_tags;
415 Optional<int> version;
416 Optional<std::vector<std::string>> tags;
417 };
418@@ -155,6 +156,12 @@
419 return *this;
420 }
421
422+testing::ScopeMetadataBuilder& testing::ScopeMetadataBuilder::child_tags(Optional<std::vector<std::string>> const& value)
423+{
424+ p->child_tags = value;
425+ return *this;
426+}
427+
428 testing::ScopeMetadataBuilder& testing::ScopeMetadataBuilder::version(Optional<int> const& value)
429 {
430 p->version = value;
431@@ -198,6 +205,8 @@
432 impl->set_location_data_needed(*p->location_data_needed);
433 if (p->child_scope_ids)
434 impl->set_child_scope_ids(*p->child_scope_ids);
435+ if (p->child_tags)
436+ impl->set_child_tags(*p->child_tags);
437 if (p->version)
438 impl->set_version(*p->version);
439 if (p->tags)
440
441=== modified file 'test/gtest/scopes/Registry/Registry_test.cpp'
442--- test/gtest/scopes/Registry/Registry_test.cpp 2014-11-25 13:24:01 +0000
443+++ test/gtest/scopes/Registry/Registry_test.cpp 2014-11-28 07:21:08 +0000
444@@ -109,6 +109,11 @@
445 EXPECT_EQ("com.foo.bar", children[0]);
446 EXPECT_EQ("com.foo.baz", children[1]);
447 EXPECT_EQ(1, meta.version());
448+ auto child_tags = meta.child_tags();
449+ EXPECT_EQ(2u, child_tags.size());
450+ EXPECT_EQ("games", child_tags[0]);
451+ EXPECT_EQ("sport", child_tags[1]);
452+ EXPECT_EQ(1, meta.version());
453 auto tags = meta.tags();
454 EXPECT_EQ(3u, tags.size());
455 EXPECT_EQ("music", tags[0]);
456@@ -145,6 +150,7 @@
457 EXPECT_EQ(0, defs.size());
458 EXPECT_FALSE(meta.location_data_needed());
459 EXPECT_EQ(0, meta.child_scope_ids().size());
460+ EXPECT_EQ(0, meta.child_tags().size());
461 EXPECT_EQ(0, meta.tags().size());
462 EXPECT_EQ(0, meta.version());
463 }
464
465=== modified file 'test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in'
466--- test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-11-25 13:24:01 +0000
467+++ test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-11-28 07:21:08 +0000
468@@ -8,6 +8,7 @@
469 HotKey = scope-A.HotKey
470 LocationDataNeeded = true
471 ChildScopes = com.foo.bar;com.foo.baz
472+ChildTags = games;sport
473 Version = 1
474 Tags = music;news;foo
475
476
477=== modified file 'test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt'
478--- test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt 2014-11-26 08:03:28 +0000
479+++ test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt 2014-11-28 07:21:08 +0000
480@@ -8,6 +8,7 @@
481 configure_file(bad_child_ids.ini.in bad_child_ids.ini copyonly)
482 configure_file(empty_child_ids.ini.in empty_child_ids.ini copyonly)
483 configure_file(single_child_id.ini.in single_child_id.ini copyonly)
484+configure_file(bad_child_tags.ini.in bad_child_tags.ini copyonly)
485 configure_file(bad_tags.ini.in bad_tags.ini copyonly)
486 configure_file(empty_tags.ini.in empty_tags.ini copyonly)
487 configure_file(single_tag.ini.in single_tag.ini copyonly)
488@@ -20,6 +21,7 @@
489 add_definitions(-DBAD_CHILD_IDS="${CMAKE_CURRENT_BINARY_DIR}/bad_child_ids.ini")
490 add_definitions(-DEMPTY_CHILD_IDS="${CMAKE_CURRENT_BINARY_DIR}/empty_child_ids.ini")
491 add_definitions(-DSINGLE_CHILD_ID="${CMAKE_CURRENT_BINARY_DIR}/single_child_id.ini")
492+add_definitions(-DBAD_CHILD_TAGS="${CMAKE_CURRENT_BINARY_DIR}/bad_child_tags.ini")
493 add_definitions(-DBAD_TTL="${CMAKE_CURRENT_BINARY_DIR}/bad_ttl.ini")
494 add_definitions(-DBAD_VERSION="${CMAKE_CURRENT_BINARY_DIR}/bad_version.ini")
495 add_definitions(-DBAD_TAGS="${CMAKE_CURRENT_BINARY_DIR}/bad_tags.ini")
496
497=== modified file 'test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp'
498--- test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp 2014-11-26 08:03:28 +0000
499+++ test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp 2014-11-28 07:21:08 +0000
500@@ -57,6 +57,13 @@
501 EXPECT_EQ("com.foo.bar2", children[1]);
502 EXPECT_EQ("com.foo.boo", children[2]);
503
504+ auto child_tags = cfg.child_tags();
505+ EXPECT_EQ(4u, child_tags.size());
506+ EXPECT_EQ("fee", child_tags[0]);
507+ EXPECT_EQ("fi", child_tags[1]);
508+ EXPECT_EQ("fo", child_tags[2]);
509+ EXPECT_EQ("fum", child_tags[3]);
510+
511 auto tags = cfg.tags();
512 EXPECT_EQ(2u, tags.size());
513 EXPECT_EQ("foo", tags[0]);
514@@ -142,6 +149,19 @@
515 EXPECT_EQ(cfg.child_scope_ids().size(), 1);
516 }
517
518+TEST(ScopeConfig, bad_child_tags)
519+{
520+ try
521+ {
522+ ScopeConfig cfg(BAD_CHILD_TAGS);
523+ }
524+ catch(ConfigException const& e)
525+ {
526+ boost::regex r("unity::scopes::ConfigException: \".*\": Invalid empty tag string found in \"ChildTags\" list");
527+ EXPECT_TRUE(boost::regex_match(e.what(), r));
528+ }
529+}
530+
531 TEST(ScopeConfig, bad_timeout)
532 {
533 try
534
535=== added file 'test/gtest/scopes/internal/ScopeConfig/bad_child_tags.ini.in'
536--- test/gtest/scopes/internal/ScopeConfig/bad_child_tags.ini.in 1970-01-01 00:00:00 +0000
537+++ test/gtest/scopes/internal/ScopeConfig/bad_child_tags.ini.in 2014-11-28 07:21:08 +0000
538@@ -0,0 +1,5 @@
539+[ScopeConfig]
540+DisplayName = Scope name
541+Description = Scope description
542+Author = Canonical
543+ChildTags = ;bar;
544
545=== modified file 'test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in'
546--- test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in 2014-11-26 08:03:28 +0000
547+++ test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in 2014-11-28 07:21:08 +0000
548@@ -19,6 +19,7 @@
549 DebugMode = true
550 Version = 1
551 ChildScopes = com.foo.bar;com.foo.bar2;com.foo.boo
552+ChildTags = fee;fi;fo;fum
553 Tags = foo;bar
554
555 [Appearance]
556
557=== modified file 'test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp'
558--- test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp 2014-11-25 13:24:01 +0000
559+++ test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp 2014-11-28 07:21:08 +0000
560@@ -162,6 +162,7 @@
561 mi2->set_settings_definitions(va);
562 mi2->set_location_data_needed(true);
563 mi2->set_child_scope_ids(vector<string>{"abc", "def"});
564+ mi2->set_child_tags(vector<string>{"foo", "bar"});
565 mi2->set_tags(vector<string>{"music", "video", "news"});
566
567 // Make another copy, so we get coverage on the entire copy constructor
568@@ -176,6 +177,7 @@
569 EXPECT_EQ(va, m.settings_definitions());
570 EXPECT_TRUE(m.location_data_needed());
571 EXPECT_EQ((vector<string>{"abc", "def"}), m.child_scope_ids());
572+ EXPECT_EQ((vector<string>{"foo", "bar"}), m.child_tags());
573 EXPECT_EQ((vector<string>{"music", "video", "news"}), m.tags());
574
575 // Make another value
576@@ -200,6 +202,7 @@
577 ti->set_settings_definitions(tmp_va);
578 ti->set_location_data_needed(true);
579 ti->set_child_scope_ids(vector<string>{"tmp abc", "tmp def"});
580+ ti->set_child_tags(vector<string>{"tmp foo", "tmp bar"});
581 ti->set_tags(vector<string>{"music", "video"});
582
583 // Check impl assignment operator
584@@ -222,6 +225,7 @@
585 EXPECT_EQ(tmp_va, ci.settings_definitions());
586 EXPECT_TRUE(ci.location_data_needed());
587 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), ci.child_scope_ids());
588+ EXPECT_EQ((vector<string>{"tmp foo", "tmp bar"}), ci.child_tags());
589 EXPECT_EQ(99, ci.version());
590 EXPECT_EQ((vector<string>{"music", "video"}), ci.tags());
591
592@@ -246,6 +250,7 @@
593 EXPECT_EQ(tmp_va, m.settings_definitions());
594 EXPECT_TRUE(m.location_data_needed());
595 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), m.child_scope_ids());
596+ EXPECT_EQ((vector<string>{"tmp foo", "tmp bar"}), m.child_tags());
597 EXPECT_EQ((vector<string>{"music", "video"}), m.tags());
598
599 // Self-assignment
600@@ -268,6 +273,7 @@
601 EXPECT_EQ(tmp_va, tmp.settings_definitions());
602 EXPECT_TRUE(tmp.location_data_needed());
603 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp.child_scope_ids());
604+ EXPECT_EQ((vector<string>{"tmp foo", "tmp bar"}), tmp.child_tags());
605 EXPECT_EQ((vector<string>{"music", "video"}), tmp.tags());
606
607 // Copy constructor
608@@ -290,6 +296,7 @@
609 EXPECT_EQ(tmp_va, tmp2.settings_definitions());
610 EXPECT_TRUE(tmp2.location_data_needed());
611 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp2.child_scope_ids());
612+ EXPECT_EQ((vector<string>{"tmp foo", "tmp bar"}), tmp2.child_tags());
613 EXPECT_EQ((vector<string>{"music", "video"}), tmp2.tags());
614 }
615
616@@ -322,12 +329,13 @@
617 mi->set_settings_definitions(va);
618 mi->set_location_data_needed(false);
619 mi->set_child_scope_ids({"com.foo.bar", "com.foo.baz"});
620+ mi->set_child_tags({"music", "video"});
621 mi->set_tags({"news", "games"});
622
623 // Check that serialize() sets the map values correctly
624 auto m = ScopeMetadataImpl::create(move(mi));
625 auto var = m.serialize();
626- EXPECT_EQ(18u, var.size());
627+ EXPECT_EQ(19u, var.size());
628 EXPECT_EQ("scope_id", var["scope_id"].get_string());
629 EXPECT_EQ("display_name", var["display_name"].get_string());
630 EXPECT_EQ("description", var["description"].get_string());
631@@ -348,6 +356,9 @@
632 EXPECT_EQ(2u, var["child_scopes"].get_array().size());
633 EXPECT_EQ("com.foo.bar", var["child_scopes"].get_array()[0].get_string());
634 EXPECT_EQ("com.foo.baz", var["child_scopes"].get_array()[1].get_string());
635+ EXPECT_EQ(2u, var["child_tags"].get_array().size());
636+ EXPECT_EQ("music", var["child_tags"].get_array()[0].get_string());
637+ EXPECT_EQ("video", var["child_tags"].get_array()[1].get_string());
638 EXPECT_EQ(2u, var["tags"].get_array().size());
639 EXPECT_EQ("news", var["tags"].get_array()[0].get_string());
640 EXPECT_EQ("games", var["tags"].get_array()[1].get_string());
641@@ -372,6 +383,15 @@
642 EXPECT_FALSE(c.invisible());
643 EXPECT_EQ(va, c.settings_definitions());
644 EXPECT_FALSE(c.location_data_needed());
645+ EXPECT_EQ(2u, c.child_scope_ids().size());
646+ EXPECT_EQ("com.foo.bar", c.child_scope_ids()[0]);
647+ EXPECT_EQ("com.foo.baz", c.child_scope_ids()[1]);
648+ EXPECT_EQ(2u, c.child_tags().size());
649+ EXPECT_EQ("music", c.child_tags()[0]);
650+ EXPECT_EQ("video", c.child_tags()[1]);
651+ EXPECT_EQ(2u, c.tags().size());
652+ EXPECT_EQ("news", c.tags()[0]);
653+ EXPECT_EQ("games", c.tags()[1]);
654 }
655
656 TEST(ScopeMetadataImpl, serialize_exceptions)
657
658=== modified file 'test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp'
659--- test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp 2014-11-12 02:15:46 +0000
660+++ test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp 2014-11-28 07:21:08 +0000
661@@ -94,6 +94,8 @@
662 settings_defs.push_back(unity::scopes::Variant(a_setting));
663
664 std::vector<std::string> child_scope_ids{ "joe", "mary" };
665+ std::vector<std::string> child_tags{ "bits", "bobs" };
666+ std::vector<std::string> tags{ "people", "things" };
667
668 unity::scopes::testing::ScopeMetadataBuilder builder;
669 builder.scope_id(scope_id)
670@@ -112,7 +114,9 @@
671 .settings_definitions(settings_defs)
672 .location_data_needed(true)
673 .child_scope_ids(child_scope_ids)
674- .version(42);
675+ .child_tags(child_tags)
676+ .version(42)
677+ .tags(tags);
678 unity::scopes::ScopeMetadata metadata = builder();
679 EXPECT_EQ(scope_id, metadata.scope_id());
680 EXPECT_EQ("display_name", metadata.display_name());
681@@ -129,7 +133,9 @@
682 EXPECT_EQ(settings_defs, metadata.settings_definitions());
683 EXPECT_TRUE(metadata.location_data_needed());
684 EXPECT_EQ(child_scope_ids, metadata.child_scope_ids());
685+ EXPECT_EQ(child_tags, metadata.child_tags());
686 EXPECT_EQ(42, metadata.version());
687+ EXPECT_EQ(tags, metadata.tags());
688 }
689
690 TEST(ScopeMetadataBuilder, construction_in_case_of_missing_mandatory_arguments_aborts)

Subscribers

People subscribed via source and target branches

to all changes: