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

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michi Henning
Approved revision: 543
Merged at revision: 537
Proposed branch: lp:~marcustomlinson/unity-scopes-api/metadata_tags_attr
Merge into: lp:unity-scopes-api/devel
Diff against target: 747 lines (+222/-4)
30 files modified
CONFIGFILES (+8/-0)
RELEASE_NOTES.md (+1/-0)
STRUCTS (+1/-0)
debian/changelog (+4/-1)
debian/libunity-scopes3.symbols (+5/-0)
doc/tutorial.dox (+5/-0)
include/unity/scopes/ScopeMetadata.h (+10/-0)
include/unity/scopes/internal/ScopeConfig.h (+3/-1)
include/unity/scopes/internal/ScopeMetadataImpl.h (+3/-0)
include/unity/scopes/internal/smartscopes/SmartScopesClient.h (+1/-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 (+22/-0)
src/scopes/internal/ScopeMetadataImpl.cpp (+31/-0)
src/scopes/internal/smartscopes/SSRegistryObject.cpp (+2/-0)
src/scopes/internal/smartscopes/SmartScopesClient.cpp (+26/-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 (+6/-0)
test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp (+30/-0)
test/gtest/scopes/internal/ScopeConfig/bad_tags.ini.in (+5/-0)
test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in (+1/-0)
test/gtest/scopes/internal/ScopeConfig/empty_tags.ini.in (+5/-0)
test/gtest/scopes/internal/ScopeConfig/single_tag.ini.in (+5/-0)
test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp (+12/-1)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py (+1/-1)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp (+7/-0)
test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp (+5/-0)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/metadata_tags_attr
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+242882@code.launchpad.net

Commit message

Added support for 'Tags' scope .ini option.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
543. By Marcus Tomlinson

Added missing symbol

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote :

Looks good and very thorough, thanks!

My only comment: we probably need a public list of tags that are used. It's no good if each and every scope invents its own tags (with possibly different spelling).

What would the best place for this be? The doxygen doc, I would think?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CONFIGFILES'
--- CONFIGFILES 2014-11-13 00:28:01 +0000
+++ CONFIGFILES 2014-11-27 05:38:38 +0000
@@ -403,6 +403,14 @@
403403
404 If not set, the default value is false.404 If not set, the default value is false.
405405
406- Tags
407
408 A list of tags this scope falls under (if any). The values in this list must be separated by semicolons.
409
410 E.g. "Tags = music;video"
411
412 Note: make sure there are no trailing spaces following the tags, as they will be preserved.
413
406414
407The following keys are recognized in the Appearance group:415The following keys are recognized in the Appearance group:
408416
409417
=== modified file 'RELEASE_NOTES.md'
--- RELEASE_NOTES.md 2014-11-21 09:59:33 +0000
+++ RELEASE_NOTES.md 2014-11-27 05:38:38 +0000
@@ -11,6 +11,7 @@
11 not vice versa).11 not vice versa).
12 - Added missing methods for settings_definitions(), location_data_needed(),12 - Added missing methods for settings_definitions(), location_data_needed(),
13 and child_scope_ids() to testing::ScopeMetadataBuilder.13 and child_scope_ids() to testing::ScopeMetadataBuilder.
14 - Added support for Tags scope .ini option.
1415
15Changes in version 0.6.816Changes in version 0.6.8
16========================17========================
1718
=== modified file 'STRUCTS'
--- STRUCTS 2014-11-10 03:57:03 +0000
+++ STRUCTS 2014-11-27 05:38:38 +0000
@@ -79,6 +79,7 @@
79 'location_data_needed' : bool, optional79 'location_data_needed' : bool, optional
80 'child_scopes' : array of strings, optional80 'child_scopes' : array of strings, optional
81 'version' : int, optional81 'version' : int, optional
82 'tags' : array of strings, optional
8283
83Query (returned by serialize())84Query (returned by serialize())
84===============================85===============================
8586
=== modified file 'debian/changelog'
--- debian/changelog 2014-11-21 09:59:33 +0000
+++ debian/changelog 2014-11-27 05:38:38 +0000
@@ -11,7 +11,10 @@
11 * Added missing methods for settings_definitions(), location_data_needed(),11 * Added missing methods for settings_definitions(), location_data_needed(),
12 and child_scope_ids() to testing::ScopeMetadataBuilder.12 and child_scope_ids() to testing::ScopeMetadataBuilder.
1313
14 -- Pawel Stolowski <pawel.stolowski@canonical.com> Fri, 21 Nov 2014 10:56:49 +010014 [ Marcus Tomlinson ]
15 * Added support for Tags scope .ini option.
16
17 -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Wed, 26 Nov 2014 09:36:56 +0200
1518
16unity-scopes-api (0.6.8+15.04.20141119-0ubuntu1) vivid; urgency=medium19unity-scopes-api (0.6.8+15.04.20141119-0ubuntu1) vivid; urgency=medium
1720
1821
=== modified file 'debian/libunity-scopes3.symbols'
--- debian/libunity-scopes3.symbols 2014-11-21 09:59:33 +0000
+++ debian/libunity-scopes3.symbols 2014-11-27 05:38:38 +0000
@@ -457,6 +457,7 @@
457 (c++)"unity::scopes::internal::ScopeConfig::ScopeConfig(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1457 (c++)"unity::scopes::internal::ScopeConfig::ScopeConfig(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
458 (c++)"unity::scopes::internal::ScopeConfig::scope_runner() const@Base" 0.4.2+14.04.20140404.2458 (c++)"unity::scopes::internal::ScopeConfig::scope_runner() const@Base" 0.4.2+14.04.20140404.2
459 (c++)"unity::scopes::internal::ScopeConfig::search_hint() const@Base" 0.4.0+14.04.20140312.1459 (c++)"unity::scopes::internal::ScopeConfig::search_hint() const@Base" 0.4.0+14.04.20140312.1
460 (c++)"unity::scopes::internal::ScopeConfig::tags() const@Base" 0replaceme
460 (c++)"unity::scopes::internal::ScopeConfig::version() const@Base" 0replaceme461 (c++)"unity::scopes::internal::ScopeConfig::version() const@Base" 0replaceme
461 (c++)"unity::scopes::internal::ScopeImpl::activate(unity::scopes::Result const&, unity::scopes::ActionMetadata const&, std::shared_ptr<unity::scopes::ActivationListenerBase> const&)@Base" 0.4.0+14.04.20140312.1462 (c++)"unity::scopes::internal::ScopeImpl::activate(unity::scopes::Result const&, unity::scopes::ActionMetadata const&, std::shared_ptr<unity::scopes::ActivationListenerBase> const&)@Base" 0.4.0+14.04.20140312.1
462 (c++)"unity::scopes::internal::ScopeImpl::create(std::shared_ptr<unity::scopes::internal::MWScope> const&, unity::scopes::internal::RuntimeImpl*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1463 (c++)"unity::scopes::internal::ScopeImpl::create(std::shared_ptr<unity::scopes::internal::MWScope> const&, unity::scopes::internal::RuntimeImpl*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
@@ -516,8 +517,10 @@
516 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_scope_id(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1517 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_scope_id(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
517 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_search_hint(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1518 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_search_hint(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
518 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_settings_definitions(std::vector<unity::scopes::Variant, std::allocator<unity::scopes::Variant> > const&)@Base" 0.5.2+14.10.20140709.2519 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_settings_definitions(std::vector<unity::scopes::Variant, std::allocator<unity::scopes::Variant> > const&)@Base" 0.5.2+14.10.20140709.2
520 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_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
519 (c++)"unity::scopes::internal::ScopeMetadataImpl::settings_definitions() const@Base" 0.5.2+14.10.20140709.2521 (c++)"unity::scopes::internal::ScopeMetadataImpl::settings_definitions() const@Base" 0.5.2+14.10.20140709.2
520 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_version(int)@Base" 0replaceme522 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_version(int)@Base" 0replaceme
523 (c++)"unity::scopes::internal::ScopeMetadataImpl::tags() const@Base" 0replaceme
521 (c++)"unity::scopes::internal::ScopeMetadataImpl::version() const@Base" 0replaceme524 (c++)"unity::scopes::internal::ScopeMetadataImpl::version() const@Base" 0replaceme
522 (c++)"unity::scopes::internal::ScopeObject::activate(unity::scopes::Result const&, unity::scopes::ActionMetadata const&, std::shared_ptr<unity::scopes::internal::MWReply> const&, unity::scopes::internal::InvokeInfo const&)@Base" 0.4.0+14.04.20140312.1525 (c++)"unity::scopes::internal::ScopeObject::activate(unity::scopes::Result const&, unity::scopes::ActionMetadata const&, std::shared_ptr<unity::scopes::internal::MWReply> const&, unity::scopes::internal::InvokeInfo const&)@Base" 0.4.0+14.04.20140312.1
523 (c++)"unity::scopes::internal::ScopeObject::debug_mode() const@Base" 0.6.2+rtm+rtm+rtm+14.09.20140818526 (c++)"unity::scopes::internal::ScopeObject::debug_mode() const@Base" 0.6.2+rtm+rtm+rtm+14.09.20140818
@@ -787,6 +790,7 @@
787 (c++)"unity::scopes::ScopeMetadata::search_hint() const@Base" 0.4.0+14.04.20140312.1790 (c++)"unity::scopes::ScopeMetadata::search_hint() const@Base" 0.4.0+14.04.20140312.1
788 (c++)"unity::scopes::ScopeMetadata::serialize() const@Base" 0.4.0+14.04.20140312.1791 (c++)"unity::scopes::ScopeMetadata::serialize() const@Base" 0.4.0+14.04.20140312.1
789 (c++)"unity::scopes::ScopeMetadata::settings_definitions() const@Base" 0.5.2+14.10.20140709.2792 (c++)"unity::scopes::ScopeMetadata::settings_definitions() const@Base" 0.5.2+14.10.20140709.2
793 (c++)"unity::scopes::ScopeMetadata::tags() const@Base" 0replaceme
790 (c++)"unity::scopes::ScopeMetadata::version() const@Base" 0replaceme794 (c++)"unity::scopes::ScopeMetadata::version() const@Base" 0replaceme
791 (c++)"unity::scopes::Scope::~Scope()@Base" 0.4.0+14.04.20140312.1795 (c++)"unity::scopes::Scope::~Scope()@Base" 0.4.0+14.04.20140312.1
792 (c++)"unity::scopes::Scope::Scope()@Base" 0.4.0+14.04.20140312.1796 (c++)"unity::scopes::Scope::Scope()@Base" 0.4.0+14.04.20140312.1
@@ -875,6 +879,7 @@
875 (c++)"unity::scopes::testing::ScopeMetadataBuilder::ScopeMetadataBuilder()@Base" 0.4.0+14.04.20140312.1879 (c++)"unity::scopes::testing::ScopeMetadataBuilder::ScopeMetadataBuilder()@Base" 0.4.0+14.04.20140312.1
876 (c++)"unity::scopes::testing::ScopeMetadataBuilder::search_hint(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1880 (c++)"unity::scopes::testing::ScopeMetadataBuilder::search_hint(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
877 (c++)"unity::scopes::testing::ScopeMetadataBuilder::settings_definitions(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::vector<unity::scopes::Variant, std::allocator<unity::scopes::Variant> > > const&)@Base" 0replaceme881 (c++)"unity::scopes::testing::ScopeMetadataBuilder::settings_definitions(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::vector<unity::scopes::Variant, std::allocator<unity::scopes::Variant> > > const&)@Base" 0replaceme
882 (c++)"unity::scopes::testing::ScopeMetadataBuilder::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
878 (c++)"unity::scopes::testing::ScopeMetadataBuilder::version(unity::scopes::testing::ScopeMetadataBuilder::Optional<int> const&)@Base" 0replaceme883 (c++)"unity::scopes::testing::ScopeMetadataBuilder::version(unity::scopes::testing::ScopeMetadataBuilder::Optional<int> const&)@Base" 0replaceme
879 (c++)"unity::scopes::testing::StudentsTTest::one_sample(unity::scopes::testing::Sample const&, double, double)@Base" 0.4.0+14.04.20140312.1884 (c++)"unity::scopes::testing::StudentsTTest::one_sample(unity::scopes::testing::Sample const&, double, double)@Base" 0.4.0+14.04.20140312.1
880 (c++)"unity::scopes::testing::StudentsTTest::Result::~Result()@Base" 0.4.2+14.04.20140404.2885 (c++)"unity::scopes::testing::StudentsTTest::Result::~Result()@Base" 0.4.2+14.04.20140404.2
881886
=== modified file 'doc/tutorial.dox'
--- doc/tutorial.dox 2014-11-13 03:09:45 +0000
+++ doc/tutorial.dox 2014-11-27 05:38:38 +0000
@@ -1061,6 +1061,7 @@
1061 HotKey =1061 HotKey =
1062 ResultsTtlType = None, Small, Medium, or Large1062 ResultsTtlType = None, Small, Medium, or Large
1063 ChildScopes =1063 ChildScopes =
1064 Tags =
10641065
1065 [Appearance]1066 [Appearance]
1066 ForegroundColor = default text color (defaults to theme-provided foreground color)1067 ForegroundColor = default text color (defaults to theme-provided foreground color)
@@ -1108,6 +1109,10 @@
11081109
1109This list of scopes is translated to the names of children scopes when in the scopes overview page of the Unity Dash.1110This list of scopes is translated to the names of children scopes when in the scopes overview page of the Unity Dash.
11101111
1112The `Tags` key is optional, but we recommend that you use it. Tags are used by aggregators to collect results from scopes of
1113similar type (E.g. The Music scope will aggregate scopes with the tag "music", and so on). The value of `Tags` should specify a
1114list of tags your scope falls under. Like `ChildScopes`, this value must be a semicolon separated list (E.g. `Tags = music;video`).
1115
1111\subsection scopetool The scope tool1116\subsection scopetool The scope tool
11121117
1113The Unity Scope Tool is a stand-alone redering tool that allows you1118The Unity Scope Tool is a stand-alone redering tool that allows you
11141119
=== modified file 'include/unity/scopes/ScopeMetadata.h'
--- include/unity/scopes/ScopeMetadata.h 2014-11-10 03:57:03 +0000
+++ include/unity/scopes/ScopeMetadata.h 2014-11-27 05:38:38 +0000
@@ -203,6 +203,16 @@
203 */203 */
204 int version() const;204 int version() const;
205205
206 /**
207 \brief Return the list of tags specified by this scope.
208
209 The list returned by this method is formulated from the value specified under
210 the "Tags" key in the scope's .ini file.
211
212 \return The list of scope tags specified by this scope.
213 */
214 std::vector<std::string> tags() const;
215
206private:216private:
207 ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl217 ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl
208 std::unique_ptr<internal::ScopeMetadataImpl> p;218 std::unique_ptr<internal::ScopeMetadataImpl> p;
209219
=== modified file 'include/unity/scopes/internal/ScopeConfig.h'
--- include/unity/scopes/internal/ScopeConfig.h 2014-11-10 03:57:03 +0000
+++ include/unity/scopes/internal/ScopeConfig.h 2014-11-27 05:38:38 +0000
@@ -52,8 +52,9 @@
52 int idle_timeout() const; // Optional, returns default value if not present52 int idle_timeout() const; // Optional, returns default value if not present
53 ScopeMetadata::ResultsTtlType results_ttl_type() const; // Optional, returns none if not present53 ScopeMetadata::ResultsTtlType results_ttl_type() const; // Optional, returns none if not present
54 bool debug_mode() const; // Optional, returns false if not present54 bool debug_mode() const; // Optional, returns false if not present
55 std::vector<std::string> child_scope_ids() const;55 std::vector<std::string> child_scope_ids() const; // Optional, returns an empty vector if no ids are present
56 int version() const; // Optional, returns 0 if not present56 int version() const; // Optional, returns 0 if not present
57 std::vector<std::string> tags() const; // Optional, returns an empty vector if no tags are present
5758
58 VariantMap appearance_attributes() const; // Optional, returns empty map if no attributes are present59 VariantMap appearance_attributes() const; // Optional, returns empty map if no attributes are present
5960
@@ -76,6 +77,7 @@
76 bool debug_mode_;77 bool debug_mode_;
77 std::vector<std::string> child_scope_ids_;78 std::vector<std::string> child_scope_ids_;
78 int version_;79 int version_;
80 std::vector<std::string> tags_;
7981
80 VariantMap appearance_attributes_;82 VariantMap appearance_attributes_;
81};83};
8284
=== modified file 'include/unity/scopes/internal/ScopeMetadataImpl.h'
--- include/unity/scopes/internal/ScopeMetadataImpl.h 2014-11-10 03:57:03 +0000
+++ include/unity/scopes/internal/ScopeMetadataImpl.h 2014-11-27 05:38:38 +0000
@@ -59,6 +59,7 @@
59 bool location_data_needed() const; // optional (default: false)59 bool location_data_needed() const; // optional (default: false)
60 std::vector<std::string> child_scope_ids() const; // optional (default: empty array)60 std::vector<std::string> child_scope_ids() const; // optional (default: empty array)
61 int version() const; // optional (default: 0)61 int version() const; // optional (default: 0)
62 std::vector<std::string> tags() const; // optional (default: empty array)
6263
63 void set_scope_id(std::string const& scope_id);64 void set_scope_id(std::string const& scope_id);
64 void set_proxy(ScopeProxy const& proxy);65 void set_proxy(ScopeProxy const& proxy);
@@ -77,6 +78,7 @@
77 void set_location_data_needed(bool location_data_needed);78 void set_location_data_needed(bool location_data_needed);
78 void set_child_scope_ids(std::vector<std::string> const& ids);79 void set_child_scope_ids(std::vector<std::string> const& ids);
79 void set_version(int v);80 void set_version(int v);
81 void set_tags(std::vector<std::string> const& tags);
8082
81 VariantMap serialize() const;83 VariantMap serialize() const;
82 void deserialize(VariantMap const& var);84 void deserialize(VariantMap const& var);
@@ -103,6 +105,7 @@
103 std::unique_ptr<bool> location_data_needed_; // Optional, hence a pointer105 std::unique_ptr<bool> location_data_needed_; // Optional, hence a pointer
104 std::vector<std::string> child_scope_ids_;106 std::vector<std::string> child_scope_ids_;
105 int version_;107 int version_;
108 std::vector<std::string> tags_;
106};109};
107110
108} // namespace internal111} // namespace internal
109112
=== modified file 'include/unity/scopes/internal/smartscopes/SmartScopesClient.h'
--- include/unity/scopes/internal/smartscopes/SmartScopesClient.h 2014-11-19 13:05:49 +0000
+++ include/unity/scopes/internal/smartscopes/SmartScopesClient.h 2014-11-27 05:38:38 +0000
@@ -61,6 +61,7 @@
61 std::shared_ptr<bool> needs_location_data; // optional61 std::shared_ptr<bool> needs_location_data; // optional
62 bool invisible = false;62 bool invisible = false;
63 int version;63 int version;
64 std::vector<std::string> tags; // optional
64};65};
6566
66struct SearchCategory67struct SearchCategory
6768
=== modified file 'include/unity/scopes/testing/ScopeMetadataBuilder.h'
--- include/unity/scopes/testing/ScopeMetadataBuilder.h 2014-11-12 02:15:46 +0000
+++ include/unity/scopes/testing/ScopeMetadataBuilder.h 2014-11-27 05:38:38 +0000
@@ -97,6 +97,7 @@
97 ScopeMetadataBuilder& location_data_needed(Optional<bool> const& value);97 ScopeMetadataBuilder& location_data_needed(Optional<bool> const& value);
98 ScopeMetadataBuilder& child_scope_ids(Optional<std::vector<std::string>> const& value);98 ScopeMetadataBuilder& child_scope_ids(Optional<std::vector<std::string>> const& value);
99 ScopeMetadataBuilder& version(Optional<int> const& value);99 ScopeMetadataBuilder& version(Optional<int> const& value);
100 ScopeMetadataBuilder& tags(Optional<std::vector<std::string>> const& value);
100101
101 ScopeMetadata operator()() const;102 ScopeMetadata operator()() const;
102103
103104
=== modified file 'scoperegistry/scoperegistry.cpp'
--- scoperegistry/scoperegistry.cpp 2014-11-20 03:11:18 +0000
+++ scoperegistry/scoperegistry.cpp 2014-11-27 05:38:38 +0000
@@ -319,6 +319,7 @@
319 mi->set_appearance_attributes(sc.appearance_attributes());319 mi->set_appearance_attributes(sc.appearance_attributes());
320 mi->set_child_scope_ids(sc.child_scope_ids());320 mi->set_child_scope_ids(sc.child_scope_ids());
321 mi->set_version(sc.version());321 mi->set_version(sc.version());
322 mi->set_tags(sc.tags());
322323
323 // Prepend scope_dir to pageheader logo path if logo path is relative.324 // Prepend scope_dir to pageheader logo path if logo path is relative.
324 // TODO: Once we have type-safe parsing in the config files, remove325 // TODO: Once we have type-safe parsing in the config files, remove
325326
=== modified file 'src/scopes/ScopeMetadata.cpp'
--- src/scopes/ScopeMetadata.cpp 2014-11-10 03:57:03 +0000
+++ src/scopes/ScopeMetadata.cpp 2014-11-27 05:38:38 +0000
@@ -157,6 +157,11 @@
157 return p->version();157 return p->version();
158}158}
159159
160std::vector<std::string> ScopeMetadata::tags() const
161{
162 return p->tags();
163}
164
160//! @endcond165//! @endcond
161166
162} // namespace scopes167} // namespace scopes
163168
=== modified file 'src/scopes/internal/ScopeConfig.cpp'
--- src/scopes/internal/ScopeConfig.cpp 2014-11-10 03:57:03 +0000
+++ src/scopes/internal/ScopeConfig.cpp 2014-11-27 05:38:38 +0000
@@ -58,6 +58,7 @@
58 const string debug_mode_key = "DebugMode";58 const string debug_mode_key = "DebugMode";
59 const string child_scope_ids_key = "ChildScopes";59 const string child_scope_ids_key = "ChildScopes";
60 const string version_key = "Version";60 const string version_key = "Version";
61 const string tags_key = "Tags";
6162
62 const string scope_appearance_group = "Appearance";63 const string scope_appearance_group = "Appearance";
63 const string fg_color_key = "ForegroundColor";64 const string fg_color_key = "ForegroundColor";
@@ -223,6 +224,22 @@
223224
224 try225 try
225 {226 {
227 tags_ = parser()->get_string_array(scope_config_group, tags_key);
228 }
229 catch (LogicException const&)
230 {
231 }
232
233 for (auto const& tag: tags_)
234 {
235 if (tag.empty())
236 {
237 throw_ex("Invalid empty tag string found in \"Tags\" list");
238 }
239 }
240
241 try
242 {
226 debug_mode_ = parser()->get_boolean(scope_config_group, debug_mode_key);243 debug_mode_ = parser()->get_boolean(scope_config_group, debug_mode_key);
227 }244 }
228 catch (LogicException const&)245 catch (LogicException const&)
@@ -444,6 +461,11 @@
444 return version_;461 return version_;
445}462}
446463
464std::vector<std::string> ScopeConfig::tags() const
465{
466 return tags_;
467}
468
447} // namespace internal469} // namespace internal
448470
449} // namespace scopes471} // namespace scopes
450472
=== modified file 'src/scopes/internal/ScopeMetadataImpl.cpp'
--- src/scopes/internal/ScopeMetadataImpl.cpp 2014-11-12 23:16:14 +0000
+++ src/scopes/internal/ScopeMetadataImpl.cpp 2014-11-27 05:38:38 +0000
@@ -61,6 +61,7 @@
61 , results_ttl_type_(other.results_ttl_type_)61 , results_ttl_type_(other.results_ttl_type_)
62 , child_scope_ids_(other.child_scope_ids_)62 , child_scope_ids_(other.child_scope_ids_)
63 , version_(other.version_)63 , version_(other.version_)
64 , tags_(other.tags_)
64{65{
65 if (other.art_)66 if (other.art_)
66 {67 {
@@ -118,6 +119,7 @@
118 location_data_needed_.reset(rhs.location_data_needed_ ? new bool(*rhs.location_data_needed_) : nullptr);119 location_data_needed_.reset(rhs.location_data_needed_ ? new bool(*rhs.location_data_needed_) : nullptr);
119 child_scope_ids_ = rhs.child_scope_ids_;120 child_scope_ids_ = rhs.child_scope_ids_;
120 version_ = rhs.version_;121 version_ = rhs.version_;
122 tags_ = rhs.tags_;
121 }123 }
122 return *this;124 return *this;
123}125}
@@ -239,6 +241,11 @@
239 return version_;241 return version_;
240}242}
241243
244std::vector<std::string> ScopeMetadataImpl::tags() const
245{
246 return tags_;
247}
248
242void ScopeMetadataImpl::set_scope_id(std::string const& scope_id)249void ScopeMetadataImpl::set_scope_id(std::string const& scope_id)
243{250{
244 scope_id_ = scope_id;251 scope_id_ = scope_id;
@@ -328,6 +335,11 @@
328 version_ = v;335 version_ = v;
329}336}
330337
338void ScopeMetadataImpl::set_tags(std::vector<std::string> const& tags)
339{
340 tags_ = tags;
341}
342
331namespace343namespace
332{344{
333345
@@ -413,6 +425,15 @@
413 }425 }
414 var["child_scopes"] = Variant(va);426 var["child_scopes"] = Variant(va);
415 }427 }
428 if (tags_.size())
429 {
430 VariantArray va;
431 for (auto const& tag: tags_)
432 {
433 va.push_back(Variant(tag));
434 }
435 var["tags"] = Variant(va);
436 }
416437
417 return var;438 return var;
418}439}
@@ -557,6 +578,16 @@
557 child_scope_ids_.push_back(v.get_string());578 child_scope_ids_.push_back(v.get_string());
558 }579 }
559 }580 }
581
582 tags_.clear();
583 it = var.find("tags");
584 if (it != var.end())
585 {
586 for (auto const& v: it->second.get_array())
587 {
588 tags_.push_back(v.get_string());
589 }
590 }
560}591}
561592
562ScopeMetadata ScopeMetadataImpl::create(unique_ptr<ScopeMetadataImpl> impl)593ScopeMetadata ScopeMetadataImpl::create(unique_ptr<ScopeMetadataImpl> impl)
563594
=== modified file 'src/scopes/internal/smartscopes/SSRegistryObject.cpp'
--- src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-11-11 05:05:33 +0000
+++ src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-11-27 05:38:38 +0000
@@ -337,6 +337,8 @@
337337
338 metadata->set_version(scope.version);338 metadata->set_version(scope.version);
339339
340 metadata->set_tags(scope.tags);
341
340 ScopeProxy proxy = ScopeImpl::create(middleware_->create_scope_proxy(scope.id, ss_scope_endpoint_),342 ScopeProxy proxy = ScopeImpl::create(middleware_->create_scope_proxy(scope.id, ss_scope_endpoint_),
341 middleware_->runtime(),343 middleware_->runtime(),
342 scope.id);344 scope.id);
343345
=== modified file 'src/scopes/internal/smartscopes/SmartScopesClient.cpp'
--- src/scopes/internal/smartscopes/SmartScopesClient.cpp 2014-11-19 13:05:49 +0000
+++ src/scopes/internal/smartscopes/SmartScopesClient.cpp 2014-11-27 05:38:38 +0000
@@ -284,6 +284,32 @@
284284
285 scope.version = child_node->has_node("version") ? child_node->get_node("version")->as_int() : 0;285 scope.version = child_node->has_node("version") ? child_node->get_node("version")->as_int() : 0;
286286
287 if (child_node->has_node("tags"))
288 {
289 auto node = child_node->get_node("tags");
290 if (node->type() == JsonNodeInterface::NodeType::Array)
291 {
292 auto tags = node->to_variant().get_array();
293 for (auto const& tag : tags)
294 {
295 try
296 {
297 scope.tags.push_back(tag.get_string());
298 }
299 catch (unity::LogicException const& e)
300 {
301 std::cerr << "SmartScopesClient.get_remote_scopes(): Scope: \""
302 << scope.id << "\" returned a non-string tag" << std::endl;
303 }
304 }
305 }
306 else
307 {
308 std::cerr << "SmartScopesClient.get_remote_scopes(): Scope: \""
309 << scope.id << "\" returned an invalid value type for \"tags\"" << std::endl;
310 }
311 }
312
287 remote_scopes.push_back(scope);313 remote_scopes.push_back(scope);
288 }314 }
289 catch (std::exception const& e)315 catch (std::exception const& e)
290316
=== modified file 'src/scopes/testing/ScopeMetadataBuilder.cpp'
--- src/scopes/testing/ScopeMetadataBuilder.cpp 2014-11-12 02:15:46 +0000
+++ src/scopes/testing/ScopeMetadataBuilder.cpp 2014-11-27 05:38:38 +0000
@@ -48,6 +48,7 @@
48 Optional<bool> location_data_needed;48 Optional<bool> location_data_needed;
49 Optional<std::vector<std::string>> child_scope_ids;49 Optional<std::vector<std::string>> child_scope_ids;
50 Optional<int> version;50 Optional<int> version;
51 Optional<std::vector<std::string>> tags;
51};52};
5253
53testing::ScopeMetadataBuilder::ScopeMetadataBuilder() : p(new Private())54testing::ScopeMetadataBuilder::ScopeMetadataBuilder() : p(new Private())
@@ -160,6 +161,12 @@
160 return *this;161 return *this;
161}162}
162163
164testing::ScopeMetadataBuilder& testing::ScopeMetadataBuilder::tags(Optional<std::vector<std::string>> const& value)
165{
166 p->tags = value;
167 return *this;
168}
169
163unity::scopes::ScopeMetadata testing::ScopeMetadataBuilder::operator()() const170unity::scopes::ScopeMetadata testing::ScopeMetadataBuilder::operator()() const
164{171{
165 auto impl = new unity::scopes::internal::ScopeMetadataImpl(Private::invalid_middleware);172 auto impl = new unity::scopes::internal::ScopeMetadataImpl(Private::invalid_middleware);
@@ -193,6 +200,8 @@
193 impl->set_child_scope_ids(*p->child_scope_ids);200 impl->set_child_scope_ids(*p->child_scope_ids);
194 if (p->version)201 if (p->version)
195 impl->set_version(*p->version);202 impl->set_version(*p->version);
203 if (p->tags)
204 impl->set_tags(*p->tags);
196205
197 return unity::scopes::internal::ScopeMetadataImpl::create(206 return unity::scopes::internal::ScopeMetadataImpl::create(
198 std::move(207 std::move(
199208
=== modified file 'test/gtest/scopes/Registry/Registry_test.cpp'
--- test/gtest/scopes/Registry/Registry_test.cpp 2014-11-20 21:33:33 +0000
+++ test/gtest/scopes/Registry/Registry_test.cpp 2014-11-27 05:38:38 +0000
@@ -109,6 +109,11 @@
109 EXPECT_EQ("com.foo.bar", children[0]);109 EXPECT_EQ("com.foo.bar", children[0]);
110 EXPECT_EQ("com.foo.baz", children[1]);110 EXPECT_EQ("com.foo.baz", children[1]);
111 EXPECT_EQ(1, meta.version());111 EXPECT_EQ(1, meta.version());
112 auto tags = meta.tags();
113 EXPECT_EQ(3u, tags.size());
114 EXPECT_EQ("music", tags[0]);
115 EXPECT_EQ("news", tags[1]);
116 EXPECT_EQ("foo", tags[2]);
112117
113 auto attrs = meta.appearance_attributes();118 auto attrs = meta.appearance_attributes();
114 EXPECT_EQ("fg_color", attrs["foreground-color"].get_string());119 EXPECT_EQ("fg_color", attrs["foreground-color"].get_string());
@@ -140,6 +145,7 @@
140 EXPECT_EQ(0, defs.size());145 EXPECT_EQ(0, defs.size());
141 EXPECT_FALSE(meta.location_data_needed());146 EXPECT_FALSE(meta.location_data_needed());
142 EXPECT_EQ(0, meta.child_scope_ids().size());147 EXPECT_EQ(0, meta.child_scope_ids().size());
148 EXPECT_EQ(0, meta.tags().size());
143 EXPECT_EQ(0, meta.version());149 EXPECT_EQ(0, meta.version());
144}150}
145151
146152
=== modified file 'test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in'
--- test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-11-10 03:57:03 +0000
+++ test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-11-27 05:38:38 +0000
@@ -9,6 +9,7 @@
9LocationDataNeeded = true9LocationDataNeeded = true
10ChildScopes = com.foo.bar;com.foo.baz10ChildScopes = com.foo.bar;com.foo.baz
11Version = 111Version = 1
12Tags = music;news;foo
1213
13[Appearance]14[Appearance]
14ForegroundColor = fg_color15ForegroundColor = fg_color
1516
=== modified file 'test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt'
--- test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt 2014-11-10 03:57:03 +0000
+++ test/gtest/scopes/internal/ScopeConfig/CMakeLists.txt 2014-11-27 05:38:38 +0000
@@ -8,6 +8,9 @@
8configure_file(bad_child_ids.ini.in bad_child_ids.ini copyonly)8configure_file(bad_child_ids.ini.in bad_child_ids.ini copyonly)
9configure_file(empty_child_ids.ini.in empty_child_ids.ini copyonly)9configure_file(empty_child_ids.ini.in empty_child_ids.ini copyonly)
10configure_file(single_child_id.ini.in single_child_id.ini copyonly)10configure_file(single_child_id.ini.in single_child_id.ini copyonly)
11configure_file(bad_tags.ini.in bad_tags.ini copyonly)
12configure_file(empty_tags.ini.in empty_tags.ini copyonly)
13configure_file(single_tag.ini.in single_tag.ini copyonly)
1114
12add_definitions(-DCOMPLETE_CONFIG="${CMAKE_CURRENT_BINARY_DIR}/complete_config.ini")15add_definitions(-DCOMPLETE_CONFIG="${CMAKE_CURRENT_BINARY_DIR}/complete_config.ini")
13add_definitions(-DMANDATORY_CONFIG="${CMAKE_CURRENT_BINARY_DIR}/mandatory_config.ini")16add_definitions(-DMANDATORY_CONFIG="${CMAKE_CURRENT_BINARY_DIR}/mandatory_config.ini")
@@ -19,6 +22,9 @@
19add_definitions(-DSINGLE_CHILD_ID="${CMAKE_CURRENT_BINARY_DIR}/single_child_id.ini")22add_definitions(-DSINGLE_CHILD_ID="${CMAKE_CURRENT_BINARY_DIR}/single_child_id.ini")
20add_definitions(-DBAD_TTL="${CMAKE_CURRENT_BINARY_DIR}/bad_ttl.ini")23add_definitions(-DBAD_TTL="${CMAKE_CURRENT_BINARY_DIR}/bad_ttl.ini")
21add_definitions(-DBAD_VERSION="${CMAKE_CURRENT_BINARY_DIR}/bad_version.ini")24add_definitions(-DBAD_VERSION="${CMAKE_CURRENT_BINARY_DIR}/bad_version.ini")
25add_definitions(-DBAD_TAGS="${CMAKE_CURRENT_BINARY_DIR}/bad_tags.ini")
26add_definitions(-DEMPTY_TAGS="${CMAKE_CURRENT_BINARY_DIR}/empty_tags.ini")
27add_definitions(-DSINGLE_TAG="${CMAKE_CURRENT_BINARY_DIR}/single_tag.ini")
2228
23add_executable(ScopeConfig_test ScopeConfig_test.cpp)29add_executable(ScopeConfig_test ScopeConfig_test.cpp)
24target_link_libraries(ScopeConfig_test ${TESTLIBS})30target_link_libraries(ScopeConfig_test ${TESTLIBS})
2531
=== modified file 'test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp'
--- test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp 2014-11-10 03:57:03 +0000
+++ test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp 2014-11-27 05:38:38 +0000
@@ -57,6 +57,11 @@
57 EXPECT_EQ("com.foo.bar2", children[1]);57 EXPECT_EQ("com.foo.bar2", children[1]);
58 EXPECT_EQ("com.foo.boo", children[2]);58 EXPECT_EQ("com.foo.boo", children[2]);
5959
60 auto tags = cfg.tags();
61 EXPECT_EQ(2u, tags.size());
62 EXPECT_EQ("foo", tags[0]);
63 EXPECT_EQ("bar", tags[1]);
64
60 auto attrs = cfg.appearance_attributes();65 auto attrs = cfg.appearance_attributes();
61 EXPECT_EQ(5, attrs.size());66 EXPECT_EQ(5, attrs.size());
62 EXPECT_TRUE(attrs["arbitrary_key"].get_bool());67 EXPECT_TRUE(attrs["arbitrary_key"].get_bool());
@@ -180,6 +185,31 @@
180 }185 }
181}186}
182187
188TEST(ScopeConfig, bad_tags)
189{
190 try
191 {
192 ScopeConfig cfg(BAD_TAGS);
193 }
194 catch(ConfigException const& e)
195 {
196 boost::regex r("unity::scopes::ConfigException: \".*\": Invalid empty tag string found in \"Tags\" list");
197 EXPECT_TRUE(boost::regex_match(e.what(), r));
198 }
199}
200
201TEST(ScopeConfig, empty_tags)
202{
203 ScopeConfig cfg(EMPTY_TAGS);
204 EXPECT_EQ(cfg.tags().size(), 0);
205}
206
207TEST(ScopeConfig, single_tag)
208{
209 ScopeConfig cfg(SINGLE_TAG);
210 EXPECT_EQ(cfg.tags().size(), 1);
211}
212
183class ScopeConfigWithIntl: public ::testing::Test213class ScopeConfigWithIntl: public ::testing::Test
184{214{
185public:215public:
186216
=== added file 'test/gtest/scopes/internal/ScopeConfig/bad_tags.ini.in'
--- test/gtest/scopes/internal/ScopeConfig/bad_tags.ini.in 1970-01-01 00:00:00 +0000
+++ test/gtest/scopes/internal/ScopeConfig/bad_tags.ini.in 2014-11-27 05:38:38 +0000
@@ -0,0 +1,5 @@
1[ScopeConfig]
2DisplayName = Scope name
3Description = Scope description
4Author = Canonical
5Tags = foo;;
06
=== modified file 'test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in'
--- test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in 2014-11-10 03:57:03 +0000
+++ test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in 2014-11-27 05:38:38 +0000
@@ -19,6 +19,7 @@
19DebugMode = true19DebugMode = true
20Version = 120Version = 1
21ChildScopes = com.foo.bar;com.foo.bar2;com.foo.boo21ChildScopes = com.foo.bar;com.foo.bar2;com.foo.boo
22Tags = foo;bar
2223
23[Appearance]24[Appearance]
24arbitrary_key = true25arbitrary_key = true
2526
=== added file 'test/gtest/scopes/internal/ScopeConfig/empty_tags.ini.in'
--- test/gtest/scopes/internal/ScopeConfig/empty_tags.ini.in 1970-01-01 00:00:00 +0000
+++ test/gtest/scopes/internal/ScopeConfig/empty_tags.ini.in 2014-11-27 05:38:38 +0000
@@ -0,0 +1,5 @@
1[ScopeConfig]
2DisplayName = Scope name
3Description = Scope description
4Author = Canonical
5Tags =
06
=== added file 'test/gtest/scopes/internal/ScopeConfig/single_tag.ini.in'
--- test/gtest/scopes/internal/ScopeConfig/single_tag.ini.in 1970-01-01 00:00:00 +0000
+++ test/gtest/scopes/internal/ScopeConfig/single_tag.ini.in 2014-11-27 05:38:38 +0000
@@ -0,0 +1,5 @@
1[ScopeConfig]
2DisplayName = Scope name
3Description = Scope description
4Author = Canonical
5Tags = foo
06
=== modified file 'test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp'
--- test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp 2014-11-10 03:57:03 +0000
+++ test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp 2014-11-27 05:38:38 +0000
@@ -162,6 +162,7 @@
162 mi2->set_settings_definitions(va);162 mi2->set_settings_definitions(va);
163 mi2->set_location_data_needed(true);163 mi2->set_location_data_needed(true);
164 mi2->set_child_scope_ids(vector<string>{"abc", "def"});164 mi2->set_child_scope_ids(vector<string>{"abc", "def"});
165 mi2->set_tags(vector<string>{"music", "video", "news"});
165166
166 // Make another copy, so we get coverage on the entire copy constructor167 // Make another copy, so we get coverage on the entire copy constructor
167 unique_ptr<ScopeMetadataImpl> mi3(new ScopeMetadataImpl(*mi2));168 unique_ptr<ScopeMetadataImpl> mi3(new ScopeMetadataImpl(*mi2));
@@ -175,6 +176,7 @@
175 EXPECT_EQ(va, m.settings_definitions());176 EXPECT_EQ(va, m.settings_definitions());
176 EXPECT_TRUE(m.location_data_needed());177 EXPECT_TRUE(m.location_data_needed());
177 EXPECT_EQ((vector<string>{"abc", "def"}), m.child_scope_ids());178 EXPECT_EQ((vector<string>{"abc", "def"}), m.child_scope_ids());
179 EXPECT_EQ((vector<string>{"music", "video", "news"}), m.tags());
178180
179 // Make another value181 // Make another value
180 unique_ptr<ScopeMetadataImpl> ti(new ScopeMetadataImpl(&mw));182 unique_ptr<ScopeMetadataImpl> ti(new ScopeMetadataImpl(&mw));
@@ -198,6 +200,7 @@
198 ti->set_settings_definitions(tmp_va);200 ti->set_settings_definitions(tmp_va);
199 ti->set_location_data_needed(true);201 ti->set_location_data_needed(true);
200 ti->set_child_scope_ids(vector<string>{"tmp abc", "tmp def"});202 ti->set_child_scope_ids(vector<string>{"tmp abc", "tmp def"});
203 ti->set_tags(vector<string>{"music", "video"});
201204
202 // Check impl assignment operator205 // Check impl assignment operator
203 ScopeMetadataImpl ci(&mw);206 ScopeMetadataImpl ci(&mw);
@@ -220,6 +223,7 @@
220 EXPECT_TRUE(ci.location_data_needed());223 EXPECT_TRUE(ci.location_data_needed());
221 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), ci.child_scope_ids());224 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), ci.child_scope_ids());
222 EXPECT_EQ(99, ci.version());225 EXPECT_EQ(99, ci.version());
226 EXPECT_EQ((vector<string>{"music", "video"}), ci.tags());
223227
224 // Check public assignment operator228 // Check public assignment operator
225 auto tmp = ScopeMetadataImpl::create(move(ti));229 auto tmp = ScopeMetadataImpl::create(move(ti));
@@ -242,6 +246,7 @@
242 EXPECT_EQ(tmp_va, m.settings_definitions());246 EXPECT_EQ(tmp_va, m.settings_definitions());
243 EXPECT_TRUE(m.location_data_needed());247 EXPECT_TRUE(m.location_data_needed());
244 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), m.child_scope_ids());248 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), m.child_scope_ids());
249 EXPECT_EQ((vector<string>{"music", "video"}), m.tags());
245250
246 // Self-assignment251 // Self-assignment
247 tmp = tmp;252 tmp = tmp;
@@ -263,6 +268,7 @@
263 EXPECT_EQ(tmp_va, tmp.settings_definitions());268 EXPECT_EQ(tmp_va, tmp.settings_definitions());
264 EXPECT_TRUE(tmp.location_data_needed());269 EXPECT_TRUE(tmp.location_data_needed());
265 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp.child_scope_ids());270 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp.child_scope_ids());
271 EXPECT_EQ((vector<string>{"music", "video"}), tmp.tags());
266272
267 // Copy constructor273 // Copy constructor
268 ScopeMetadata tmp2(tmp);274 ScopeMetadata tmp2(tmp);
@@ -284,6 +290,7 @@
284 EXPECT_EQ(tmp_va, tmp2.settings_definitions());290 EXPECT_EQ(tmp_va, tmp2.settings_definitions());
285 EXPECT_TRUE(tmp2.location_data_needed());291 EXPECT_TRUE(tmp2.location_data_needed());
286 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp2.child_scope_ids());292 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp2.child_scope_ids());
293 EXPECT_EQ((vector<string>{"music", "video"}), tmp2.tags());
287}294}
288295
289TEST(ScopeMetadataImpl, serialize)296TEST(ScopeMetadataImpl, serialize)
@@ -315,11 +322,12 @@
315 mi->set_settings_definitions(va);322 mi->set_settings_definitions(va);
316 mi->set_location_data_needed(false);323 mi->set_location_data_needed(false);
317 mi->set_child_scope_ids({"com.foo.bar", "com.foo.baz"});324 mi->set_child_scope_ids({"com.foo.bar", "com.foo.baz"});
325 mi->set_tags({"news", "games"});
318326
319 // Check that serialize() sets the map values correctly327 // Check that serialize() sets the map values correctly
320 auto m = ScopeMetadataImpl::create(move(mi));328 auto m = ScopeMetadataImpl::create(move(mi));
321 auto var = m.serialize();329 auto var = m.serialize();
322 EXPECT_EQ(17u, var.size());330 EXPECT_EQ(18u, var.size());
323 EXPECT_EQ("scope_id", var["scope_id"].get_string());331 EXPECT_EQ("scope_id", var["scope_id"].get_string());
324 EXPECT_EQ("display_name", var["display_name"].get_string());332 EXPECT_EQ("display_name", var["display_name"].get_string());
325 EXPECT_EQ("description", var["description"].get_string());333 EXPECT_EQ("description", var["description"].get_string());
@@ -340,6 +348,9 @@
340 EXPECT_EQ(2u, var["child_scopes"].get_array().size());348 EXPECT_EQ(2u, var["child_scopes"].get_array().size());
341 EXPECT_EQ("com.foo.bar", var["child_scopes"].get_array()[0].get_string());349 EXPECT_EQ("com.foo.bar", var["child_scopes"].get_array()[0].get_string());
342 EXPECT_EQ("com.foo.baz", var["child_scopes"].get_array()[1].get_string());350 EXPECT_EQ("com.foo.baz", var["child_scopes"].get_array()[1].get_string());
351 EXPECT_EQ(2u, var["tags"].get_array().size());
352 EXPECT_EQ("news", var["tags"].get_array()[0].get_string());
353 EXPECT_EQ("games", var["tags"].get_array()[1].get_string());
343354
344 // Make another instance from the VariantMap and check its fields355 // Make another instance from the VariantMap and check its fields
345 ScopeMetadataImpl c(var, &mw);356 ScopeMetadataImpl c(var, &mw);
346357
=== modified file 'test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py'
--- test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py 2014-11-11 05:05:33 +0000
+++ test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py 2014-11-27 05:38:38 +0000
@@ -88,7 +88,7 @@
88\88\
89{"id" : "fail.scope.3", "name": "Fail Scope 3", "description": "Fails due to no base_url.", "author": "Mr.Fake", "art": "art" },\89{"id" : "fail.scope.3", "name": "Fail Scope 3", "description": "Fails due to no base_url.", "author": "Mr.Fake", "art": "art" },\
90\90\
91{"base_url": "http://127.0.0.1:' + str(port) + '/demo3", "id" : "dummy.scope.3", "name": "Dummy Demo Scope 3", "description": "Dummy demo scope 3.", "author": "Mr.Fake",\91{"base_url": "http://127.0.0.1:' + str(port) + '/demo3", "id" : "dummy.scope.3", "name": "Dummy Demo Scope 3", "description": "Dummy demo scope 3.", "author": "Mr.Fake", "tags": ["music", "video", "news", "games"],\
92"settings":\92"settings":\
93 [\93 [\
94 {\94 {\
9595
=== modified file 'test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp'
--- test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp 2014-11-19 13:05:49 +0000
+++ test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp 2014-11-27 05:38:38 +0000
@@ -85,6 +85,7 @@
85 EXPECT_EQ(0, scopes[0].version);85 EXPECT_EQ(0, scopes[0].version);
86 EXPECT_EQ(nullptr, scopes[0].appearance);86 EXPECT_EQ(nullptr, scopes[0].appearance);
87 EXPECT_EQ(nullptr, scopes[0].settings);87 EXPECT_EQ(nullptr, scopes[0].settings);
88 EXPECT_TRUE(scopes[0].tags.empty());
8889
89 EXPECT_EQ("dummy.scope.2", scopes[1].id);90 EXPECT_EQ("dummy.scope.2", scopes[1].id);
90 EXPECT_EQ("Dummy Demo Scope 2", scopes[1].name);91 EXPECT_EQ("Dummy Demo Scope 2", scopes[1].name);
@@ -98,6 +99,7 @@
98 EXPECT_EQ("#00BEEF", (*scopes[1].appearance)["background"].get_string());99 EXPECT_EQ("#00BEEF", (*scopes[1].appearance)["background"].get_string());
99 EXPECT_EQ("logo.png", (*scopes[1].appearance)["PageHeader"].get_dict()["logo"].get_string());100 EXPECT_EQ("logo.png", (*scopes[1].appearance)["PageHeader"].get_dict()["logo"].get_string());
100 EXPECT_EQ(nullptr, scopes[1].settings);101 EXPECT_EQ(nullptr, scopes[1].settings);
102 EXPECT_TRUE(scopes[1].tags.empty());
101103
102 EXPECT_EQ("dummy.scope.3", scopes[2].id);104 EXPECT_EQ("dummy.scope.3", scopes[2].id);
103 EXPECT_EQ("Dummy Demo Scope 3", scopes[2].name);105 EXPECT_EQ("Dummy Demo Scope 3", scopes[2].name);
@@ -115,6 +117,11 @@
115 "\"defaultValue\":23},\"type\":\"number\"},{\"displayName\":\"Enabled\",\"id\":"117 "\"defaultValue\":23},\"type\":\"number\"},{\"displayName\":\"Enabled\",\"id\":"
116 "\"enabled\",\"parameters\":{\"defaultValue\":true},\"type\":\"boolean\"}]\n",118 "\"enabled\",\"parameters\":{\"defaultValue\":true},\"type\":\"boolean\"}]\n",
117 *scopes[2].settings);119 *scopes[2].settings);
120 ASSERT_EQ(4, scopes[2].tags.size());
121 EXPECT_EQ("music", scopes[2].tags[0]);
122 EXPECT_EQ("video", scopes[2].tags[1]);
123 EXPECT_EQ("news", scopes[2].tags[2]);
124 EXPECT_EQ("games", scopes[2].tags[3]);
118}125}
119126
120TEST_F(SmartScopesClientTest, search)127TEST_F(SmartScopesClientTest, search)
121128
=== modified file 'test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp'
--- test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp 2014-11-20 03:11:18 +0000
+++ test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp 2014-11-27 05:38:38 +0000
@@ -140,6 +140,11 @@
140 EXPECT_EQ(2, meta.settings_definitions()[1].get_dict()["displayValues"].get_array().size());140 EXPECT_EQ(2, meta.settings_definitions()[1].get_dict()["displayValues"].get_array().size());
141 EXPECT_EQ("Celsius", meta.settings_definitions()[1].get_dict()["displayValues"].get_array()[0].get_string());141 EXPECT_EQ("Celsius", meta.settings_definitions()[1].get_dict()["displayValues"].get_array()[0].get_string());
142 EXPECT_EQ("Fahrenheit", meta.settings_definitions()[1].get_dict()["displayValues"].get_array()[1].get_string());142 EXPECT_EQ("Fahrenheit", meta.settings_definitions()[1].get_dict()["displayValues"].get_array()[1].get_string());
143 ASSERT_EQ(4, meta.tags().size());
144 EXPECT_EQ("music", meta.tags()[0]);
145 EXPECT_EQ("video", meta.tags()[1]);
146 EXPECT_EQ("news", meta.tags()[2]);
147 EXPECT_EQ("games", meta.tags()[3]);
143 }148 }
144149
145 // non-existent scope (via mw)150 // non-existent scope (via mw)

Subscribers

People subscribed via source and target branches

to all changes: