diff options
author | Jarosław Jaryszew <jaroslaw.jaryszew@teleca.com> | 2011-01-17 10:43:27 +0100 |
---|---|---|
committer | Dominik Kapusta <dominik.kapusta@teleca.com> | 2011-01-18 12:15:11 +0100 |
commit | 95b5b5eada4a90373fc1cb6165c88a6ecb56e7f2 (patch) | |
tree | 3aa36be9fcf1baa2b6e6be6f5a8b0132c0a3e183 | |
parent | 6f7fe04ef122b8da43326bdebc19ae2968eae629 (diff) |
Fixes: NB#208270 - Status area is displayed in portrait orientation when application is in landscape and vice-verse.
RevBy: Dominik
Details: Now when handling current app window change we are testing for its orientation
(_MEEGOTOUCH_ORIENTATION_ANGLE) right away instead of waiting for PropertyChangeEvent.
This is necessary because non-lmt windows will not set this property, and app will not get updated.
Added unit test for case when non-lmt app is on top.
-rw-r--r-- | src/corelib/events/morientationtracker.cpp | 1 | ||||
-rw-r--r-- | tests/ut_morientationtracker/ut_morientationtracker.cpp | 62 | ||||
-rw-r--r-- | tests/ut_morientationtracker/ut_morientationtracker.h | 2 |
3 files changed, 65 insertions, 0 deletions
diff --git a/src/corelib/events/morientationtracker.cpp b/src/corelib/events/morientationtracker.cpp index 3a714530..d63992ef 100644 --- a/src/corelib/events/morientationtracker.cpp +++ b/src/corelib/events/morientationtracker.cpp @@ -371,6 +371,7 @@ bool MOrientationTrackerPrivate::handleX11PropertyEvent(XPropertyEvent *event) return true; } else if (event->atom == currentAppWindowAtom) { handleCurrentAppWindowChange(); + handleCurrentAppWindowOrientationAngleChange(); return true; } } diff --git a/tests/ut_morientationtracker/ut_morientationtracker.cpp b/tests/ut_morientationtracker/ut_morientationtracker.cpp index f0435861..4da4691f 100644 --- a/tests/ut_morientationtracker/ut_morientationtracker.cpp +++ b/tests/ut_morientationtracker/ut_morientationtracker.cpp @@ -366,6 +366,68 @@ void Ut_MOrientationTracker::testFollowCurrentWindow() cleanCurrentWindowXPropertyOnRootWindow(); } +void Ut_MOrientationTracker::testFollowNonLMTCurrentWindow_data() +{ + QTest::addColumn<M::OrientationAngle>("firstAngle"); + QTest::addColumn<M::OrientationAngle>("secondAngle"); + + QTest::newRow("Angle0 -> 90") << M::Angle0 << M::Angle90; + QTest::newRow("Angle90 -> 180") << M::Angle90 << M::Angle180; + QTest::newRow("Angle180 -> 270") << M::Angle180 << M::Angle270; + QTest::newRow("Angle270 -> 0") << M::Angle270 << M::Angle0; +} + +void Ut_MOrientationTracker::testFollowNonLMTCurrentWindow() +{ + QFETCH(M::OrientationAngle, firstAngle); + QFETCH(M::OrientationAngle, secondAngle); + + setAllAngles(&supportedAnglesStubLists[KeyboardOpen]); + setAllAngles(&supportedAnglesStubLists[KeyboardClosed]); + + //create app window and set it as _MEEGOTOUCH_CURRENT_APP_WINDOW; + MApplicationWindow appWindow; + setCurrentWindowXPropertyOnRootWindow(appWindow.effectiveWinId()); + + MApplicationWindow nonLMTWindow; + + //make window1 start following _MEEGOTOUCH_CURRENT_APP_WINDOW + window1->setProperty("followsCurrentApplicationWindowOrientation", 1); + + //since there is no MApplication instance we have to run this handler manualy + mTracker->handleCurrentAppWindowChange(); + + mTracker->doUpdateOrientationAngle(firstAngle, true, false, false); + + //since there is no MApplication instance we have to run this handler manualy + mTracker->handleCurrentAppWindowOrientationAngleChange(); + + QCOMPARE(window1->orientationAngle(), firstAngle); + + //delete _MEEGOTOUCH_ORIENTATION_ANGLE on app window to emulate non-lmt app + Atom orientationAtom = XInternAtom(QX11Info::display(), "_MEEGOTOUCH_ORIENTATION_ANGLE", False); + XDeleteProperty(QX11Info::display(), nonLMTWindow.effectiveWinId(), orientationAtom); + + //change window to non lmt one; + setCurrentWindowXPropertyOnRootWindow(nonLMTWindow.effectiveWinId()); + + mTracker->handleCurrentAppWindowChange(); + mTracker->handleCurrentAppWindowOrientationAngleChange(); + + QCOMPARE(window1->orientationAngle(), M::Angle0); + + nonLMTWindow.setOrientationAngle(secondAngle); + //delete _MEEGOTOUCH_ORIENTATION_ANGLE on that window to emulate non-lmt app + XDeleteProperty(QX11Info::display(), nonLMTWindow.effectiveWinId(), orientationAtom); + + //since there is no MApplication instance we have to run this handler manualy + mTracker->handleCurrentAppWindowOrientationAngleChange(); + + QCOMPARE(window1->orientationAngle(), M::Angle0); + + cleanCurrentWindowXPropertyOnRootWindow(); +} + void Ut_MOrientationTracker::testXEventMaskPreservationWhenChangingCurrentAppWindow() { MApplicationWindow appWindow1; diff --git a/tests/ut_morientationtracker/ut_morientationtracker.h b/tests/ut_morientationtracker/ut_morientationtracker.h index 171929af..9dd9a84d 100644 --- a/tests/ut_morientationtracker/ut_morientationtracker.h +++ b/tests/ut_morientationtracker/ut_morientationtracker.h @@ -59,6 +59,8 @@ private slots: void testOffDisplaySpecialWindows(); void testFollowCurrentWindow_data(); void testFollowCurrentWindow(); + void testFollowNonLMTCurrentWindow_data(); + void testFollowNonLMTCurrentWindow(); void testXEventMaskPreservationWhenChangingCurrentAppWindow(); #endif |