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
=== modified file 'src/modules/Unity/Application/application_manager.cpp'
--- src/modules/Unity/Application/application_manager.cpp 2014-03-17 17:44:24 +0000
+++ src/modules/Unity/Application/application_manager.cpp 2014-04-01 16:22:27 +0000
@@ -47,6 +47,7 @@
4747
48// Default element sizes48// Default element sizes
49#define SIDE_STAGE_WIDTH_GU 4049#define SIDE_STAGE_WIDTH_GU 40
50#define TABLET_MODE_MINIMUM_WIDTH_GU 100
5051
51namespace msh = mir::shell;52namespace msh = mir::shell;
5253
@@ -402,6 +403,13 @@
402 DLOG("Unable to instantiate application with appId '%s'", qPrintable(appId));403 DLOG("Unable to instantiate application with appId '%s'", qPrintable(appId));
403 return;404 return;
404 }405 }
406
407 // override stage if necessary (i.e. side stage invalid on phone)
408 if (application->stage() == Application::SideStage &&
409 m_displaySize.width() < (TABLET_MODE_MINIMUM_WIDTH_GU * m_gridUnitPx)) {
410 application->setStage(Application::MainStage);
411 }
412
405 add(application);413 add(application);
406 Q_EMIT focusRequested(appId);414 Q_EMIT focusRequested(appId);
407 }415 }
408416
=== modified file 'tests/application_manager_test.cpp'
--- tests/application_manager_test.cpp 2014-03-11 03:40:26 +0000
+++ tests/application_manager_test.cpp 2014-04-01 16:22:27 +0000
@@ -299,6 +299,26 @@
299 EXPECT_EQ(second_session, the_app->session());299 EXPECT_EQ(second_session, the_app->session());
300}300}
301301
302TEST_F(ApplicationManagerTests,upstart_launching_sidestage_app_on_phone_forced_into_mainstage)
303{
304 using namespace ::testing;
305 QString appId("sideStage");
306
307 auto mockDesktopFileReader = new NiceMock<MockDesktopFileReader>(appId);
308 ON_CALL(*mockDesktopFileReader, loaded()).WillByDefault(Return(true));
309 ON_CALL(*mockDesktopFileReader, stageHint()).WillByDefault(Return("SideStage"));
310
311 ON_CALL(desktopFileReaderFactory, createInstanceForAppId(appId)).WillByDefault(Return(mockDesktopFileReader));
312
313 // mock upstart launching an app which reports itself as sidestage, but we're on phone
314 applicationManager.onProcessStartReportReceived(appId, false);
315
316 // ensure the app stage is overridden to be main stage
317 Application* theApp = applicationManager.findApplication(appId);
318 ASSERT_NE(theApp, nullptr);
319 EXPECT_EQ(Application::MainStage, theApp->stage());
320}
321
302TEST_F(ApplicationManagerTests,two_session_on_one_application_after_starting)322TEST_F(ApplicationManagerTests,two_session_on_one_application_after_starting)
303{323{
304 using namespace ::testing;324 using namespace ::testing;

Subscribers

People subscribed via source and target branches