@@ -22,6 +22,7 | |||||
22 | #define TST_DEFINITIONS_H |
|
22 | #define TST_DEFINITIONS_H | |
23 |
|
23 | |||
24 | #include <QtTest/QtTest> |
|
24 | #include <QtTest/QtTest> | |
|
25 | #include <QPushButton> | |||
25 |
|
26 | |||
26 | #define TRY_COMPARE(actual, expected) { \ |
|
27 | #define TRY_COMPARE(actual, expected) { \ | |
27 | do { \ |
|
28 | do { \ | |
@@ -35,4 +36,20 | |||||
35 | } while (0); \ |
|
36 | } while (0); \ | |
36 | } |
|
37 | } | |
37 |
|
38 | |||
|
39 | // Some bamboo clients have trouble passing mouse events to the test application. | |||
|
40 | // This can be used to skip those tests so that they don't show up as a failure | |||
|
41 | // in the test report. | |||
|
42 | #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \ | |||
|
43 | do { \ | |||
|
44 | QPushButton b; \ | |||
|
45 | b.resize(100, 100); \ | |||
|
46 | b.show(); \ | |||
|
47 | QTest::qWaitForWindowShown(&b); \ | |||
|
48 | QSignalSpy spy(&b, SIGNAL(clicked())); \ | |||
|
49 | QTest::mouseClick(&b, Qt::LeftButton, 0, b.rect().center()); \ | |||
|
50 | if (spy.count() == 0) \ | |||
|
51 | QSKIP("Cannot test mouse events in this environment", SkipAll); \ | |||
|
52 | } while (0); \ | |||
|
53 | } | |||
|
54 | ||||
38 | #endif // TST_DEFINITIONS_H |
|
55 | #endif // TST_DEFINITIONS_H |
@@ -480,6 +480,8 void tst_qpieseries::verifyCalculatedData(const QPieSeries &series, bool *ok) | |||||
480 |
|
480 | |||
481 | void tst_qpieseries::clickedSignal() |
|
481 | void tst_qpieseries::clickedSignal() | |
482 | { |
|
482 | { | |
|
483 | SKIP_IF_CANNOT_TEST_MOUSE_EVENTS(); | |||
|
484 | ||||
483 | // add some slices |
|
485 | // add some slices | |
484 | QPieSlice *s1 = m_series->append("slice 1", 1); |
|
486 | QPieSlice *s1 = m_series->append("slice 1", 1); | |
485 | QPieSlice *s2 = m_series->append("slice 2", 1); |
|
487 | QPieSlice *s2 = m_series->append("slice 2", 1); | |
@@ -560,6 +562,8 void tst_qpieseries::clickedSignal() | |||||
560 |
|
562 | |||
561 | void tst_qpieseries::hoverSignal() |
|
563 | void tst_qpieseries::hoverSignal() | |
562 | { |
|
564 | { | |
|
565 | SKIP_IF_CANNOT_TEST_MOUSE_EVENTS(); | |||
|
566 | ||||
563 | // add some slices |
|
567 | // add some slices | |
564 | m_series->setPieSize(1.0); |
|
568 | m_series->setPieSize(1.0); | |
565 | QPieSlice *s1 = m_series->append("slice 1", 1); |
|
569 | QPieSlice *s1 = m_series->append("slice 1", 1); |
General Comments 0
You need to be logged in to leave comments.
Login now