diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-04-12 14:02:38 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-04-12 14:02:38 (GMT) |
commit | 50a8b8782ab3dab6446cca9a5528d6287df9d7d1 (patch) | |
tree | 1d53792f2fa08423bc8145cf5c2f7dc3d09f50cf /src/3rdparty/webkit/WebKit/qt/tests | |
parent | 0d288fa2112a00ecd8e160dd6ff70ba2e54153ee (diff) | |
download | Qt-50a8b8782ab3dab6446cca9a5528d6287df9d7d1.zip Qt-50a8b8782ab3dab6446cca9a5528d6287df9d7d1.tar.gz Qt-50a8b8782ab3dab6446cca9a5528d6287df9d7d1.tar.bz2 |
Update src/3rdparty/webkit from trunk.
Imported from 862268aeb7150d3795d05bfc05f661bb5c598a27
in branch qtwebkit-2.0 of repository
git://gitorious.org/+qtwebkit-developers/webkit/qtwebkit.git
Reviewed-by: TrustMe
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 35 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 53 |
2 files changed, 87 insertions, 1 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 37f7b88..72370ad 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -585,6 +585,7 @@ private slots: void render(); void scrollPosition(); void scrollToAnchor(); + void scrollbarsOff(); void evaluateWillCauseRepaint(); void qObjectWrapperWithSameIdentity(); void introspectQtMethods_data(); @@ -2514,7 +2515,7 @@ void tst_QWebFrame::popupFocus() // open the popup by clicking. check if focus is on the popup QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); - QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); + QObject* webpopup = firstChildByClassName(&view, "QComboBox"); QComboBox* combo = qobject_cast<QComboBox*>(webpopup); QVERIFY(combo != 0); QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup @@ -2796,6 +2797,38 @@ void tst_QWebFrame::scrollToAnchor() QVERIFY(frame->scrollPosition().y() != 0); } + +void tst_QWebFrame::scrollbarsOff() +{ + QWebView view; + QWebFrame* mainFrame = view.page()->mainFrame(); + + mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + + QString html("<script>" \ + " function checkScrollbar() {" \ + " if (innerWidth === document.documentElement.offsetWidth)" \ + " document.getElementById('span1').innerText = 'SUCCESS';" \ + " else" \ + " document.getElementById('span1').innerText = 'FAIL';" \ + " }" \ + "</script>" \ + "<body>" \ + " <div style='margin-top:1000px ; margin-left:1000px'>" \ + " <a id='offscreen' href='a'>End</a>" \ + " </div>" \ + "<span id='span1'></span>" \ + "</body>"); + + + view.setHtml(html); + ::waitForSignal(&view, SIGNAL(loadFinished(bool))); + + mainFrame->evaluateJavaScript("checkScrollbar();"); + QCOMPARE(mainFrame->documentElement().findAll("span").at(0).toPlainText(), QString("SUCCESS")); +} + void tst_QWebFrame::evaluateWillCauseRepaint() { QWebView view; diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 4425bac..1f97e69 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -26,6 +26,7 @@ #include <QMenu> #include <QPushButton> #include <QtTest/QtTest> +#include <QTextCharFormat> #include <qgraphicsscene.h> #include <qgraphicsview.h> #include <qgraphicswebview.h> @@ -98,6 +99,8 @@ private slots: void consoleOutput(); void inputMethods_data(); void inputMethods(); + void inputMethodsTextFormat_data(); + void inputMethodsTextFormat(); void defaultTextEncoding(); void errorPageExtension(); void errorPageExtensionInIFrames(); @@ -1479,6 +1482,56 @@ void tst_QWebPage::inputMethods() delete container; } +void tst_QWebPage::inputMethodsTextFormat_data() +{ + QTest::addColumn<QString>("string"); + QTest::addColumn<int>("start"); + QTest::addColumn<int>("length"); + + QTest::newRow("") << QString("") << 0 << 0; + QTest::newRow("Q") << QString("Q") << 0 << 1; + QTest::newRow("Qt") << QString("Qt") << 0 << 1; + QTest::newRow("Qt") << QString("Qt") << 0 << 2; + QTest::newRow("Qt") << QString("Qt") << 1 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 0 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 1 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 2 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 2 << -1; + QTest::newRow("Qt ") << QString("Qt ") << -2 << 3; + QTest::newRow("Qt ") << QString("Qt ") << 0 << 3; + QTest::newRow("Qt by") << QString("Qt by") << 0 << 1; + QTest::newRow("Qt by Nokia") << QString("Qt by Nokia") << 0 << 1; +} + + +void tst_QWebPage::inputMethodsTextFormat() +{ + QWebPage* page = new QWebPage; + QWebView* view = new QWebView; + view->setPage(page); + page->settings()->setFontFamily(QWebSettings::SerifFont, "FooSerifFont"); + page->mainFrame()->setHtml("<html><body>" \ + "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>"); + page->mainFrame()->evaluateJavaScript("document.getElementById('input1').focus()"); + page->mainFrame()->setFocus(); + view->show(); + + QFETCH(QString, string); + QFETCH(int, start); + QFETCH(int, length); + + QList<QInputMethodEvent::Attribute> attrs; + QTextCharFormat format; + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + format.setUnderlineColor(Qt::red); + attrs.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, start, length, format)); + QInputMethodEvent im(string, attrs); + page->event(&im); + + QTest::qWait(1000); + + delete view; +} // import a little DRT helper function to trigger the garbage collector void QWEBKIT_EXPORT qt_drt_garbageCollector_collect(); |