summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-08-12 15:06:36 (GMT)
committeraxis <qt-info@nokia.com>2009-08-12 15:06:36 (GMT)
commita3614f43de22351cd3ad14dce06e79f3111842d1 (patch)
treec26fa0305e814421d2103d2b9fe4da8bd1223dc6 /tests
parentf888b7c0934069771812c458faaad12bb72d3971 (diff)
parentecb4110040218fafaad8717c7c58de1086d3590d (diff)
downloadQt-a3614f43de22351cd3ad14dce06e79f3111842d1.zip
Qt-a3614f43de22351cd3ad14dce06e79f3111842d1.tar.gz
Qt-a3614f43de22351cd3ad14dce06e79f3111842d1.tar.bz2
Merge branch 'sipOnMouseFocusRefactoring'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 1ab950e..05f79e5 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -47,6 +47,7 @@
#include <qplaintextedit.h>
#include <qlayout.h>
#include <qradiobutton.h>
+#include <qwindowsstyle.h>
class tst_QInputContext : public QObject
{
@@ -122,8 +123,37 @@ void tst_QInputContext::filterMouseEvents()
le.setInputContext(0);
}
+class RequestSoftwareInputPanelStyle : public QWindowsStyle
+{
+public:
+ RequestSoftwareInputPanelStyle()
+ : m_rsipBehavior(RSIP_OnMouseClickAndAlreadyFocused)
+ {
+ }
+ ~RequestSoftwareInputPanelStyle()
+ {
+ }
+
+ int styleHint(StyleHint hint, const QStyleOption *opt = 0,
+ const QWidget *widget = 0, QStyleHintReturn* returnData = 0) const
+ {
+ if (hint == SH_RequestSoftwareInputPanel) {
+ return m_rsipBehavior;
+ } else {
+ return QWindowsStyle::styleHint(hint, opt, widget, returnData);
+ }
+ }
+
+ RequestSoftwareInputPanel m_rsipBehavior;
+};
+
void tst_QInputContext::requestSoftwareInputPanel()
{
+ QStyle *oldStyle = qApp->style();
+ oldStyle->setParent(this); // Prevent it being deleted.
+ RequestSoftwareInputPanelStyle *newStyle = new RequestSoftwareInputPanelStyle;
+ qApp->setStyle(newStyle);
+
QWidget w;
QLayout *layout = new QVBoxLayout;
QLineEdit *le1, *le2;
@@ -143,13 +173,13 @@ void tst_QInputContext::requestSoftwareInputPanel()
QApplication::setActiveWindow(&w);
// Testing single click panel activation.
- qApp->setAutoSipOnMouseFocus(true);
+ newStyle->m_rsipBehavior = QStyle::RSIP_OnMouseClick;
QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
QVERIFY(ic2->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0);
ic2->lastTypes.clear();
// Testing double click panel activation.
- qApp->setAutoSipOnMouseFocus(false);
+ newStyle->m_rsipBehavior = QStyle::RSIP_OnMouseClickAndAlreadyFocused;
QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0);
QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
@@ -159,6 +189,9 @@ void tst_QInputContext::requestSoftwareInputPanel()
// Testing right mouse button
QTest::mouseClick(le1, Qt::RightButton, Qt::NoModifier, QPoint(5, 5));
QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0);
+
+ qApp->setStyle(oldStyle);
+ oldStyle->setParent(qApp);
}
void tst_QInputContext::closeSoftwareInputPanel()