Changeset 66298 in webkit
- Timestamp:
- Aug 27, 2010 10:18:29 PM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/ChangeLog
r66297 r66298 1 2010-08-27 Benjamin Poulain <benjamin.poulain@nokia.com> 2 3 Reviewed by Antonio Gomes. 4 5 [Qt] tst_QWebView::focusInputTypes() fails on MeeGo Handset with WebKit 2.1 6 https://bugs.webkit.org/show_bug.cgi?id=44761 7 8 Make the test more robust to changes in the execution environment. The click 9 are now correctly simulated, and the position are determined from the content. 10 11 The test also create the view and page on the stack to avoid the leak when the 12 test is failing. 13 14 * tests/qwebview/tst_qwebview.cpp: 15 (tst_QWebView::focusInputTypes): 16 1 17 2010-08-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> 2 18 -
trunk/WebKit/qt/tests/qwebview/tst_qwebview.cpp
r64727 r66298 29 29 #include <qdiriterator.h> 30 30 #include <qwebkitversion.h> 31 #include <qwebelement.h> 31 32 #include <qwebframe.h> 32 33 … … 51 52 52 53 void crashTests(); 53 };54 55 class WebView : public QWebView56 {57 Q_OBJECT58 59 public:60 void fireMouseClick(QPoint point) {61 QMouseEvent presEv(QEvent::MouseButtonPress, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);62 QMouseEvent relEv(QEvent::MouseButtonRelease, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);63 QWebView::mousePressEvent(&presEv);64 QWebView::mousePressEvent(&relEv);65 }66 67 54 }; 68 55 … … 246 233 void tst_QWebView::focusInputTypes() 247 234 { 248 QWebPage* page = new QWebPage; 249 WebView* webView = new WebView; 250 webView->setPage( page ); 251 252 QCoreApplication::processEvents(); 235 QWebView webView; 236 webView.show(); 237 QTest::qWaitForWindowShown(&webView); 238 253 239 QUrl url("qrc:///resources/input_types.html"); 254 page->mainFrame()->load(url); 255 page->mainFrame()->setFocus(); 256 257 QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); 240 QWebFrame* const mainFrame = webView.page()->mainFrame(); 241 mainFrame->load(url); 242 mainFrame->setFocus(); 243 244 QVERIFY(waitForSignal(&webView, SIGNAL(loadFinished(bool)))); 258 245 259 246 // 'text' type 260 webView->fireMouseClick(QPoint(20, 10)); 247 QWebElement inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=text]")); 248 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 261 249 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) 262 QVERIFY(webView ->inputMethodHints() & Qt::ImhNoAutoUppercase);263 QVERIFY(webView ->inputMethodHints() & Qt::ImhNoPredictiveText);250 QVERIFY(webView.inputMethodHints() & Qt::ImhNoAutoUppercase); 251 QVERIFY(webView.inputMethodHints() & Qt::ImhNoPredictiveText); 264 252 #else 265 QVERIFY(webView ->inputMethodHints() == Qt::ImhNone);253 QVERIFY(webView.inputMethodHints() == Qt::ImhNone); 266 254 #endif 267 QVERIFY(webView ->testAttribute(Qt::WA_InputMethodEnabled));255 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 268 256 269 257 // 'password' field 270 webView->fireMouseClick(QPoint(20, 60)); 271 QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); 272 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 258 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=password]")); 259 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 260 QVERIFY(webView.inputMethodHints() == Qt::ImhHiddenText); 261 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 273 262 274 263 // 'tel' field 275 webView->fireMouseClick(QPoint(20, 110)); 276 QVERIFY(webView->inputMethodHints() == Qt::ImhDialableCharactersOnly); 277 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 264 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=tel]")); 265 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 266 QVERIFY(webView.inputMethodHints() == Qt::ImhDialableCharactersOnly); 267 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 278 268 279 269 // 'number' field 280 webView->fireMouseClick(QPoint(20, 160)); 281 QVERIFY(webView->inputMethodHints() == Qt::ImhDigitsOnly); 282 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 270 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=number]")); 271 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 272 QVERIFY(webView.inputMethodHints() == Qt::ImhDigitsOnly); 273 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 283 274 284 275 // 'email' field 285 webView->fireMouseClick(QPoint(20, 210)); 286 QVERIFY(webView->inputMethodHints() == Qt::ImhEmailCharactersOnly); 287 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 276 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=email]")); 277 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 278 QVERIFY(webView.inputMethodHints() == Qt::ImhEmailCharactersOnly); 279 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 288 280 289 281 // 'url' field 290 webView->fireMouseClick(QPoint(20, 260)); 291 QVERIFY(webView->inputMethodHints() == Qt::ImhUrlCharactersOnly); 292 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 282 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=url]")); 283 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 284 QVERIFY(webView.inputMethodHints() == Qt::ImhUrlCharactersOnly); 285 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 293 286 294 287 // 'password' field 295 webView->fireMouseClick(QPoint(20, 60)); 296 QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); 297 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 288 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=password]")); 289 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 290 QVERIFY(webView.inputMethodHints() == Qt::ImhHiddenText); 291 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 298 292 299 293 // 'text' type 300 webView->fireMouseClick(QPoint(20, 10)); 294 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=text]")); 295 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 301 296 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) 302 QVERIFY(webView ->inputMethodHints() & Qt::ImhNoAutoUppercase);303 QVERIFY(webView ->inputMethodHints() & Qt::ImhNoPredictiveText);297 QVERIFY(webView.inputMethodHints() & Qt::ImhNoAutoUppercase); 298 QVERIFY(webView.inputMethodHints() & Qt::ImhNoPredictiveText); 304 299 #else 305 QVERIFY(webView ->inputMethodHints() == Qt::ImhNone);300 QVERIFY(webView.inputMethodHints() == Qt::ImhNone); 306 301 #endif 307 QVERIFY(webView ->testAttribute(Qt::WA_InputMethodEnabled));302 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 308 303 309 304 // 'password' field 310 webView->fireMouseClick(QPoint(20, 60)); 311 QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); 312 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 305 inputElement = mainFrame->documentElement().findFirst(QLatin1String("input[type=password]")); 306 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 307 QVERIFY(webView.inputMethodHints() == Qt::ImhHiddenText); 308 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 313 309 314 310 // 'text area' field 315 webView->fireMouseClick(QPoint(20, 320)); 316 QVERIFY(webView->inputMethodHints() == Qt::ImhNone); 317 QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); 318 319 delete webView; 320 311 inputElement = mainFrame->documentElement().findFirst(QLatin1String("textarea")); 312 QTest::mouseClick(&webView, Qt::LeftButton, 0, inputElement.geometry().center()); 313 QVERIFY(webView.inputMethodHints() == Qt::ImhNone); 314 QVERIFY(webView.testAttribute(Qt::WA_InputMethodEnabled)); 321 315 } 322 316
Note: See TracChangeset
for help on using the changeset viewer.