Changeset 52111 in webkit
- Timestamp:
- Dec 14, 2009 12:42:41 PM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/ChangeLog
r52110 r52111 1 2009-12-14 Benjamin Poulain <benjamin.poulain@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Improve the autotests of QtWebkit 6 https://bugs.webkit.org/show_bug.cgi?id=32216 7 8 Refactor tst_qwebelement to remove the qWait() 9 10 * tests/qwebelement/tst_qwebelement.cpp: 11 (tst_QWebElement::style): 12 1 13 2009-12-14 Andreas Kling <andreas.kling@nokia.com> 2 14 -
trunk/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
r51111 r52111 19 19 20 20 21 #include <../util.h> 21 22 #include <QtTest/QtTest> 22 23 23 #include <qwebpage.h> 24 24 #include <qwidget.h> … … 28 28 //TESTED_CLASS= 29 29 //TESTED_FILES= 30 31 /**32 * Starts an event loop that runs until the given signal is received.33 Optionally the event loop34 * can return earlier on a timeout.35 *36 * \return \p true if the requested signal was received37 * \p false on timeout38 */39 static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0)40 {41 QEventLoop loop;42 QObject::connect(obj, signal, &loop, SLOT(quit()));43 QTimer timer;44 QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));45 if (timeout > 0) {46 QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));47 timer.setSingleShot(true);48 timer.start(timeout);49 }50 loop.exec();51 return timeoutSpy.isEmpty();52 }53 30 54 31 class tst_QWebElement : public QObject … … 577 554 578 555 // in few seconds, the CSS should be completey loaded 579 QSignalSpy spy(m_page, SIGNAL(loadFinished(bool)));580 556 m_mainFrame->setHtml(html6); 581 QTest::qWait(200);557 waitForSignal(m_page, SIGNAL(loadFinished(bool)), 200); 582 558 583 559 p = m_mainFrame->documentElement().findAll("p").at(0); … … 597 573 // in few seconds, the style should be completey loaded 598 574 m_mainFrame->setHtml(html7); 599 QTest::qWait(200);575 waitForSignal(m_page, SIGNAL(loadFinished(bool)), 200); 600 576 601 577 p = m_mainFrame->documentElement().findAll("p").at(0);
Note: See TracChangeset
for help on using the changeset viewer.