Merge lp:~mterry/qtmir/no-touch-no-lifecycle into lp:qtmir

Proposed by Michael Terry on 2015-09-29
Status: Merged
Approved by: Gerry Boland on 2015-11-04
Approved revision: 394
Merged at revision: 400
Proposed branch: lp:~mterry/qtmir/no-touch-no-lifecycle
Merge into: lp:qtmir
Diff against target: 527 lines (+56/-165)
15 files modified
CMakeLists.txt (+1/-1)
debian/control (+2/-2)
src/modules/Unity/Application/application.cpp (+7/-25)
src/modules/Unity/Application/application.h (+1/-3)
src/modules/Unity/Application/application_manager.cpp (+2/-12)
src/modules/Unity/Application/application_manager.h (+1/-2)
src/modules/Unity/Application/com.canonical.qtmir.gschema.xml (+2/-0)
src/modules/Unity/Application/desktopfilereader.cpp (+12/-0)
src/modules/Unity/Application/desktopfilereader.h (+1/-0)
tests/modules/Application/application_test.cpp (+16/-0)
tests/modules/ApplicationManager/application_manager_test.cpp (+0/-117)
tests/modules/DesktopFileReader/desktopfilereader_test.cpp (+3/-0)
tests/modules/common/fake_desktopfilereader.h (+1/-0)
tests/modules/common/mock_desktop_file_reader.h (+7/-0)
tests/modules/common/qtmir_test.cpp (+0/-3)
To merge this branch: bzr merge lp:~mterry/qtmir/no-touch-no-lifecycle
Reviewer Review Type Date Requested Status
Gerry Boland 2015-09-29 Approve on 2015-11-04
PS Jenkins bot (community) continuous-integration Needs Fixing on 2015-10-30
Review via email: mp+272791@code.launchpad.net

Commit message

Support new isTouchApp property to ApplicationInfoInterface and move lifecycle policy logic out of qtmir.

Now that qtmir won't decide policy for suspending anymore, we don't need all the lifecycleException handling in qtmir either. That can move to unity8.

But since the GSettings key for that was registered under the qtmir namespace (and there's no technical reason to migrate settings), I left the schema and classes dealing with GSettings alone, for future use.

Description of the change

Support new isTouchApp property to ApplicationInfoInterface and move lifecycle policy logic out of qtmir.

Now that qtmir won't decide policy for suspending anymore, we don't need all the lifecycleException handling in qtmir either. That can move to unity8.

But since the GSettings key for that was registered under the qtmir namespace (and there's no technical reason to migrate settings), I left the schema and classes dealing with GSettings alone, for future use.

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 https://code.launchpad.net/~mterry/unity-api/no-touch-no-lifecycle/+merge/272829
 https://code.launchpad.net/~mterry/unity8/no-touch-no-lifecycle/+merge/272844

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 I'm on that team

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

I dislike the API you've added. The requestedState property is what shell uses to set a process to be suspended or not. It is confusing for shell to request a suspended state in one place, and in another place disallow suspending. Shell should just make the correct request first time.

Sure we've had this lifecycle exceptions policy in qtmir, but as you've moved that into unity8, there is no reason I can see for this "canSuspend" concept in qtmir any more.

review: Needs Fixing
386. By Michael Terry on 2015-10-01

Drop canSuspend and RunningInBackground state

387. By Michael Terry on 2015-10-01

Merge from trunk

388. By Michael Terry on 2015-10-01

Support RoleIsTouchApp

389. By Michael Terry on 2015-10-01

minor fixes

Gerry Boland (gerboland) wrote :

This code change looks good to me.

Do we want to police apps from enabling this flag? How would we do that? There's no real way we can prevent an app from setting this. And if it results in a lifecycle exemption, many might set it!!

Perhaps having it so only Touch apps can be launched on the phone, while it is undocked, is enough motivation for app devs not to abuse this?

review: Needs Information
Gerry Boland (gerboland) wrote :

Also, I'd love to kill the GSettings schema. I think only MZanetti's TweakGeek app relies on it ATM.

Michael Terry (mterry) wrote :

> Do we want to police apps from enabling this flag?

From setting X-Ubuntu-Touch-App=false? They already can't do that. The store will reject any app that doesn't have X-Ubuntu-Touch-App=true. And apparently always has (I grepped all store clicks).

That's one of the benefits of re-using this flag. :)

> Also, I'd love to kill the GSettings schema.

Fair... The default right now is just the music-app. I don't know whether it's safe to remove that yet. Presumably that uses content-hub now? Or wants to in the future, I'd hope.

Anyway, that can be a separate MP.

Gerry Boland (gerboland) wrote :

/«BUILDDIR»/qtmir-0.4.6+15.10.20151008.2/tests/modules/Application/application_test.cpp:304:167: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
     ASSERT_EQ(false, application->isTouchApp());

Please use ASSERT_FALSE

review: Needs Fixing
390. By Michael Terry on 2015-10-15

Merge from trunk

391. By Michael Terry on 2015-10-15

Use ASSERT_TRUE/FALSE

Michael Terry (mterry) wrote :

> Please use ASSERT_FALSE

Done.

392. By Michael Terry on 2015-10-27

Merge from trunk

393. By Michael Terry on 2015-10-30

Bump shell application version

394. By Michael Terry on 2015-10-30

Bump shell application version harder

Gerry Boland (gerboland) wrote :

Tested on device, I see no behavioural regression, +1 from me.

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 2015-10-21 11:47:03 +0000
3+++ CMakeLists.txt 2015-10-30 17:00:37 +0000
4@@ -75,7 +75,7 @@
5 pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
6 pkg_check_modules(QTDBUSTEST libqtdbustest-1 REQUIRED)
7 pkg_check_modules(QTDBUSMOCK libqtdbusmock-1 REQUIRED)
8-pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=9)
9+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=10)
10
11 include_directories(${APPLICATION_API_INCLUDE_DIRS})
12
13
14=== modified file 'debian/control'
15--- debian/control 2015-10-21 11:46:54 +0000
16+++ debian/control 2015-10-30 17:00:37 +0000
17@@ -23,7 +23,7 @@
18 libubuntu-app-launch2-dev,
19 libubuntu-application-api-dev (>= 2.1.0),
20 libudev-dev,
21- libunity-api-dev (>= 7.101),
22+ libunity-api-dev (>= 7.102),
23 liburl-dispatcher1-dev,
24 libxkbcommon-dev,
25 libxrender-dev,
26@@ -93,7 +93,7 @@
27 Conflicts: libqtmir,
28 libunity-mir1,
29 Provides: unity-application-impl,
30- unity-application-impl-9,
31+ unity-application-impl-10,
32 Description: Qt plugin for Unity specific Mir APIs
33 QtMir provides Qt/QML bindings for Mir features that are exposed through the
34 qtmir-desktop or qtmir-android QPA plugin such as Application management
35
36=== modified file 'src/modules/Unity/Application/application.cpp'
37--- src/modules/Unity/Application/application.cpp 2015-09-29 14:01:12 +0000
38+++ src/modules/Unity/Application/application.cpp 2015-10-30 17:00:37 +0000
39@@ -37,8 +37,6 @@
40 namespace qtmir
41 {
42
43-QStringList Application::lifecycleExceptions;
44-
45 Application::Application(const QSharedPointer<SharedWakelock>& sharedWakelock,
46 DesktopFileReader *desktopFileReader,
47 const QStringList &arguments,
48@@ -80,7 +78,6 @@
49 switch (m_state) {
50 case InternalState::Starting:
51 case InternalState::Running:
52- case InternalState::RunningInBackground:
53 case InternalState::SuspendingWaitSession:
54 case InternalState::SuspendingWaitProcess:
55 wipeQMLCache();
56@@ -212,8 +209,6 @@
57 return "Starting";
58 case InternalState::Running:
59 return "Running";
60- case InternalState::RunningInBackground:
61- return "RunningInBackground";
62 case InternalState::SuspendingWaitSession:
63 return "SuspendingWaitSession";
64 case InternalState::SuspendingWaitProcess:
65@@ -282,7 +277,6 @@
66 case InternalState::Starting:
67 return Starting;
68 case InternalState::Running:
69- case InternalState::RunningInBackground:
70 case InternalState::SuspendingWaitSession:
71 case InternalState::SuspendingWaitProcess:
72 case InternalState::Closing:
73@@ -333,7 +327,6 @@
74 case InternalState::Running:
75 // already where it's wanted to be
76 break;
77- case InternalState::RunningInBackground:
78 case InternalState::SuspendingWaitSession:
79 case InternalState::Suspended:
80 resume();
81@@ -366,7 +359,6 @@
82 Q_ASSERT(m_processState == ProcessUnknown);
83 }
84 break;
85- case InternalState::RunningInBackground:
86 case InternalState::SuspendingWaitSession:
87 case InternalState::SuspendingWaitProcess:
88 case InternalState::Suspended:
89@@ -416,7 +408,6 @@
90 case InternalState::Running:
91 setInternalState(InternalState::Closing);
92 break;
93- case InternalState::RunningInBackground:
94 case InternalState::SuspendingWaitSession:
95 case InternalState::SuspendingWaitProcess:
96 case InternalState::Suspended:
97@@ -461,7 +452,6 @@
98 switch (m_state) {
99 case InternalState::Starting:
100 case InternalState::Running:
101- case InternalState::RunningInBackground:
102 case InternalState::Closing:
103 m_session->resume();
104 break;
105@@ -520,9 +510,6 @@
106 case InternalState::Running:
107 acquireWakelock();
108 break;
109- case InternalState::RunningInBackground:
110- releaseWakelock();
111- break;
112 case InternalState::Suspended:
113 releaseWakelock();
114 break;
115@@ -619,16 +606,8 @@
116 Q_ASSERT(m_state == InternalState::Running);
117 Q_ASSERT(m_session != nullptr);
118
119- if (!lifecycleExceptions.filter(appId().section('_',0,0)).empty()) {
120- // Present in exceptions list.
121- // There's no need to keep the wakelock as the process is never suspended
122- // and thus has no cleanup to perform when (for example) the display is
123- // blanked.
124- setInternalState(InternalState::RunningInBackground);
125- } else {
126- setInternalState(InternalState::SuspendingWaitSession);
127- m_session->suspend();
128- }
129+ setInternalState(InternalState::SuspendingWaitSession);
130+ m_session->suspend();
131 }
132
133 void Application::resume()
134@@ -643,8 +622,6 @@
135 } else if (m_state == InternalState::SuspendingWaitSession) {
136 setInternalState(InternalState::Running);
137 m_session->resume();
138- } else if (m_state == InternalState::RunningInBackground) {
139- setInternalState(InternalState::Running);
140 }
141 }
142
143@@ -657,6 +634,11 @@
144 Q_EMIT startProcessRequested();
145 }
146
147+bool Application::isTouchApp() const
148+{
149+ return m_desktopData->isTouchApp();
150+}
151+
152 QString Application::longAppId() const
153 {
154 return m_longAppId;
155
156=== modified file 'src/modules/Unity/Application/application.h'
157--- src/modules/Unity/Application/application.h 2015-09-29 14:01:12 +0000
158+++ src/modules/Unity/Application/application.h 2015-10-30 17:00:37 +0000
159@@ -68,7 +68,6 @@
160 enum class InternalState {
161 Starting,
162 Running,
163- RunningInBackground,
164 SuspendingWaitSession,
165 SuspendingWaitProcess,
166 Suspended,
167@@ -104,6 +103,7 @@
168 QColor splashColorFooter() const override;
169 Qt::ScreenOrientations supportedOrientations() const override;
170 bool rotatesWindowContents() const override;
171+ bool isTouchApp() const override;
172
173 void setStage(Stage stage);
174
175@@ -131,8 +131,6 @@
176 // for tests
177 InternalState internalState() const { return m_state; }
178
179- static QStringList lifecycleExceptions;
180-
181 Q_SIGNALS:
182 void fullscreenChanged(bool fullscreen);
183 void stageChanged(Stage stage);
184
185=== modified file 'src/modules/Unity/Application/application_manager.cpp'
186--- src/modules/Unity/Application/application_manager.cpp 2015-09-29 14:01:12 +0000
187+++ src/modules/Unity/Application/application_manager.cpp 2015-10-30 17:00:37 +0000
188@@ -196,11 +196,6 @@
189
190 m_roleNames.insert(RoleSession, "session");
191 m_roleNames.insert(RoleFullscreen, "fullscreen");
192-
193- if (settings.data()) {
194- Application::lifecycleExceptions = m_settings->get("lifecycleExemptAppids").toStringList();
195- connect(m_settings.data(), &Settings::changed, this, &ApplicationManager::onSettingsChanged);
196- }
197 }
198
199 ApplicationManager::~ApplicationManager()
200@@ -232,6 +227,8 @@
201 return QVariant::fromValue((int)application->state());
202 case RoleFocused:
203 return QVariant::fromValue(application->focused());
204+ case RoleIsTouchApp:
205+ return QVariant::fromValue(application->isTouchApp());
206 case RoleSession:
207 return QVariant::fromValue(application->session());
208 case RoleFullscreen:
209@@ -538,13 +535,6 @@
210 }
211 }
212
213-void ApplicationManager::onSettingsChanged(const QString &key)
214-{
215- if (key == "lifecycleExemptAppids") {
216- Application::lifecycleExceptions = m_settings->get("lifecycleExemptAppids").toStringList();
217- }
218-}
219-
220 void ApplicationManager::authorizeSession(const quint64 pid, bool &authorized)
221 {
222 tracepoint(qtmir, authorizeSession);
223
224=== modified file 'src/modules/Unity/Application/application_manager.h'
225--- src/modules/Unity/Application/application_manager.h 2015-08-21 00:00:16 +0000
226+++ src/modules/Unity/Application/application_manager.h 2015-10-30 17:00:37 +0000
227@@ -68,7 +68,7 @@
228
229 // FIXME: these roles should be added to unity-api and removed from here
230 enum MoreRoles {
231- RoleSession = RoleFocused+1,
232+ RoleSession = RoleIsTouchApp+1,
233 RoleFullscreen,
234 };
235
236@@ -137,7 +137,6 @@
237
238 private Q_SLOTS:
239 void onAppDataChanged(const int role);
240- void onSettingsChanged(const QString &key);
241
242 private:
243 void setFocused(Application *application);
244
245=== modified file 'src/modules/Unity/Application/com.canonical.qtmir.gschema.xml'
246--- src/modules/Unity/Application/com.canonical.qtmir.gschema.xml 2015-03-13 16:12:39 +0000
247+++ src/modules/Unity/Application/com.canonical.qtmir.gschema.xml 2015-10-30 17:00:37 +0000
248@@ -1,4 +1,6 @@
249 <schemalist>
250+ <!-- This schema is packaged in qtmir for historical reasons.
251+ It is interpreted by unity8 these days. -->
252 <schema path="/com/canonical/qtmir/" id="com.canonical.qtmir" gettext-domain="qtmir">
253 <key type="as" name="lifecycle-exempt-appids">
254 <default>[
255
256=== modified file 'src/modules/Unity/Application/desktopfilereader.cpp'
257--- src/modules/Unity/Application/desktopfilereader.cpp 2015-08-11 12:08:32 +0000
258+++ src/modules/Unity/Application/desktopfilereader.cpp 2015-10-30 17:00:37 +0000
259@@ -228,6 +228,18 @@
260 return result;
261 }
262
263+bool DesktopFileReader::isTouchApp() const
264+{
265+ Q_D(const DesktopFileReader);
266+ bool result;
267+
268+ if (!parseBoolean(d->getKey("X-Ubuntu-Touch"), result)) {
269+ qCWarning(QTMIR_APPLICATIONS) << d->file << "has an invalid X-Ubuntu-Touch entry.";
270+ }
271+
272+ return result;
273+}
274+
275 bool DesktopFileReader::parseOrientations(const QString &rawString, Qt::ScreenOrientations &result)
276 {
277 // Default to all orientations
278
279=== modified file 'src/modules/Unity/Application/desktopfilereader.h'
280--- src/modules/Unity/Application/desktopfilereader.h 2015-08-19 20:17:56 +0000
281+++ src/modules/Unity/Application/desktopfilereader.h 2015-10-30 17:00:37 +0000
282@@ -57,6 +57,7 @@
283 virtual QString splashColorFooter() const;
284 virtual Qt::ScreenOrientations supportedOrientations() const;
285 virtual bool rotatesWindowContents() const;
286+ virtual bool isTouchApp() const;
287 virtual bool loaded() const;
288
289 static bool parseOrientations(const QString &rawString, Qt::ScreenOrientations &result);
290
291=== modified file 'tests/modules/Application/application_test.cpp'
292--- tests/modules/Application/application_test.cpp 2015-08-20 16:04:25 +0000
293+++ tests/modules/Application/application_test.cpp 2015-10-30 17:00:37 +0000
294@@ -287,3 +287,19 @@
295 ASSERT_EQ(0, spyAppStopped.count());
296
297 }
298+
299+TEST_F(ApplicationTests, passesIsTouchAppThrough)
300+{
301+ using namespace ::testing;
302+
303+ auto mockDesktopFileReader = new NiceMock<MockDesktopFileReader>(QString(), QFileInfo());
304+ QScopedPointer<Application> application(new Application(
305+ QSharedPointer<MockSharedWakelock>(&sharedWakelock, [](MockSharedWakelock *){}),
306+ mockDesktopFileReader, QStringList(), nullptr));
307+
308+ ON_CALL(*mockDesktopFileReader, isTouchApp()).WillByDefault(Return(true));
309+ ASSERT_TRUE(application->isTouchApp());
310+
311+ ON_CALL(*mockDesktopFileReader, isTouchApp()).WillByDefault(Return(false));
312+ ASSERT_FALSE(application->isTouchApp());
313+}
314
315=== modified file 'tests/modules/ApplicationManager/application_manager_test.cpp'
316--- tests/modules/ApplicationManager/application_manager_test.cpp 2015-09-29 14:01:12 +0000
317+++ tests/modules/ApplicationManager/application_manager_test.cpp 2015-10-30 17:00:37 +0000
318@@ -1737,123 +1737,6 @@
319 }
320 }
321
322-TEST_F(ApplicationManagerTests,lifecycle_exempt_appId_is_not_suspended)
323-{
324- using namespace ::testing;
325- quint64 a_procId = 5921;
326- const QString appId("some_app");
327- QByteArray a_cmd("/usr/bin/app1");
328-
329- ON_CALL(procInfo,command_line(_)).WillByDefault(Return(a_cmd));
330-
331- ON_CALL(appController,appIdHasProcessId(a_procId, appId)).WillByDefault(Return(true));
332-
333- // Set up Mocks & signal watcher
334- auto mockDesktopFileReader = new NiceMock<MockDesktopFileReader>(appId, QFileInfo());
335- ON_CALL(*mockDesktopFileReader, loaded()).WillByDefault(Return(true));
336- ON_CALL(*mockDesktopFileReader, appId()).WillByDefault(Return(appId));
337-
338- ON_CALL(desktopFileReaderFactory, createInstance(appId, _)).WillByDefault(Return(mockDesktopFileReader));
339-
340-
341- Application *the_app = applicationManager.startApplication(appId, ApplicationManager::NoFlag);
342- applicationManager.onProcessStarting(appId);
343-
344- std::shared_ptr<mir::scene::Session> first_session = std::make_shared<MockSession>("Oo", a_procId);
345- std::shared_ptr<mir::scene::Session> second_session = std::make_shared<MockSession>("oO", a_procId);
346- {
347- bool authed = false;
348- applicationManager.authorizeSession(a_procId, authed);
349- ASSERT_EQ(authed, true);
350- }
351-
352- onSessionStarting(first_session);
353- FakeMirSurface *aSurface = new FakeMirSurface;
354- onSessionCreatedSurface(first_session.get(), aSurface);
355- aSurface->drawFirstFrame();
356- onSessionStarting(second_session);
357-
358- // Add to other apps to the list (Not "some_app")
359- QVariantList lifecycleExemptAppIds;
360- lifecycleExemptAppIds << "one_app" << "another_app";
361- ON_CALL(settings,get(_)).WillByDefault(Return(lifecycleExemptAppIds));
362- settings.changed("lifecycleExemptAppids");
363-
364- ASSERT_EQ(Application::InternalState::Running, the_app->internalState());
365-
366- EXPECT_CALL(*(mir::scene::MockSession*)first_session.get(), set_lifecycle_state(mir_lifecycle_state_will_suspend));
367- the_app->setRequestedState(Application::RequestedSuspended);
368- ASSERT_EQ(Application::InternalState::SuspendingWaitSession, the_app->internalState());
369-
370- static_cast<qtmir::Session*>(the_app->session())->doSuspend();
371- ASSERT_EQ(Application::InternalState::SuspendingWaitProcess, the_app->internalState());
372- applicationManager.onProcessSuspended(the_app->appId());
373- ASSERT_EQ(Application::InternalState::Suspended, the_app->internalState());
374-
375- EXPECT_CALL(*(mir::scene::MockSession*)first_session.get(), set_lifecycle_state(mir_lifecycle_state_resumed));
376- the_app->setRequestedState(Application::RequestedRunning);
377-
378- EXPECT_EQ(Application::Running, the_app->state());
379-
380- // Now add "some_app" to the exception list
381- lifecycleExemptAppIds << "some_app";
382- ON_CALL(settings,get(_)).WillByDefault(Return(lifecycleExemptAppIds));
383- settings.changed("lifecycleExemptAppids");
384-
385- EXPECT_EQ(Application::Running, the_app->state());
386-
387- EXPECT_CALL(*(mir::scene::MockSession*)first_session.get(), set_lifecycle_state(_)).Times(0);
388- the_app->setRequestedState(Application::RequestedSuspended);
389-
390- // And expect it to be running still
391- ASSERT_EQ(Application::InternalState::RunningInBackground, the_app->internalState());
392-
393- the_app->setRequestedState(Application::RequestedRunning);
394-
395- EXPECT_EQ(Application::Running, the_app->state());
396- ASSERT_EQ(Application::InternalState::Running, the_app->internalState());
397-}
398-
399-/*
400- * Test lifecycle exempt applications have their wakelocks released when shell tries to suspend them
401- */
402-TEST_F(ApplicationManagerTests,lifecycleExemptAppsHaveWakelockReleasedOnAttemptedSuspend)
403-{
404- using namespace ::testing;
405-
406- const QString appId("com.ubuntu.music"); // member of lifecycle exemption list
407- const quint64 procId = 12345;
408-
409- // Set up Mocks & signal watcher
410- auto mockDesktopFileReader = new NiceMock<MockDesktopFileReader>(appId, QFileInfo());
411- ON_CALL(*mockDesktopFileReader, loaded()).WillByDefault(Return(true));
412- ON_CALL(*mockDesktopFileReader, appId()).WillByDefault(Return(appId));
413-
414- ON_CALL(desktopFileReaderFactory, createInstance(appId, _)).WillByDefault(Return(mockDesktopFileReader));
415-
416- EXPECT_CALL(appController, startApplicationWithAppIdAndArgs(appId, _))
417- .Times(1)
418- .WillOnce(Return(true));
419-
420- auto application = applicationManager.startApplication(appId, ApplicationManager::NoFlag);
421- applicationManager.onProcessStarting(appId);
422- std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId);
423- bool authed = true;
424- applicationManager.authorizeSession(procId, authed);
425- onSessionStarting(session);
426-
427- // App creates surface, focuses it so state is running
428- FakeMirSurface *surface = new FakeMirSurface;
429- onSessionCreatedSurface(session.get(), surface);
430- surface->drawFirstFrame();
431-
432- application->setRequestedState(Application::RequestedSuspended);
433-
434- EXPECT_FALSE(sharedWakelock.enabled());
435- ASSERT_EQ(Application::InternalState::RunningInBackground, application->internalState());
436- EXPECT_EQ(Application::Running, application->state());
437-}
438-
439 /*
440 * Test that when user stops an application, application does not delete QML cache
441 */
442
443=== modified file 'tests/modules/DesktopFileReader/desktopfilereader_test.cpp'
444--- tests/modules/DesktopFileReader/desktopfilereader_test.cpp 2015-08-11 12:08:32 +0000
445+++ tests/modules/DesktopFileReader/desktopfilereader_test.cpp 2015-10-30 17:00:37 +0000
446@@ -58,6 +58,7 @@
447 EXPECT_EQ(reader->splashImage(), "/usr/share/click/preinstalled/.click/users/@all/com.ubuntu.calculator/calculator-app@30.png");
448 EXPECT_EQ(reader->splashShowHeader(), "True");
449 EXPECT_EQ(reader->splashTitle(), "Calculator 2.0");
450+ EXPECT_EQ(reader->isTouchApp(), true);
451 }
452
453 TEST(DesktopFileReader, testReadsLocalizedDesktopFile)
454@@ -83,6 +84,7 @@
455 EXPECT_EQ(reader->splashImage(), "/usr/share/click/preinstalled/.click/users/@all/com.ubuntu.calculator/calculator-app@30.png");
456 EXPECT_EQ(reader->splashShowHeader(), "True");
457 EXPECT_EQ(reader->splashTitle(), "Taschenrechner 2.0");
458+ EXPECT_EQ(reader->isTouchApp(), true);
459 }
460
461 TEST(DesktopFileReader, testMissingDesktopFile)
462@@ -108,6 +110,7 @@
463 EXPECT_EQ(reader->splashImage(), "");
464 EXPECT_EQ(reader->splashShowHeader(), "");
465 EXPECT_EQ(reader->splashTitle(), "");
466+ EXPECT_EQ(reader->isTouchApp(), false);
467 }
468
469 TEST(DesktopFileReader, testUTF8Characters)
470
471=== modified file 'tests/modules/common/fake_desktopfilereader.h'
472--- tests/modules/common/fake_desktopfilereader.h 2015-08-20 16:05:27 +0000
473+++ tests/modules/common/fake_desktopfilereader.h 2015-10-30 17:00:37 +0000
474@@ -42,6 +42,7 @@
475 QString splashColorFooter() const override { return QString(); }
476 Qt::ScreenOrientations supportedOrientations() const override { return Qt::PortraitOrientation; }
477 bool rotatesWindowContents() const override { return false; }
478+ bool isTouchApp() const override { return true; }
479 bool loaded() const override { return true; }
480
481 QString m_appId;
482
483=== modified file 'tests/modules/common/mock_desktop_file_reader.h'
484--- tests/modules/common/mock_desktop_file_reader.h 2015-08-11 12:08:32 +0000
485+++ tests/modules/common/mock_desktop_file_reader.h 2015-10-30 17:00:37 +0000
486@@ -38,6 +38,7 @@
487 ON_CALL(*this, exec()).WillByDefault(Invoke(this, &MockDesktopFileReader::doExec));
488 ON_CALL(*this, path()).WillByDefault(Invoke(this, &MockDesktopFileReader::doPath));
489 ON_CALL(*this, stageHint()).WillByDefault(Invoke(this, &MockDesktopFileReader::doStageHint));
490+ ON_CALL(*this, isTouchApp()).WillByDefault(Invoke(this, &MockDesktopFileReader::doIsTouchApp));
491 ON_CALL(*this, loaded()).WillByDefault(Invoke(this, &MockDesktopFileReader::doLoaded));
492 }
493
494@@ -49,6 +50,7 @@
495 MOCK_CONST_METHOD0(exec, QString());
496 MOCK_CONST_METHOD0(path, QString());
497 MOCK_CONST_METHOD0(stageHint, QString());
498+ MOCK_CONST_METHOD0(isTouchApp, bool());
499 MOCK_CONST_METHOD0(loaded, bool());
500
501 QString doFile() const
502@@ -91,6 +93,11 @@
503 return DesktopFileReader::stageHint();
504 }
505
506+ bool doIsTouchApp() const
507+ {
508+ return DesktopFileReader::isTouchApp();
509+ }
510+
511 bool doLoaded() const
512 {
513 return DesktopFileReader::loaded();
514
515=== modified file 'tests/modules/common/qtmir_test.cpp'
516--- tests/modules/common/qtmir_test.cpp 2015-08-20 15:59:48 +0000
517+++ tests/modules/common/qtmir_test.cpp 2015-10-30 17:00:37 +0000
518@@ -26,9 +26,6 @@
519 case Application::InternalState::Running:
520 *os << "Running";
521 break;
522- case Application::InternalState::RunningInBackground:
523- *os << "RunningInBackground";
524- break;
525 case Application::InternalState::SuspendingWaitSession:
526 *os << "SuspendingWaitSession";
527 break;

Subscribers

People subscribed via source and target branches