- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
r561 r846 1 TEMPLATE = app 2 TARGET = tst_qgraphicswebview 3 include(../../../../WebKit.pri) 4 SOURCES += tst_qgraphicswebview.cpp 5 QT += testlib network 6 QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR 7 8 symbian { 9 TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices 10 } 1 isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. 2 include(../tests.pri) 3 exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc -
trunk/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
r561 r846 18 18 */ 19 19 20 20 21 #include <QtTest/QtTest> 21 22 #include <QGraphicsSceneMouseEvent> 22 23 #include <QGraphicsView> 23 24 #include <qgraphicswebview.h> … … 25 26 #include <qwebframe.h> 26 27 27 /**28 * Starts an event loop that runs until the given signal is received.29 * Optionally the event loop30 * can return earlier on a timeout.31 *32 * \return \p true if the requested signal was received33 * \p false on timeout34 */35 static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)36 {37 QEventLoop loop;38 QObject::connect(obj, signal, &loop, SLOT(quit()));39 QTimer timer;40 QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));41 if (timeout > 0) {42 QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));43 timer.setSingleShot(true);44 timer.start(timeout);45 }46 loop.exec();47 return timeoutSpy.isEmpty();48 }49 50 28 class tst_QGraphicsWebView : public QObject 51 29 { … … 55 33 void qgraphicswebview(); 56 34 void crashOnViewlessWebPages(); 35 36 37 57 38 }; 58 39 … … 98 79 }; 99 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 100 104 void tst_QGraphicsWebView::crashOnViewlessWebPages() 101 105 { … … 107 111 webView->setPage(page); 108 112 page->webView = webView; 109 connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting()));110 111 113 scene.addItem(webView); 112 114 … … 114 116 view.resize(600, 480); 115 117 webView->resize(view.geometry().size()); 116 QTest::qWait(200); 118 119 QCoreApplication::processEvents(); 117 120 view.show(); 121 122 123 124 118 125 119 126 page->mainFrame()->setHtml(QString("data:text/html," … … 123 130 "</frameset>")); 124 131 125 QVERIFY(::waitForSignal(page, SIGNAL(loadFinished(bool)))); 126 } 132 QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); 133 delete page; 134 } 135 136 void tst_QGraphicsWebView::crashOnSetScaleBeforeSetUrl() 137 { 138 QGraphicsWebView* webView = new QGraphicsWebView; 139 webView->setScale(2.0); 140 delete webView; 141 } 142 143 void tst_QGraphicsWebView::microFocusCoordinates() 144 { 145 QWebPage* page = new QWebPage; 146 QGraphicsWebView* webView = new QGraphicsWebView; 147 webView->setPage( page ); 148 QGraphicsView* view = new QGraphicsView; 149 QGraphicsScene* scene = new QGraphicsScene(view); 150 view->setScene(scene); 151 scene->addItem(webView); 152 view->setGeometry(QRect(0,0,500,500)); 153 154 page->mainFrame()->setHtml("<html><body>" \ 155 "<input type='text' id='input1' style='font--family: serif' value='' maxlength='20'/><br>" \ 156 "<canvas id='canvas1' width='500' height='500'/>" \ 157 "<input type='password'/><br>" \ 158 "<canvas id='canvas2' width='500' height='500'/>" \ 159 "</body></html>"); 160 161 page->mainFrame()->setFocus(); 162 163 QVariant initialMicroFocus = page->inputMethodQuery(Qt::ImMicroFocus); 164 QVERIFY(initialMicroFocus.isValid()); 165 166 page->mainFrame()->scroll(0,300); 167 168 QVariant currentMicroFocus = page->inputMethodQuery(Qt::ImMicroFocus); 169 QVERIFY(currentMicroFocus.isValid()); 170 171 QCOMPARE(initialMicroFocus.toRect().translated(QPoint(0,-300)), currentMicroFocus.toRect()); 172 173 delete view; 174 } 175 176 void tst_QGraphicsWebView::focusInputTypes() 177 { 178 QWebPage* page = new QWebPage; 179 GraphicsWebView* webView = new GraphicsWebView; 180 webView->setPage( page ); 181 QGraphicsView* view = new QGraphicsView; 182 QGraphicsScene* scene = new QGraphicsScene(view); 183 view->setScene(scene); 184 scene->addItem(webView); 185 view->setGeometry(QRect(0,0,500,500)); 186 QCoreApplication::processEvents(); 187 QUrl url("qrc:///resources/input_types.html"); 188 page->mainFrame()->load(url); 189 page->mainFrame()->setFocus(); 190 191 QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); 192 193 // 'text' type 194 webView->fireMouseClick(QPointF(20.0, 10.0)); 195 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) 196 QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); 197 QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); 198 #else 199 QVERIFY(webView->inputMethodHints() == Qt::ImhNone); 200 #endif 201 202 // 'password' field 203 webView->fireMouseClick(QPointF(20.0, 60.0)); 204 QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); 205 206 // 'tel' field 207 webView->fireMouseClick(QPointF(20.0, 110.0)); 208 QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); 209 210 // 'number' field 211 webView->fireMouseClick(QPointF(20.0, 160.0)); 212 QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); 213 214 // 'email' field 215 webView->fireMouseClick(QPointF(20.0, 210.0)); 216 QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); 217 218 // 'url' field 219 webView->fireMouseClick(QPointF(20.0, 260.0)); 220 QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); 221 222 delete webView; 223 delete view; 224 } 225 226 127 227 128 228 QTEST_MAIN(tst_QGraphicsWebView)
Note:
See TracChangeset
for help on using the changeset viewer.