diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-06-03 18:25:38 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-06-03 18:25:38 (GMT) |
commit | 4b37d772cd5c1098d38944a125b48751f4bb1280 (patch) | |
tree | dbbd90e060b7a78dd07af617dc7188bf9d9e32ed /tests/auto/qdatetimeedit | |
parent | 3893a10158e3ef5bec79c55ad89666cdc4ad14f5 (diff) | |
download | Qt-4b37d772cd5c1098d38944a125b48751f4bb1280.zip Qt-4b37d772cd5c1098d38944a125b48751f4bb1280.tar.gz Qt-4b37d772cd5c1098d38944a125b48751f4bb1280.tar.bz2 |
Fix to tst_QDateTimeEdit::mousePress test case.
Checked datetimedit spinbox up location from style, instead of trying
to guess the difference offsets.
Diffstat (limited to 'tests/auto/qdatetimeedit')
-rw-r--r-- | tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp index b975405..624d193 100644 --- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp @@ -2213,21 +2213,16 @@ void tst_QDateTimeEdit::mousePress() testWidget->setDate(QDate(2004, 6, 23)); testWidget->setCurrentSection(QDateTimeEdit::YearSection); QCOMPARE(testWidget->currentSection(), QDateTimeEdit::YearSection); - int offset = 10; -#if defined(Q_OS_WINCE) - offset = 20; - if (qt_wince_is_pocket_pc()) { - // depending on wether the display is double-pixeld, we need - // to click at a different position - bool doubledSize = false; - int dpi = GetDeviceCaps(GetDC(0), LOGPIXELSX); - if ((dpi < 1000) && (dpi > 0)) - doubledSize = true; - offset = doubledSize ? 50 : 25; // On CE buttons are aligned horizontal - } -#endif - QTest::mouseClick(testWidget, Qt::LeftButton, 0, QPoint(testWidget->width() - offset, 5)); - QCOMPARE(testWidget->date().year(), 2005); + + // Ask the SC_SpinBoxUp button location from style + QStyleOptionSpinBox so; + so.rect = testWidget->rect(); + QRect rectUp = testWidget->style()->subControlRect(QStyle::CC_SpinBox, &so, QStyle::SC_SpinBoxUp, testWidget); + + // Send mouseClick to center of SC_SpinBoxUp + QTest::mouseClick(testWidget, Qt::LeftButton, 0, rectUp.center()); + QCOMPARE(testWidget->date().year(), 2005); + } void tst_QDateTimeEdit::stepHourAMPM_data() |