summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qscreen/tst_qscreen.cpp21
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp18
2 files changed, 34 insertions, 5 deletions
diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
index d4d6ff1401..5f2be63263 100644
--- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
+++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
@@ -90,6 +90,11 @@ void tst_QScreen::angleBetween_data()
<< uint(Qt::InvertedLandscapeOrientation)
<< uint(Qt::LandscapeOrientation)
<< 180;
+
+ QTest::newRow("Landscape Primary")
+ << uint(Qt::LandscapeOrientation)
+ << uint(Qt::PrimaryOrientation)
+ << QGuiApplication::primaryScreen()->angleBetween(Qt::LandscapeOrientation, QGuiApplication::primaryScreen()->primaryOrientation());
}
void tst_QScreen::angleBetween()
@@ -101,8 +106,8 @@ void tst_QScreen::angleBetween()
Qt::ScreenOrientation a = Qt::ScreenOrientation(oa);
Qt::ScreenOrientation b = Qt::ScreenOrientation(ob);
- QCOMPARE(QScreen::angleBetween(a, b), expected);
- QCOMPARE(QScreen::angleBetween(b, a), (360 - expected) % 360);
+ QCOMPARE(QGuiApplication::primaryScreen()->angleBetween(a, b), expected);
+ QCOMPARE(QGuiApplication::primaryScreen()->angleBetween(b, a), (360 - expected) % 360);
}
void tst_QScreen::transformBetween_data()
@@ -149,6 +154,12 @@ void tst_QScreen::transformBetween_data()
<< uint(Qt::LandscapeOrientation)
<< rect
<< QTransform(-1, 0, 0, -1, rect.width(), rect.height());
+
+ QTest::newRow("Landscape Primary")
+ << uint(Qt::LandscapeOrientation)
+ << uint(Qt::PrimaryOrientation)
+ << rect
+ << QGuiApplication::primaryScreen()->transformBetween(Qt::LandscapeOrientation, QGuiApplication::primaryScreen()->primaryOrientation(), rect);
}
void tst_QScreen::transformBetween()
@@ -161,7 +172,7 @@ void tst_QScreen::transformBetween()
Qt::ScreenOrientation a = Qt::ScreenOrientation(oa);
Qt::ScreenOrientation b = Qt::ScreenOrientation(ob);
- QCOMPARE(QScreen::transformBetween(a, b, rect), expected);
+ QCOMPARE(QGuiApplication::primaryScreen()->transformBetween(a, b, rect), expected);
}
void tst_QScreen::orientationChange()
@@ -169,10 +180,10 @@ void tst_QScreen::orientationChange()
QScreen *screen = QGuiApplication::primaryScreen();
QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation);
- QTRY_COMPARE(screen->currentOrientation(), Qt::LandscapeOrientation);
+ QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation);
QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation);
- QTRY_COMPARE(screen->currentOrientation(), Qt::PortraitOrientation);
+ QTRY_COMPARE(screen->orientation(), Qt::PortraitOrientation);
}
#include <tst_qscreen.moc>
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index ac8c8f9b20..d0d2ce1e1d 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -57,6 +57,7 @@ private slots:
void touchToMouseTranslation();
void mouseToTouchTranslation();
void mouseToTouchLoop();
+ void orientation();
void initTestCase()
{
touchDevice = new QTouchDevice;
@@ -481,5 +482,22 @@ void tst_QWindow::mouseToTouchLoop()
qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false);
}
+void tst_QWindow::orientation()
+{
+ QWindow window;
+ window.setGeometry(80, 80, 40, 40);
+ window.create();
+
+ window.reportContentOrientationChange(Qt::PortraitOrientation);
+ QCOMPARE(window.contentOrientation(), Qt::PortraitOrientation);
+
+ window.reportContentOrientationChange(Qt::PrimaryOrientation);
+ QCOMPARE(window.contentOrientation(), window.screen()->primaryOrientation());
+
+ QVERIFY(!window.requestWindowOrientation(Qt::LandscapeOrientation) || window.windowOrientation() == Qt::LandscapeOrientation);
+ QVERIFY(!window.requestWindowOrientation(Qt::PortraitOrientation) || window.windowOrientation() == Qt::PortraitOrientation);
+ QVERIFY(!window.requestWindowOrientation(Qt::PrimaryOrientation) || window.windowOrientation() == window.screen()->primaryOrientation());
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow);