Merge lp:~gerboland/unity-mir/phone-surface-bad-position into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Michael Zanetti
Approved revision: 206
Merged at revision: 208
Proposed branch: lp:~gerboland/unity-mir/phone-surface-bad-position
Merge into: lp:unity-mir
Diff against target: 56 lines (+28/-0)
2 files modified
src/modules/Unity/Application/application_manager.cpp (+8/-0)
tests/application_manager_test.cpp (+20/-0)
To merge this branch: bzr merge lp:~gerboland/unity-mir/phone-surface-bad-position
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+212695@code.launchpad.net

Commit message

Fix bug where sidestage app launched by upstart on the phone would not have stage overridden to be main stage, and thus positioned incorrectly.

Description of the change

Fix bug where sidestage app launched by upstart on the phone would not have stage overridden to be main stage, and thus positioned incorrectly.

Bug not visible with today's trunk, but the right-edge work exposes it

* Are there any related MPs required for this MP to build/function as expected? Please list.
No
 * 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?
N/A

To post a comment you must log in.
206. By Gerry Boland

Move test to remove future merge conflict

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

I don't really like the fact we define a "side stage enabled" here and in unity. But I'll figure a unity-api compatible approach to unify that when doing the proper side stage work.

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

Yes. Fixes the issue.

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

Yes.

review: Approve
207. By Gerry Boland

Min size stage width is 100GU, not 60

Revision history for this message
Michael Zanetti (mzanetti) wrote :

Yep. fixes it on Flo too. Thanks a lot!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application_manager.cpp'
2--- src/modules/Unity/Application/application_manager.cpp 2014-03-17 17:44:24 +0000
3+++ src/modules/Unity/Application/application_manager.cpp 2014-04-01 16:22:27 +0000
4@@ -47,6 +47,7 @@
5
6 // Default element sizes
7 #define SIDE_STAGE_WIDTH_GU 40
8+#define TABLET_MODE_MINIMUM_WIDTH_GU 100
9
10 namespace msh = mir::shell;
11
12@@ -402,6 +403,13 @@
13 DLOG("Unable to instantiate application with appId '%s'", qPrintable(appId));
14 return;
15 }
16+
17+ // override stage if necessary (i.e. side stage invalid on phone)
18+ if (application->stage() == Application::SideStage &&
19+ m_displaySize.width() < (TABLET_MODE_MINIMUM_WIDTH_GU * m_gridUnitPx)) {
20+ application->setStage(Application::MainStage);
21+ }
22+
23 add(application);
24 Q_EMIT focusRequested(appId);
25 }
26
27=== modified file 'tests/application_manager_test.cpp'
28--- tests/application_manager_test.cpp 2014-03-11 03:40:26 +0000
29+++ tests/application_manager_test.cpp 2014-04-01 16:22:27 +0000
30@@ -299,6 +299,26 @@
31 EXPECT_EQ(second_session, the_app->session());
32 }
33
34+TEST_F(ApplicationManagerTests,upstart_launching_sidestage_app_on_phone_forced_into_mainstage)
35+{
36+ using namespace ::testing;
37+ QString appId("sideStage");
38+
39+ auto mockDesktopFileReader = new NiceMock<MockDesktopFileReader>(appId);
40+ ON_CALL(*mockDesktopFileReader, loaded()).WillByDefault(Return(true));
41+ ON_CALL(*mockDesktopFileReader, stageHint()).WillByDefault(Return("SideStage"));
42+
43+ ON_CALL(desktopFileReaderFactory, createInstanceForAppId(appId)).WillByDefault(Return(mockDesktopFileReader));
44+
45+ // mock upstart launching an app which reports itself as sidestage, but we're on phone
46+ applicationManager.onProcessStartReportReceived(appId, false);
47+
48+ // ensure the app stage is overridden to be main stage
49+ Application* theApp = applicationManager.findApplication(appId);
50+ ASSERT_NE(theApp, nullptr);
51+ EXPECT_EQ(Application::MainStage, theApp->stage());
52+}
53+
54 TEST_F(ApplicationManagerTests,two_session_on_one_application_after_starting)
55 {
56 using namespace ::testing;

Subscribers

People subscribed via source and target branches