From da4e011c304c16caae51f67ce2eb5c7577807f67 2012-09-14 14:52:28 From: Marek Rosa Date: 2012-09-14 14:52:28 Subject: [PATCH] Fixed the SKIP_IF_CANNOT_TEST_MOUSE_EVENTS on Qt5 --- diff --git a/tests/auto/inc/tst_definitions.h b/tests/auto/inc/tst_definitions.h index 44b7388..5adb93c 100644 --- a/tests/auto/inc/tst_definitions.h +++ b/tests/auto/inc/tst_definitions.h @@ -39,6 +39,20 @@ // Some bamboo clients have trouble passing mouse events to the test application. // This can be used to skip those tests so that they don't show up as a failure // in the test report. +#ifdef QT5_QUICK_1 +#define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \ + do { \ + QPushButton b; \ + b.resize(100, 100); \ + b.show(); \ + QTest::qWaitForWindowShown(&b); \ + QSignalSpy spy(&b, SIGNAL(clicked())); \ + QTest::mouseClick(&b, Qt::LeftButton, 0, b.rect().center()); \ + if (spy.count() == 0) \ + QSKIP("Cannot test mouse events in this environment"); \ + } while (0); \ +} +#else #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \ do { \ QPushButton b; \ @@ -51,5 +65,6 @@ QSKIP("Cannot test mouse events in this environment", SkipAll); \ } while (0); \ } +#endif #endif // TST_DEFINITIONS_H