Changeset View
Changeset View
Standalone View
Standalone View
autotests/kmessagewidgetautotest.cpp
Show All 16 Lines | 1 | /* | |||
---|---|---|---|---|---|
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "kmessagewidgetautotest.h" | 21 | #include "kmessagewidgetautotest.h" | ||
22 | 22 | | |||
23 | #include <QTest> | 23 | #include <QTest> | ||
24 | #include <QSignalSpy> | 24 | #include <QSignalSpy> | ||
25 | #include <QVBoxLayout> | ||||
26 | #include <QListWidget> | ||||
27 | #include <QDebug> | ||||
25 | #include <kmessagewidget.h> | 28 | #include <kmessagewidget.h> | ||
26 | 29 | | |||
27 | QTEST_MAIN(KMessageWidgetTest) | 30 | QTEST_MAIN(KMessageWidgetTest) | ||
28 | 31 | | |||
29 | // KMessageWidget is currently hardcoded to a 500 ms timeline and default QTimeLine 40 ms update interval | 32 | // KMessageWidget is currently hardcoded to a 500 ms timeline and default QTimeLine 40 ms update interval | ||
30 | // let's have 7 updates for now, should be save | 33 | // let's have 7 updates for now, should be save | ||
31 | const int overlappingWaitingTime = 280; | 34 | const int overlappingWaitingTime = 280; | ||
32 | 35 | | |||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Line(s) | 239 | { | |||
245 | QTRY_VERIFY(!w.isHideAnimationRunning()); | 248 | QTRY_VERIFY(!w.isHideAnimationRunning()); | ||
246 | 249 | | |||
247 | QCOMPARE(hideSignalsSpy.count(), 1); | 250 | QCOMPARE(hideSignalsSpy.count(), 1); | ||
248 | CHECK_FULLY_NOT_VISIBLE | 251 | CHECK_FULLY_NOT_VISIBLE | ||
249 | 252 | | |||
250 | w.show(); | 253 | w.show(); | ||
251 | CHECK_FULLY_VISIBLE | 254 | CHECK_FULLY_VISIBLE | ||
252 | } | 255 | } | ||
256 | | ||||
257 | void KMessageWidgetTest::testResizeEvent() | ||||
258 | { | ||||
259 | QWidget parent; | ||||
260 | QVBoxLayout layout(&parent); | ||||
261 | KMessageWidget w(QStringLiteral("Erat conubia luctus, nisi in amet penatibus cursus, maecenas vitae magna orci. Pellentesque. Integer nam, semper a, inceptos dui. Tempor ultrices morbi eleifend ipsum a nibh parturient at, tristique condimentum, est. Venenatis eget sed diam vestibulum."), &parent); | ||||
262 | w.setWordWrap(true); | ||||
263 | w.hide(); | ||||
264 | layout.addWidget(&w); | ||||
265 | | ||||
266 | QListWidget bw(&parent); | ||||
267 | bw.addItem(QStringLiteral("Test 1")); | ||||
268 | bw.addItem(QStringLiteral("Test 2")); | ||||
269 | bw.addItem(QStringLiteral("Test 2")); | ||||
270 | layout.addWidget(&bw); | ||||
271 | | ||||
272 | parent.show(); | ||||
273 | w.animatedShow(); | ||||
274 | QTest::qWait(overlappingWaitingTime * 2); | ||||
275 | CHECK_FULLY_VISIBLE | ||||
276 | | ||||
277 | parent.resize(1000, parent.height()); | ||||
278 | QTest::qWait(overlappingWaitingTime * 2); | ||||
279 | CHECK_FULLY_VISIBLE | ||||
280 | | ||||
281 | parent.resize(500, parent.height()); | ||||
282 | QTest::qWait(overlappingWaitingTime * 2); | ||||
283 | CHECK_FULLY_VISIBLE | ||||
284 | } |