Merge lp:~stolowski/unity-scopes-api/remote-scopes-appearance into lp:unity-scopes-api/devel

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michi Henning
Approved revision: 344
Merged at revision: 343
Proposed branch: lp:~stolowski/unity-scopes-api/remote-scopes-appearance
Merge into: lp:unity-scopes-api/devel
Diff against target: 130 lines (+23/-8)
8 files modified
CMakeLists.txt (+1/-1)
debian/changelog (+3/-2)
demo/client.cpp (+5/-4)
include/unity/scopes/internal/smartscopes/SmartScopesClient.h (+1/-0)
src/scopes/internal/smartscopes/SSRegistryObject.cpp (+5/-0)
src/scopes/internal/smartscopes/SmartScopesClient.cpp (+5/-0)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py (+1/-1)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp (+2/-0)
To merge this branch: bzr merge lp:~stolowski/unity-scopes-api/remote-scopes-appearance
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Marcus Tomlinson (community) Approve
Review via email: mp+219869@code.launchpad.net

Commit message

Handle "appearance" dictionary returned by remote-scopes call and make it available via ScopeMetadata::appearance_attributes().

Description of the change

Handle "appearance" dictionary returned by remote-scopes call and make it available via ScopeMetadata::appearance_attributes(). This makes it available to scope-scopes, so that it can get rid of the hardcoded values.

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

This looks good, just one very small niggle:

In SmartScopesClient_test.cpp could you add this to the parameter checks for scopes[0]:
"EXPECT_EQ(nullptr, scopes[0].appearance);"

Otherwise, I'm happy.

review: Needs Fixing
344. By Paweł Stołowski

Minor test adjustment.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

> This looks good, just one very small niggle:
>
> In SmartScopesClient_test.cpp could you add this to the parameter checks for
> scopes[0]:
> "EXPECT_EQ(nullptr, scopes[0].appearance);"
>
> Otherwise, I'm happy.

Added.

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Cool, thanks man

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

Cool, thank you!

review: Approve

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 2014-05-15 08:17:57 +0000
3+++ CMakeLists.txt 2014-05-19 15:04:44 +0000
4@@ -179,7 +179,7 @@
5 # API version
6 set(UNITY_SCOPES_MAJOR 0)
7 set(UNITY_SCOPES_MINOR 4)
8-set(UNITY_SCOPES_MICRO 6)
9+set(UNITY_SCOPES_MICRO 7)
10
11 # Version for testing, with all symbols visible
12 set(UNITY_SCOPES_TEST_LIB ${UNITY_SCOPES_LIB}-test)
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2014-05-15 10:34:30 +0000
16+++ debian/changelog 2014-05-19 15:04:44 +0000
17@@ -1,4 +1,4 @@
18-unity-scopes-api (0.4.6-0ubuntu1) UNRELEASED; urgency=medium
19+unity-scopes-api (0.4.7-0ubuntu1) UNRELEASED; urgency=medium
20
21 [ Pete Woods ]
22 * Add results TTL option to configuration files.
23@@ -6,8 +6,9 @@
24 [ Pawel Stolowski ]
25 * Added method to get and set display hints for filters.
26 * Added has_subdepartments flag and alternate label to the Department class.
27+ * Fixed lp:1319712: Appearance attributes not supported for remote scopes.
28
29- -- Pawel Stolowski <pawel.stolowski@ubuntu.com> Thu, 15 May 2014 10:16:39 +0200
30+ -- Pawel Stolowski <pawel.stolowski@ubuntu.com> Fri, 16 May 2014 17:48:23 +0200
31
32 unity-scopes-api (0.4.5+14.10.20140513-0ubuntu1) utopic; urgency=low
33
34
35=== modified file 'demo/client.cpp'
36--- demo/client.cpp 2014-04-29 13:51:44 +0000
37+++ demo/client.cpp 2014-05-19 15:04:44 +0000
38@@ -422,10 +422,11 @@
39 }
40
41 auto meta = r->get_metadata(scope_id);
42- cout << "Scope metadata: " << endl;
43- cout << "\tscope_id: " << meta.scope_id() << endl;
44- cout << "\tdisplay_name: " << meta.display_name() << endl;
45- cout << "\tdescription: " << meta.description() << endl;
46+ cout << "Scope metadata: " << endl;
47+ cout << "\tscope_id: " << meta.scope_id() << endl;
48+ cout << "\tdisplay_name: " << meta.display_name() << endl;
49+ cout << "\tdescription: " << meta.description() << endl;
50+ cout << "\tappearance attr: " << to_string(Variant(meta.appearance_attributes())) << endl;
51 string tmp;
52 try
53 {
54
55=== modified file 'include/unity/scopes/internal/smartscopes/SmartScopesClient.h'
56--- include/unity/scopes/internal/smartscopes/SmartScopesClient.h 2014-03-24 10:15:20 +0000
57+++ include/unity/scopes/internal/smartscopes/SmartScopesClient.h 2014-05-19 15:04:44 +0000
58@@ -54,6 +54,7 @@
59 std::string base_url;
60 std::shared_ptr<std::string> icon; // optional
61 std::shared_ptr<std::string> art; // optional
62+ std::shared_ptr<VariantMap> appearance; // optional
63 bool invisible = false;
64 };
65
66
67=== modified file 'src/scopes/internal/smartscopes/SSRegistryObject.cpp'
68--- src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-05-09 08:20:57 +0000
69+++ src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-05-19 15:04:44 +0000
70@@ -232,6 +232,11 @@
71 metadata->set_art(*scope.art);
72 }
73
74+ if (scope.appearance)
75+ {
76+ metadata->set_appearance_attributes(*scope.appearance);
77+ }
78+
79 metadata->set_invisible(scope.invisible);
80
81 ScopeProxy proxy = ScopeImpl::create(middleware_->create_scope_proxy(scope.id, ss_scope_endpoint_),
82
83=== modified file 'src/scopes/internal/smartscopes/SmartScopesClient.cpp'
84--- src/scopes/internal/smartscopes/SmartScopesClient.cpp 2014-05-09 09:56:09 +0000
85+++ src/scopes/internal/smartscopes/SmartScopesClient.cpp 2014-05-19 15:04:44 +0000
86@@ -259,6 +259,11 @@
87 scope.art.reset(new std::string(child_node->get_node("art")->as_string()));
88 }
89
90+ if (child_node->has_node("appearance"))
91+ {
92+ scope.appearance.reset(new VariantMap(child_node->get_node("appearance")->to_variant().get_dict()));
93+ }
94+
95 scope.invisible = child_node->has_node("invisible") ? child_node->get_node("invisible")->as_bool() : false;
96
97 remote_scopes.push_back(scope);
98
99=== modified file 'test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py'
100--- test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py 2014-05-09 09:56:09 +0000
101+++ test/gtest/scopes/internal/smartscopes/SmartScopesClient/FakeSss.py 2014-05-19 15:04:44 +0000
102@@ -60,7 +60,7 @@
103 [{"base_url": "http://127.0.0.1:' + str(port) + '/fail", "id" : "fail.scope", "name": "Fail Scope", "description": "Fails due to no author.", "icon": "icon" },\
104 {"base_url": "http://127.0.0.1:' + str(port) + '/demo", "id" : "dummy.scope", "name": "Dummy Demo Scope", "description": "Dummy demo scope.", "author": "Mr.Fake", "icon": "icon" },\
105 {"base_url": "http://127.0.0.1:' + str(port) + '/fail2", "name": "Fail Scope 2", "description": "Fails due to no id.", "author": "Mr.Fake", "icon": "icon" },\
106-{"base_url": "http://127.0.0.1:' + str(port) + '/demo2", "id" : "dummy.scope.2", "name": "Dummy Demo Scope 2", "description": "Dummy demo scope 2.", "author": "Mr.Fake", "art": "art", "invisible": true },\
107+{"base_url": "http://127.0.0.1:' + str(port) + '/demo2", "id" : "dummy.scope.2", "name": "Dummy Demo Scope 2", "description": "Dummy demo scope 2.", "author": "Mr.Fake", "art": "art", "invisible": true, "appearance": {"background": "#00BEEF"} },\
108 {"id" : "fail.scope.3", "name": "Fail Scope 3", "description": "Fails due to no base_url.", "author": "Mr.Fake", "art": "art" }]'
109
110 search_response = '\
111
112=== modified file 'test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp'
113--- test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp 2014-05-09 09:56:09 +0000
114+++ test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp 2014-05-19 15:04:44 +0000
115@@ -81,6 +81,7 @@
116 EXPECT_EQ("icon", *scopes[0].icon);
117 EXPECT_EQ(nullptr, scopes[0].art);
118 EXPECT_FALSE(scopes[0].invisible);
119+ EXPECT_EQ(nullptr, scopes[0].appearance);
120
121 EXPECT_EQ("dummy.scope.2", scopes[1].id);
122 EXPECT_EQ("Dummy Demo Scope 2", scopes[1].name);
123@@ -90,6 +91,7 @@
124 EXPECT_EQ(nullptr, scopes[1].icon);
125 EXPECT_EQ("art", *scopes[1].art);
126 EXPECT_TRUE(scopes[1].invisible);
127+ EXPECT_EQ("#00BEEF", (*scopes[1].appearance)["background"].get_string());
128 }
129
130 TEST_F(SmartScopesClientTest, search)

Subscribers

People subscribed via source and target branches

to all changes: