From 691905b1a1ed92804e254fe3e21a974ccb04d2df Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 11 Oct 2014 20:58:34 +0200 Subject: [PATCH] fix the test before 419b344b6 the size of the dialog was wrong, making positioning of it actually different. the new value, 71 is actually the correct one. to make sure to catch similar cases, adds a test on the dialog size and margins as well Change-Id: I035c66a6745e0e9f265f63cee450fec7a645654d --- autotests/dialognativetest.cpp | 18 +++++++++++++++++- autotests/dialognativetest.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/autotests/dialognativetest.cpp b/autotests/dialognativetest.cpp index 80d68a931..c0914bec4 100644 --- a/autotests/dialognativetest.cpp +++ b/autotests/dialognativetest.cpp @@ -28,6 +28,7 @@ void DialogNativeTest::initTestCase() m_cacheDir.removeRecursively(); m_dialog = new PlasmaQuick::Dialog; + m_dialog->setLocation(Plasma::Types::TopEdge); m_panel = new QQuickView; m_panel->setGeometry(0, 0, 50, 50); @@ -58,6 +59,21 @@ void DialogNativeTest::cleanupTestCase() m_cacheDir.removeRecursively(); } +void DialogNativeTest::size() +{ + QTest::qWaitForWindowExposed(m_dialog); + + QCOMPARE(m_content->width(), (qreal)100); + QCOMPARE(m_content->height(), (qreal)100); + QCOMPARE(m_dialog->width(), 104); + QCOMPARE(m_dialog->height(), 104); + + QCOMPARE(m_dialog->margins()->property("left").value(), (qreal)0.0); + QCOMPARE(m_dialog->margins()->property("top").value(), (qreal)0.0); + QCOMPARE(m_dialog->margins()->property("right").value(), (qreal)4.0); + QCOMPARE(m_dialog->margins()->property("bottom").value(), (qreal)4.0); +} + void DialogNativeTest::position() { QTest::qWaitForWindowExposed(m_dialog); @@ -66,7 +82,7 @@ void DialogNativeTest::position() QCOMPARE(m_dialog->y(), 49); m_dialog->setVisualParent(m_panel2->contentItem()); - QCOMPARE(m_dialog->x(), 73); + QCOMPARE(m_dialog->x(), 71); QCOMPARE(m_dialog->y(), 49); } diff --git a/autotests/dialognativetest.h b/autotests/dialognativetest.h index 0ea9ee4c7..d696cad80 100644 --- a/autotests/dialognativetest.h +++ b/autotests/dialognativetest.h @@ -36,6 +36,7 @@ public Q_SLOTS: void cleanupTestCase(); private Q_SLOTS: + void size(); void position(); private: