From ac81d3fe09a3d0f685371ee174b4f9c8f445b185 2012-09-14 14:01:10 From: Jani Honkonen Date: 2012-09-14 14:01:10 Subject: [PATCH] Try to make bamboo skip tests that it cannot run --- diff --git a/tests/auto/inc/tst_definitions.h b/tests/auto/inc/tst_definitions.h index f30e9bb..44b7388 100644 --- a/tests/auto/inc/tst_definitions.h +++ b/tests/auto/inc/tst_definitions.h @@ -22,6 +22,7 @@ #define TST_DEFINITIONS_H #include +#include #define TRY_COMPARE(actual, expected) { \ do { \ @@ -35,4 +36,20 @@ } while (0); \ } +// 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. +#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", SkipAll); \ + } while (0); \ +} + #endif // TST_DEFINITIONS_H diff --git a/tests/auto/qpieseries/tst_qpieseries.cpp b/tests/auto/qpieseries/tst_qpieseries.cpp index a742df1..910a3a4 100644 --- a/tests/auto/qpieseries/tst_qpieseries.cpp +++ b/tests/auto/qpieseries/tst_qpieseries.cpp @@ -480,6 +480,8 @@ void tst_qpieseries::verifyCalculatedData(const QPieSeries &series, bool *ok) void tst_qpieseries::clickedSignal() { + SKIP_IF_CANNOT_TEST_MOUSE_EVENTS(); + // add some slices QPieSlice *s1 = m_series->append("slice 1", 1); QPieSlice *s2 = m_series->append("slice 2", 1); @@ -560,6 +562,8 @@ void tst_qpieseries::clickedSignal() void tst_qpieseries::hoverSignal() { + SKIP_IF_CANNOT_TEST_MOUSE_EVENTS(); + // add some slices m_series->setPieSize(1.0); QPieSlice *s1 = m_series->append("slice 1", 1);