Changeset 134228 in webkit
- Timestamp:
- Nov 12, 2012 7:24:41 AM (11 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/ChangeLog
r134062 r134228 1 2012-11-08 Jocelyn Turcotte <jocelyn.turcotte@digia.com> 2 3 [Qt] Fix tst_QWebPage::inputMethods on Qt5 4 https://bugs.webkit.org/show_bug.cgi?id=101571 5 6 Reviewed by Simon Hausmann. 7 8 QEvent::RequestSoftwareInputPanel isn't passed through event filters anymore. 9 Use QInputMethodPrivate::testContext instead to capture input method events, 10 the same way as qtbase tests like tst_QTextEdit are doing. 11 12 * tests/qwebpage/tst_qwebpage.cpp: 13 (TestInputContext::TestInputContext): 14 (TestInputContext::~TestInputContext): 15 (TestInputContext): 16 (TestInputContext::showInputPanel): 17 (TestInputContext::hideInputPanel): 18 (TestInputContext::isInputPanelVisible): 19 (tst_QWebPage::inputMethods): 20 1 21 2012-11-09 Jocelyn Turcotte <jocelyn.turcotte@digia.com> 2 22 -
trunk/Source/WebKit/qt/tests/qwebpage/qwebpage.pro
r99274 r134228 1 1 include(../tests.pri) 2 2 exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc 3 QT *= core-private gui-private -
trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r134062 r134228 33 33 #include <QtTest/QtTest> 34 34 #include <QTextCharFormat> 35 #include <private/qinputmethod_p.h> 35 36 #include <qgraphicsscene.h> 36 37 #include <qgraphicsview.h> … … 38 39 #include <qnetworkcookiejar.h> 39 40 #include <qnetworkrequest.h> 41 #include <qpa/qplatforminputcontext.h> 40 42 #include <qwebdatabase.h> 41 43 #include <qwebelement.h> … … 59 61 } 60 62 61 class EventSpy : public QObject, public QList<QEvent::Type> 62 { 63 Q_OBJECT 63 class TestInputContext : public QPlatformInputContext 64 { 64 65 public: 65 EventSpy(QObject* objectToSpy) 66 { 67 objectToSpy->installEventFilter(this); 68 } 69 70 virtual bool eventFilter(QObject* receiver, QEvent* event) 71 { 72 append(event->type()); 73 return false; 74 } 66 TestInputContext() 67 : m_visible(false) 68 { 69 QInputMethodPrivate* inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); 70 inputMethodPrivate->testContext = this; 71 } 72 73 ~TestInputContext() 74 { 75 QInputMethodPrivate* inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); 76 inputMethodPrivate->testContext = 0; 77 } 78 79 virtual void showInputPanel() 80 { 81 m_visible = true; 82 } 83 virtual void hideInputPanel() 84 { 85 m_visible = false; 86 } 87 virtual bool isInputPanelVisible() const 88 { 89 return m_visible; 90 } 91 92 bool m_visible; 75 93 }; 76 94 … … 1646 1664 page->mainFrame()->setFocus(); 1647 1665 1648 EventSpy viewEventSpy(container);1666 TestInputContext testContext; 1649 1667 1650 1668 QWebElementCollection inputs = page->mainFrame()->documentElement().findAll("input"); … … 1671 1689 // this part of the test can verified as the checks below. 1672 1690 if (inputPanel) 1673 QVERIFY( viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));1691 QVERIFY(testContext.isInputPanelVisible()); 1674 1692 else 1675 QVERIFY(! viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));1676 viewEventSpy.clear();1693 QVERIFY(!testContext.isInputPanelVisible()); 1694 testContext.hideInputPanel(); 1677 1695 1678 1696 clickOnPage(page, textInputCenter); 1679 QVERIFY( viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));1697 QVERIFY(testContext.isInputPanelVisible()); 1680 1698 1681 1699 //ImMicroFocus … … 1882 1900 1883 1901 page->mainFrame()->setHtml("<html><body><p>nothing to input here"); 1884 viewEventSpy.clear();1902 testContext.hideInputPanel(); 1885 1903 1886 1904 QWebElement para = page->mainFrame()->findFirstElement("p"); 1887 1905 clickOnPage(page, para.geometry().center()); 1888 1906 1889 QVERIFY(! viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));1907 QVERIFY(!testContext.isInputPanelVisible()); 1890 1908 1891 1909 //START - Test for sending empty QInputMethodEvent … … 2219 2237 clickOnPage(page, inputElement.geometry().center()); 2220 2238 2221 QVERIFY(! viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));2239 QVERIFY(!testContext.isInputPanelVisible()); 2222 2240 2223 2241 // START - Newline test for textarea
Note: See TracChangeset
for help on using the changeset viewer.