Merge lp:~ken-vandine/content-hub/events_type into lp:content-hub

Proposed by Ken VanDine on 2015-06-29
Status: Merged
Approved by: Michael Sheldon on 2015-07-01
Approved revision: 224
Merged at revision: 225
Proposed branch: lp:~ken-vandine/content-hub/events_type
Merge into: lp:content-hub
Diff against target: 233 lines (+101/-2)
9 files modified
import/Ubuntu/Content/contentpeermodel.cpp (+1/-0)
import/Ubuntu/Content/contenttype.cpp (+3/-0)
import/Ubuntu/Content/contenttype.h (+2/-1)
include/com/ubuntu/content/type.h (+1/-0)
src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml (+12/-0)
src/com/ubuntu/content/service/hook.cpp (+1/-1)
src/com/ubuntu/content/type.cpp (+6/-0)
tests/acceptance-tests/CMakeLists.txt (+7/-0)
tests/acceptance-tests/test_types.cpp (+68/-0)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/events_type
Reviewer Review Type Date Requested Status
Michael Sheldon (community) 2015-06-29 Approve on 2015-07-01
PS Jenkins bot continuous-integration Approve on 2015-07-01
Review via email: mp+263243@code.launchpad.net

Commit Message

* Added ContentType.Events
* Added tests for the well known types

Description of the Change

Added ContentType.Events

To post a comment you must log in.
Ken VanDine (ken-vandine) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * No change

223. By Ken VanDine on 2015-06-29

merged trunk

Michael Sheldon (michael-sheldon) wrote :

I think the copyright on the new file should be 2015 (highlighted with inline diff comment)

224. By Ken VanDine on 2015-07-01

fixed copyright date in new file

Michael Sheldon (michael-sheldon) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes (ran test plan minus gmail test which fails due to bug #1466892, and modified hub-importer & hub-exporter to send fake Events)

Did CI run pass? If not, please explain why.

 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'import/Ubuntu/Content/contentpeermodel.cpp'
2--- import/Ubuntu/Content/contentpeermodel.cpp 2015-06-15 13:51:39 +0000
3+++ import/Ubuntu/Content/contentpeermodel.cpp 2015-07-01 13:49:38 +0000
4@@ -104,6 +104,7 @@
5 appendPeersForContentType(ContentType::Links);
6 appendPeersForContentType(ContentType::EBooks);
7 appendPeersForContentType(ContentType::Text);
8+ appendPeersForContentType(ContentType::Events);
9 appendPeersForContentType(ContentType::Unknown);
10 } else {
11 appendPeersForContentType(m_contentType);
12
13=== modified file 'import/Ubuntu/Content/contenttype.cpp'
14--- import/Ubuntu/Content/contenttype.cpp 2015-06-10 13:54:03 +0000
15+++ import/Ubuntu/Content/contenttype.cpp 2015-07-01 13:49:38 +0000
16@@ -101,6 +101,7 @@
17 case Links: return cuc::Type::Known::links();
18 case EBooks: return cuc::Type::Known::ebooks();
19 case Text: return cuc::Type::Known::text();
20+ case Events: return cuc::Type::Known::events();
21 default: return cuc::Type::unknown();
22 }
23 }
24@@ -128,6 +129,8 @@
25 return EBooks;
26 else if (type == cuc::Type::Known::text().id())
27 return Text;
28+ else if (type == cuc::Type::Known::events().id())
29+ return Events;
30 else
31 return Unknown;
32 }
33
34=== modified file 'import/Ubuntu/Content/contenttype.h'
35--- import/Ubuntu/Content/contenttype.h 2015-03-10 19:32:07 +0000
36+++ import/Ubuntu/Content/contenttype.h 2015-07-01 13:49:38 +0000
37@@ -38,7 +38,8 @@
38 Videos = 5,
39 Links = 6,
40 EBooks = 7,
41- Text = 8
42+ Text = 8,
43+ Events = 9
44 };
45
46 ContentType(QObject *parent = nullptr);
47
48=== modified file 'include/com/ubuntu/content/type.h'
49--- include/com/ubuntu/content/type.h 2015-06-15 17:29:43 +0000
50+++ include/com/ubuntu/content/type.h 2015-07-01 13:49:38 +0000
51@@ -51,6 +51,7 @@
52 static const Type& links();
53 static const Type& ebooks();
54 static const Type& text();
55+ static const Type& events();
56 };
57
58 virtual ~Type();
59
60=== modified file 'src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml'
61--- src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml 2015-06-08 13:39:51 +0000
62+++ src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml 2015-07-01 13:49:38 +0000
63@@ -25,6 +25,9 @@
64 <key name="text" type="as">
65 <default>[]</default>
66 </key>
67+ <key name="events" type="as">
68+ <default>[]</default>
69+ </key>
70 </schema>
71 <schema id="com.ubuntu.content.hub.source" path="/com/ubuntu/content/hub/source/">
72 <key name="all" type="as">
73@@ -54,6 +57,9 @@
74 <key name="text" type="as">
75 <default>[]</default>
76 </key>
77+ <key name="events" type="as">
78+ <default>[]</default>
79+ </key>
80 </schema>
81 <schema id="com.ubuntu.content.hub.destination" path="/com/ubuntu/content/hub/destination/">
82 <key name="all" type="as">
83@@ -83,6 +89,9 @@
84 <key name="text" type="as">
85 <default>[]</default>
86 </key>
87+ <key name="events" type="as">
88+ <default>[]</default>
89+ </key>
90 </schema>
91 <schema id="com.ubuntu.content.hub.share" path="/com/ubuntu/content/hub/share/">
92 <key name="pictures" type="as">
93@@ -109,5 +118,8 @@
94 <key name="text" type="as">
95 <default>[]</default>
96 </key>
97+ <key name="events" type="as">
98+ <default>[]</default>
99+ </key>
100 </schema>
101 </schemalist>
102
103=== modified file 'src/com/ubuntu/content/service/hook.cpp'
104--- src/com/ubuntu/content/service/hook.cpp 2015-06-08 13:39:51 +0000
105+++ src/com/ubuntu/content/service/hook.cpp 2015-07-01 13:49:38 +0000
106@@ -126,7 +126,7 @@
107 TRACE() << Q_FUNC_INFO << "Hook:" << result.filePath();
108
109 QStringList knownTypes;
110- knownTypes << "all" << "pictures" << "music" << "contacts" << "documents" << "videos" << "links" << "ebooks" << "text";
111+ knownTypes << "all" << "pictures" << "music" << "contacts" << "documents" << "videos" << "links" << "ebooks" << "text" << "events";
112 QString app_id = result.fileName();
113 auto peer = cuc::Peer(app_id);
114
115
116=== modified file 'src/com/ubuntu/content/type.cpp'
117--- src/com/ubuntu/content/type.cpp 2015-06-15 17:29:43 +0000
118+++ src/com/ubuntu/content/type.cpp 2015-07-01 13:49:38 +0000
119@@ -130,3 +130,9 @@
120 static cuc::Type t("text", nullptr);
121 return t;
122 }
123+
124+const cuc::Type& cuc::Type::Known::events()
125+{
126+ static cuc::Type t("events", nullptr);
127+ return t;
128+}
129
130=== modified file 'tests/acceptance-tests/CMakeLists.txt'
131--- tests/acceptance-tests/CMakeLists.txt 2015-06-08 13:39:51 +0000
132+++ tests/acceptance-tests/CMakeLists.txt 2015-07-01 13:49:38 +0000
133@@ -53,6 +53,11 @@
134 )
135
136 add_executable(
137+ test_types
138+ test_types.cpp
139+)
140+
141+add_executable(
142 test_hook
143 test_hook.cpp
144 ${MOCS}
145@@ -78,6 +83,7 @@
146 target_link_libraries(app_hub_communication_transfer content-hub gmock gtest gtest_main)
147 target_link_libraries(app_hub_communication_handler content-hub gmock gtest gtest_main)
148 target_link_libraries(test_utils content-hub gmock gtest gtest_main)
149+target_link_libraries(test_types content-hub gmock gtest gtest_main)
150 target_link_libraries(test_hook content-hub gmock gtest gtest_main ${GSETTINGS_LDFLAGS})
151
152 add_test(app_hub_communication_default_source app_hub_communication_default_source)
153@@ -86,6 +92,7 @@
154 add_test(app_hub_communication_transfer app_hub_communication_transfer)
155 add_test(app_hub_communication_handler app_hub_communication_handler)
156 add_test(test_utils test_utils)
157+add_test(test_types test_types)
158 add_test(test_hook test_hook)
159
160 set_target_properties(
161
162=== added file 'tests/acceptance-tests/test_types.cpp'
163--- tests/acceptance-tests/test_types.cpp 1970-01-01 00:00:00 +0000
164+++ tests/acceptance-tests/test_types.cpp 2015-07-01 13:49:38 +0000
165@@ -0,0 +1,68 @@
166+/*
167+ * Copyright © 2015 Canonical Ltd.
168+ *
169+ * This program is free software: you can redistribute it and/or modify
170+ * it under the terms of the GNU General Public License version 3 as
171+ * published by the Free Software Foundation.
172+ *
173+ * This program is distributed in the hope that it will be useful,
174+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
175+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
176+ * GNU Lesser General Public License for more details.
177+ *
178+ * You should have received a copy of the GNU Lesser General Public License
179+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
180+ *
181+ * Authored by: Ken VanDine <ken.vandine@canonical.com>
182+ */
183+
184+#include <com/ubuntu/content/type.h>
185+
186+#include <gtest/gtest.h>
187+
188+namespace cuc = com::ubuntu::content;
189+
190+TEST(Types, id_documents)
191+{
192+ EXPECT_EQ(cuc::Type::Known::documents().id(), "documents");
193+}
194+
195+TEST(Types, id_pictures)
196+{
197+ EXPECT_EQ(cuc::Type::Known::pictures().id(), "pictures");
198+}
199+
200+TEST(Types, id_music)
201+{
202+ EXPECT_EQ(cuc::Type::Known::music().id(), "music");
203+}
204+
205+TEST(Types, id_contacts)
206+{
207+ EXPECT_EQ(cuc::Type::Known::contacts().id(), "contacts");
208+}
209+
210+TEST(Types, id_videos)
211+{
212+ EXPECT_EQ(cuc::Type::Known::videos().id(), "videos");
213+}
214+
215+TEST(Types, id_links)
216+{
217+ EXPECT_EQ(cuc::Type::Known::links().id(), "links");
218+}
219+
220+TEST(Types, id_ebooks)
221+{
222+ EXPECT_EQ(cuc::Type::Known::ebooks().id(), "ebooks");
223+}
224+
225+TEST(Types, id_text)
226+{
227+ EXPECT_EQ(cuc::Type::Known::text().id(), "text");
228+}
229+
230+TEST(Types, id_events)
231+{
232+ EXPECT_EQ(cuc::Type::Known::events().id(), "events");
233+}

Subscribers

People subscribed via source and target branches