summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 12:48:01 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 15:31:45 +0200
commit143c4d3e13a430b951f4f4f8c28db14303f80605 (patch)
tree2b89637b93fc7d81c674106008566010f986d67c /tests/auto/gui/kernel
parenta7ed81b557d593a8ddb43b71bf4bbf3b44ead070 (diff)
parente5337ad1b1fb02873ce7b5ca8db45f6fd8063352 (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp20
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp4
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp35
3 files changed, 58 insertions, 1 deletions
diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
index 3810546146..cfe26d23e7 100644
--- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
+++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
@@ -122,6 +122,8 @@ private slots:
void update();
void query();
void inputDirection();
+ void inputMethodAccepted();
+
private:
InputItem m_inputItem;
PlatformInputContext m_platformInputContext;
@@ -304,5 +306,23 @@ void tst_qinputmethod::inputDirection()
QCOMPARE(m_platformInputContext.m_localeCallCount, 1);
}
+void tst_qinputmethod::inputMethodAccepted()
+{
+ InputItem disabledItem;
+ disabledItem.setEnabled(false);
+
+ DummyWindow window;
+ window.show();
+ QTest::qWaitForWindowShown(&window);
+ window.requestActivateWindow();
+ QTRY_COMPARE(qApp->focusWindow(), &window);
+ window.setFocusObject(&disabledItem);
+
+ QCOMPARE(m_platformInputContext.inputMethodAccepted(), false);
+
+ window.setFocusObject(&m_inputItem);
+ QCOMPARE(m_platformInputContext.inputMethodAccepted(), true);
+}
+
QTEST_MAIN(tst_qinputmethod)
#include "tst_qinputmethod.moc"
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 861ad3835d..c4db74b6ec 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -422,7 +422,9 @@ void tst_QKeySequence::mnemonic()
QFETCH(QString, key);
QFETCH(bool, warning);
-#ifndef QT_NO_DEBUG
+#ifdef QT_NO_DEBUG
+ Q_UNUSED(warning)
+#else
if (warning) {
QString str = QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurrences of '&'").arg(string);
QTest::ignoreMessage(QtWarningMsg, qPrintable(str));
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index df58d8340b..3dc2886b80 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -69,6 +69,7 @@ private slots:
void close();
void activateAndClose();
void mouseEventSequence();
+ void windowModality();
void initTestCase()
{
@@ -223,6 +224,9 @@ void tst_QWindow::isExposed()
window.hide();
+#ifdef Q_OS_MAC
+ QEXPECT_FAIL("", "This test fails on Mac OS X, see QTBUG-23059", Abort);
+#endif
QTRY_VERIFY(window.received(QEvent::Expose) > 1);
QTRY_VERIFY(!window.isExposed());
}
@@ -804,5 +808,36 @@ void tst_QWindow::mouseEventSequence()
QCOMPARE(window.mouseSequenceSignature, QLatin1String("prprprpr"));
}
+void tst_QWindow::windowModality()
+{
+ qRegisterMetaType<Qt::WindowModality>("Qt::WindowModality");
+
+ QWindow window;
+ QSignalSpy spy(&window, SIGNAL(windowModalityChanged(Qt::WindowModality)));
+
+ QCOMPARE(window.windowModality(), Qt::NonModal);
+ window.setWindowModality(Qt::NonModal);
+ QCOMPARE(window.windowModality(), Qt::NonModal);
+ QCOMPARE(spy.count(), 0);
+
+ window.setWindowModality(Qt::WindowModal);
+ QCOMPARE(window.windowModality(), Qt::WindowModal);
+ QCOMPARE(spy.count(), 1);
+ window.setWindowModality(Qt::WindowModal);
+ QCOMPARE(window.windowModality(), Qt::WindowModal);
+ QCOMPARE(spy.count(), 1);
+
+ window.setWindowModality(Qt::ApplicationModal);
+ QCOMPARE(window.windowModality(), Qt::ApplicationModal);
+ QCOMPARE(spy.count(), 2);
+ window.setWindowModality(Qt::ApplicationModal);
+ QCOMPARE(window.windowModality(), Qt::ApplicationModal);
+ QCOMPARE(spy.count(), 2);
+
+ window.setWindowModality(Qt::NonModal);
+ QCOMPARE(window.windowModality(), Qt::NonModal);
+ QCOMPARE(spy.count(), 3);
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow)