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
This commit is contained in:
Marco Martin 2014-10-11 20:58:34 +02:00
parent 66a1a497ef
commit 691905b1a1
2 changed files with 18 additions and 1 deletions

View File

@ -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>(), (qreal)0.0);
QCOMPARE(m_dialog->margins()->property("top").value<qreal>(), (qreal)0.0);
QCOMPARE(m_dialog->margins()->property("right").value<qreal>(), (qreal)4.0);
QCOMPARE(m_dialog->margins()->property("bottom").value<qreal>(), (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);
}

View File

@ -36,6 +36,7 @@ public Q_SLOTS:
void cleanupTestCase();
private Q_SLOTS:
void size();
void position();
private: