summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/kernel.pro3
-rw-r--r--tests/auto/gui/kernel/qclipboard/copier/main.cpp4
-rw-r--r--tests/auto/gui/kernel/qclipboard/paster/main.cpp4
-rw-r--r--tests/auto/gui/kernel/qclipboard/qclipboard.pro6
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/test.pro11
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp12
-rw-r--r--tests/auto/gui/kernel/qdrag/tst_qdrag.cpp4
-rw-r--r--tests/auto/gui/kernel/qevent/tst_qevent.cpp4
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp4
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp4
-rw-r--r--tests/auto/gui/kernel/qguiapplication/qguiapplication.pro4
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp156
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp4
-rw-r--r--tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp4
-rw-r--r--tests/auto/gui/kernel/qinputmethod/qinputmethod.pro4
-rw-r--r--tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp (renamed from tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp)144
-rw-r--r--tests/auto/gui/kernel/qinputpanel/qinputpanel.pro4
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp55
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp4
-rw-r--r--tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp4
-rw-r--r--tests/auto/gui/kernel/qpalette/tst_qpalette.cpp4
-rw-r--r--tests/auto/gui/kernel/qscreen/tst_qscreen.cpp25
-rw-r--r--tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp4
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp4
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp74
25 files changed, 407 insertions, 143 deletions
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index e473463828..1adae128cf 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -6,7 +6,7 @@ SUBDIRS=\
qfileopenevent \
qguimetatype \
qguivariant \
- qinputpanel \
+ qinputmethod \
qkeysequence \
qmouseevent \
qmouseevent_modal \
@@ -15,3 +15,4 @@ SUBDIRS=\
qshortcut \
qtouchevent \
qwindow \
+ qguiapplication \
diff --git a/tests/auto/gui/kernel/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp
index 7e3efa03ba..bbce35a15d 100644
--- a/tests/auto/gui/kernel/qclipboard/copier/main.cpp
+++ b/tests/auto/gui/kernel/qclipboard/copier/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp
index 3ca4886f0b..473ea8bd42 100644
--- a/tests/auto/gui/kernel/qclipboard/paster/main.cpp
+++ b/tests/auto/gui/kernel/qclipboard/paster/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qclipboard/qclipboard.pro b/tests/auto/gui/kernel/qclipboard/qclipboard.pro
index 692ca5dd3f..d97c58dea0 100644
--- a/tests/auto/gui/kernel/qclipboard/qclipboard.pro
+++ b/tests/auto/gui/kernel/qclipboard/qclipboard.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = test copier paster
-
-
+SUBDIRS = copier paster
+test.depends += $$SUBDIRS
+SUBDIRS += test
diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro
index 1c92fa4107..4be6769592 100644
--- a/tests/auto/gui/kernel/qclipboard/test/test.pro
+++ b/tests/auto/gui/kernel/qclipboard/test/test.pro
@@ -12,12 +12,11 @@ win32 {
}
wince* {
- copier.files = ../copier/copier.exe
- copier.path = copier
- paster.files = ../paster/paster.exe
- paster.path = paster
-
- DEPLOYMENT += copier paster rsc reg_resource
+ DEPLOYMENT += rsc reg_resource
}
mac: CONFIG += insignificant_test # QTBUG-23057
+
+load(testcase) # for target.path and installTestHelperApp()
+installTestHelperApp("../copier/copier",copier,copier)
+installTestHelperApp("../paster/paster",paster,paster)
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index fcba0958e7..e1b0535e2f 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,7 +46,7 @@
#include <QtCore/QDir>
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
#include <Carbon/Carbon.h>
#endif
@@ -74,7 +74,7 @@ void tst_QClipboard::init()
bool tst_QClipboard::nativeClipboardWorking()
{
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
PasteboardRef pasteboard;
OSStatus status = PasteboardCreate(0, &pasteboard);
if (status == noErr)
@@ -295,7 +295,7 @@ void tst_QClipboard::setMimeData()
QCOMPARE(spySelection.count(), 1);
QCOMPARE(spyData.count(), 1);
QCOMPARE(spyFindBuffer.count(), 0);
-#elif defined(Q_WS_MAC)
+#elif defined(Q_OS_MAC)
QCOMPARE(spySelection.count(), 0);
QCOMPARE(spyData.count(), 1);
QCOMPARE(spyFindBuffer.count(), 1);
@@ -328,7 +328,7 @@ void tst_QClipboard::setMimeData()
QCOMPARE(spySelection.count(), 1);
QCOMPARE(spyData.count(), 1);
QCOMPARE(spyFindBuffer.count(), 0);
-#elif defined(Q_WS_MAC)
+#elif defined(Q_OS_MAC)
QCOMPARE(spySelection.count(), 0);
QCOMPARE(spyData.count(), 1);
QCOMPARE(spyFindBuffer.count(), 1);
diff --git a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp
index 47ff1b05f1..ae9cd55b7c 100644
--- a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp
+++ b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qevent/tst_qevent.cpp b/tests/auto/gui/kernel/qevent/tst_qevent.cpp
index f0771330f7..1d60ff2609 100644
--- a/tests/auto/gui/kernel/qevent/tst_qevent.cpp
+++ b/tests/auto/gui/kernel/qevent/tst_qevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp
index 0c0bff551b..9d138f6a2e 100644
--- a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp
+++ b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
index 207356fe84..770b729761 100644
--- a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
+++ b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
new file mode 100644
index 0000000000..fffa097d73
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qguiapplication
+QT += core gui testlib
+SOURCES = tst_qguiapplication.cpp
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
new file mode 100644
index 0000000000..2fd875b7f4
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QWindow>
+#include <QDebug>
+
+class tst_QGuiApplication: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void focusObject();
+ void allWindows();
+ void topLevelWindows();
+};
+
+class DummyWindow : public QWindow
+{
+public:
+ DummyWindow() : m_focusObject(0) {}
+
+ virtual QObject *focusObject() const
+ {
+ return m_focusObject;
+ }
+
+ void setFocusObject(QObject *object)
+ {
+ m_focusObject = object;
+ emit focusObjectChanged(object);
+ }
+
+ QObject *m_focusObject;
+};
+
+
+void tst_QGuiApplication::focusObject()
+{
+ int argc = 0;
+ QGuiApplication app(argc, 0);
+
+ QObject obj1, obj2, obj3;
+ DummyWindow window1;
+ DummyWindow window2;
+ window1.show();
+
+ QSignalSpy spy(&app, SIGNAL(focusObjectChanged(QObject *)));
+
+
+ // verify active window focus propagates to qguiapplication
+ QTest::qWaitForWindowShown(&window1);
+ window1.requestActivateWindow();
+ QTRY_COMPARE(app.focusWindow(), &window1);
+
+ window1.setFocusObject(&obj1);
+ QCOMPARE(app.focusObject(), &obj1);
+ QCOMPARE(spy.count(), 1);
+
+ spy.clear();
+ window1.setFocusObject(&obj2);
+ QCOMPARE(app.focusObject(), &obj2);
+ QCOMPARE(spy.count(), 1);
+
+ spy.clear();
+ window2.setFocusObject(&obj3);
+ QCOMPARE(app.focusObject(), &obj2); // not yet changed
+ window2.show();
+ QTest::qWaitForWindowShown(&window2);
+ QTRY_COMPARE(app.focusWindow(), &window2);
+ QCOMPARE(app.focusObject(), &obj3);
+ QCOMPARE(spy.count(), 1);
+
+ // focus change on unfocused window does not show
+ spy.clear();
+ window1.setFocusObject(&obj1);
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(app.focusObject(), &obj3);
+}
+
+void tst_QGuiApplication::allWindows()
+{
+ int argc = 0;
+ QGuiApplication app(argc, 0);
+ QWindow *window1 = new QWindow;
+ QWindow *window2 = new QWindow(window1);
+ QVERIFY(app.allWindows().contains(window1));
+ QVERIFY(app.allWindows().contains(window2));
+ QCOMPARE(app.allWindows().count(), 2);
+ delete window1;
+ window1 = 0;
+ window2 = 0;
+ QVERIFY(!app.allWindows().contains(window2));
+ QVERIFY(!app.allWindows().contains(window1));
+ QCOMPARE(app.allWindows().count(), 0);
+}
+
+void tst_QGuiApplication::topLevelWindows()
+{
+ int argc = 0;
+ QGuiApplication app(argc, 0);
+ QWindow *window1 = new QWindow;
+ QWindow *window2 = new QWindow(window1);
+ QVERIFY(app.topLevelWindows().contains(window1));
+ QVERIFY(!app.topLevelWindows().contains(window2));
+ QCOMPARE(app.topLevelWindows().count(), 1);
+ delete window1;
+ window1 = 0;
+ window2 = 0;
+ QVERIFY(!app.topLevelWindows().contains(window2));
+ QVERIFY(!app.topLevelWindows().contains(window1));
+ QCOMPARE(app.topLevelWindows().count(), 0);
+}
+
+QTEST_APPLESS_MAIN(tst_QGuiApplication)
+#include "tst_qguiapplication.moc"
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index d0f12ea945..0514eafa2d 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp
index 56a1fb0d8f..90984eb9f9 100644
--- a/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qinputmethod/qinputmethod.pro b/tests/auto/gui/kernel/qinputmethod/qinputmethod.pro
new file mode 100644
index 0000000000..015cc782eb
--- /dev/null
+++ b/tests/auto/gui/kernel/qinputmethod/qinputmethod.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qinputmethod
+SOURCES += tst_qinputmethod.cpp
+QT += core-private gui-private testlib
diff --git a/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
index b46899a84d..c10d954489 100644
--- a/tests/auto/gui/kernel/qinputpanel/tst_qinputpanel.cpp
+++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,7 +42,7 @@
#include <QtTest/QtTest>
#include <private/qguiapplication_p.h>
-#include <private/qinputpanel_p.h>
+#include <private/qinputmethod_p.h>
#include <qplatforminputcontext_qpa.h>
class PlatformInputContext : public QPlatformInputContext
@@ -57,7 +57,7 @@ public:
m_localeCallCount(0),
m_inputDirectionCallCount(0),
m_lastQueries(Qt::ImhNone),
- m_action(QInputPanel::Click),
+ m_action(QInputMethod::Click),
m_cursorPosition(0),
m_lastEventType(QEvent::None)
{}
@@ -72,7 +72,7 @@ public:
m_updateCallCount++;
m_lastQueries = queries;
}
- virtual void invokeAction(QInputPanel::Action action, int cursorPosition)
+ virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
{
m_action = action;
m_cursorPosition = cursorPosition;
@@ -112,7 +112,7 @@ public:
mutable int m_localeCallCount;
mutable int m_inputDirectionCallCount;
Qt::InputMethodQueries m_lastQueries;
- QInputPanel::Action m_action;
+ QInputMethod::Action m_action;
int m_cursorPosition;
int m_lastEventType;
QRectF m_keyboardRect;
@@ -139,12 +139,12 @@ public:
Qt::InputMethodQueries m_lastQueries;
};
-class tst_qinputpanel : public QObject
+class tst_qinputmethod : public QObject
{
Q_OBJECT
public:
- tst_qinputpanel() {}
- virtual ~tst_qinputpanel() {}
+ tst_qinputmethod() {}
+ virtual ~tst_qinputmethod() {}
private slots:
void initTestCase();
void visible();
@@ -164,158 +164,158 @@ private:
PlatformInputContext m_platformInputContext;
};
-void tst_qinputpanel::initTestCase()
+void tst_qinputmethod::initTestCase()
{
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &m_platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &m_platformInputContext;
}
-void tst_qinputpanel::visible()
+void tst_qinputmethod::visible()
{
- QCOMPARE(qApp->inputPanel()->visible(), false);
- qApp->inputPanel()->show();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
+ qApp->inputMethod()->show();
+ QCOMPARE(qApp->inputMethod()->visible(), true);
- qApp->inputPanel()->hide();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputMethod()->hide();
+ QCOMPARE(qApp->inputMethod()->visible(), false);
- qApp->inputPanel()->setVisible(true);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ qApp->inputMethod()->setVisible(true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
- qApp->inputPanel()->setVisible(false);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputMethod()->setVisible(false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
}
-void tst_qinputpanel::animating()
+void tst_qinputmethod::animating()
{
- QCOMPARE(qApp->inputPanel()->isAnimating(), false);
+ QCOMPARE(qApp->inputMethod()->isAnimating(), false);
m_platformInputContext.m_animating = true;
- QCOMPARE(qApp->inputPanel()->isAnimating(), true);
+ QCOMPARE(qApp->inputMethod()->isAnimating(), true);
m_platformInputContext.m_animating = false;
- QCOMPARE(qApp->inputPanel()->isAnimating(), false);
+ QCOMPARE(qApp->inputMethod()->isAnimating(), false);
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(animatingChanged()));
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(animatingChanged()));
m_platformInputContext.emitAnimatingChanged();
QCOMPARE(spy.count(), 1);
}
-void tst_qinputpanel::keyboarRectangle()
+void tst_qinputmethod::keyboarRectangle()
{
- QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF());
+ QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF());
m_platformInputContext.m_keyboardRect = QRectF(10, 20, 30, 40);
- QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF(10, 20, 30, 40));
+ QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40));
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(keyboardRectangleChanged()));
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(keyboardRectangleChanged()));
m_platformInputContext.emitKeyboardRectChanged();
QCOMPARE(spy.count(), 1);
}
-void tst_qinputpanel::inputItem()
+void tst_qinputmethod::inputItem()
{
- QVERIFY(!qApp->inputPanel()->inputItem());
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(inputItemChanged()));
+ QVERIFY(!qApp->inputMethod()->inputItem());
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(inputItemChanged()));
- qApp->inputPanel()->setInputItem(&m_inputItem);
+ qApp->inputMethod()->setInputItem(&m_inputItem);
- QCOMPARE(qApp->inputPanel()->inputItem(), &m_inputItem);
+ QCOMPARE(qApp->inputMethod()->inputItem(), &m_inputItem);
QCOMPARE(spy.count(), 1);
// reset
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->setInputItem(0);
}
-void tst_qinputpanel::inputItemTransform()
+void tst_qinputmethod::inputItemTransform()
{
- QCOMPARE(qApp->inputPanel()->inputItemTransform(), QTransform());
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(cursorRectangleChanged()));
+ QCOMPARE(qApp->inputMethod()->inputItemTransform(), QTransform());
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(cursorRectangleChanged()));
QTransform transform;
transform.translate(10, 10);
transform.scale(2, 2);
transform.shear(2, 2);
- qApp->inputPanel()->setInputItemTransform(transform);
+ qApp->inputMethod()->setInputItemTransform(transform);
- QCOMPARE(qApp->inputPanel()->inputItemTransform(), transform);
+ QCOMPARE(qApp->inputMethod()->inputItemTransform(), transform);
QCOMPARE(spy.count(), 1);
// reset
- qApp->inputPanel()->setInputItemTransform(QTransform());
+ qApp->inputMethod()->setInputItemTransform(QTransform());
}
-void tst_qinputpanel::cursorRectangle()
+void tst_qinputmethod::cursorRectangle()
{
- QCOMPARE(qApp->inputPanel()->cursorRectangle(), QRectF());
+ QCOMPARE(qApp->inputMethod()->cursorRectangle(), QRectF());
QTransform transform;
transform.translate(10, 10);
transform.scale(2, 2);
transform.shear(2, 2);
- qApp->inputPanel()->setInputItemTransform(transform);
- qApp->inputPanel()->setInputItem(&m_inputItem);
+ qApp->inputMethod()->setInputItemTransform(transform);
+ qApp->inputMethod()->setInputItem(&m_inputItem);
- QCOMPARE(qApp->inputPanel()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4)));
+ QCOMPARE(qApp->inputMethod()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4)));
// reset
- qApp->inputPanel()->setInputItem(0);
- qApp->inputPanel()->setInputItemTransform(QTransform());
+ qApp->inputMethod()->setInputItem(0);
+ qApp->inputMethod()->setInputItemTransform(QTransform());
}
-void tst_qinputpanel::invokeAction()
+void tst_qinputmethod::invokeAction()
{
- QCOMPARE(m_platformInputContext.m_action, QInputPanel::Click);
+ QCOMPARE(m_platformInputContext.m_action, QInputMethod::Click);
QCOMPARE(m_platformInputContext.m_cursorPosition, 0);
- qApp->inputPanel()->invokeAction(QInputPanel::ContextMenu, 5);
- QCOMPARE(m_platformInputContext.m_action, QInputPanel::ContextMenu);
+ qApp->inputMethod()->invokeAction(QInputMethod::ContextMenu, 5);
+ QCOMPARE(m_platformInputContext.m_action, QInputMethod::ContextMenu);
QCOMPARE(m_platformInputContext.m_cursorPosition, 5);
}
-void tst_qinputpanel::reset()
+void tst_qinputmethod::reset()
{
QCOMPARE(m_platformInputContext.m_resetCallCount, 0);
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
QCOMPARE(m_platformInputContext.m_resetCallCount, 1);
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
QCOMPARE(m_platformInputContext.m_resetCallCount, 2);
}
-void tst_qinputpanel::commit()
+void tst_qinputmethod::commit()
{
QCOMPARE(m_platformInputContext.m_commitCallCount, 0);
- qApp->inputPanel()->commit();
+ qApp->inputMethod()->commit();
QCOMPARE(m_platformInputContext.m_commitCallCount, 1);
- qApp->inputPanel()->commit();
+ qApp->inputMethod()->commit();
QCOMPARE(m_platformInputContext.m_commitCallCount, 2);
}
-void tst_qinputpanel::update()
+void tst_qinputmethod::update()
{
- qApp->inputPanel()->setInputItem(&m_inputItem);
+ qApp->inputMethod()->setInputItem(&m_inputItem);
QCOMPARE(m_platformInputContext.m_updateCallCount, 0);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImhNone));
- qApp->inputPanel()->update(Qt::ImQueryInput);
+ qApp->inputMethod()->update(Qt::ImQueryInput);
QCOMPARE(m_platformInputContext.m_updateCallCount, 1);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryInput));
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
QCOMPARE(m_platformInputContext.m_updateCallCount, 2);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryAll));
- QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF(10, 20, 30, 40));
+ QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40));
// reset
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->setInputItem(0);
}
-void tst_qinputpanel::query()
+void tst_qinputmethod::query()
{
QInputMethodQueryEvent query(Qt::InputMethodQueries(Qt::ImPreferredLanguage | Qt::ImCursorRectangle));
QGuiApplication::sendEvent(&m_inputItem, &query);
@@ -327,16 +327,16 @@ void tst_qinputpanel::query()
QCOMPARE(cursorRectangle, QRect(1,2,3,4));
}
-void tst_qinputpanel::inputDirection()
+void tst_qinputmethod::inputDirection()
{
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 0);
- qApp->inputPanel()->inputDirection();
+ qApp->inputMethod()->inputDirection();
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 1);
QCOMPARE(m_platformInputContext.m_localeCallCount, 0);
- qApp->inputPanel()->locale();
+ qApp->inputMethod()->locale();
QCOMPARE(m_platformInputContext.m_localeCallCount, 1);
}
-QTEST_MAIN(tst_qinputpanel)
-#include "tst_qinputpanel.moc"
+QTEST_MAIN(tst_qinputmethod)
+#include "tst_qinputmethod.moc"
diff --git a/tests/auto/gui/kernel/qinputpanel/qinputpanel.pro b/tests/auto/gui/kernel/qinputpanel/qinputpanel.pro
deleted file mode 100644
index 5e3f4b1504..0000000000
--- a/tests/auto/gui/kernel/qinputpanel/qinputpanel.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qinputpanel
-SOURCES += tst_qinputpanel.cpp
-QT += core-private gui-private testlib
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index fcc30a7afe..eed7977c82 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -47,7 +47,7 @@
#include <QTranslator>
#include <QLibraryInfo>
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
#include <Carbon/Carbon.h>
struct MacSpecialKey {
int key;
@@ -144,7 +144,7 @@ private slots:
private:
QTranslator *ourTranslator;
QTranslator *qtTranslator;
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
static const QString MacCtrl;
static const QString MacMeta;
static const QString MacAlt;
@@ -154,7 +154,7 @@ private:
};
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
const QString tst_QKeySequence::MacCtrl = QString(QChar(0x2318));
const QString tst_QKeySequence::MacMeta = QString(QChar(0x2303));
const QString tst_QKeySequence::MacAlt = QString(QChar(0x2325));
@@ -195,7 +195,7 @@ void tst_QKeySequence::operatorQString_data()
QTest::newRow( "No modifier" ) << 0 << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString( "\x0c5" );
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
QTest::newRow( "Ctrl+Left" ) << int(Qt::CTRL) << int(Qt::Key_Left) << QString( "Ctrl+Left" );
QTest::newRow( "Ctrl+," ) << int(Qt::CTRL) << int(Qt::Key_Comma) << QString( "Ctrl+," );
QTest::newRow( "Alt+Left" ) << int(Qt::ALT) << int(Qt::Key_Left) << QString( "Alt+Left" );
@@ -339,7 +339,7 @@ void tst_QKeySequence::standardKeys_data()
QTest::newRow("zoomOut") << (int)QKeySequence::ZoomOut<< QString("CTRL+-");
QTest::newRow("whatsthis") << (int)QKeySequence::WhatsThis<< QString("SHIFT+F1");
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_MAC)
QTest::newRow("help") << (int)QKeySequence::HelpContents<< QString("Ctrl+?");
QTest::newRow("nextChild") << (int)QKeySequence::NextChild << QString("CTRL+}");
QTest::newRow("previousChild") << (int)QKeySequence::PreviousChild << QString("CTRL+{");
@@ -371,7 +371,7 @@ void tst_QKeySequence::keyBindings()
{
QList<QKeySequence> bindings = QKeySequence::keyBindings(QKeySequence::Copy);
QList<QKeySequence> expected;
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_MAC)
expected << QKeySequence("CTRL+C");
#elif defined Q_WS_X11
expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
@@ -402,7 +402,7 @@ void tst_QKeySequence::mnemonic_data()
void tst_QKeySequence::mnemonic()
{
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
QSKIP("mnemonics are not used on Mac OS X");
#endif
QFETCH(QString, string);
@@ -429,7 +429,7 @@ void tst_QKeySequence::toString_data()
QTest::addColumn<QString>("platformString");
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
QTest::newRow("Ctrl+Left") << QString("Ctrl+Left") << QString("Ctrl+Left") << QString("Ctrl+Left");
QTest::newRow("Alt+Left") << QString("Alt+Left") << QString("Alt+Left") << QString("Alt+Left");
QTest::newRow("Alt+Shift+Left") << QString("Alt+Shift+Left") << QString("Alt+Shift+Left") << QString("Alt+Shift+Left");
@@ -529,17 +529,46 @@ void tst_QKeySequence::parseString_data()
QTest::addColumn<QString>("strSequence");
QTest::addColumn<QKeySequence>("keycode");
+ // Valid
QTest::newRow("A") << "A" << QKeySequence(Qt::Key_A);
QTest::newRow("a") << "a" << QKeySequence(Qt::Key_A);
QTest::newRow("Ctrl+Left") << "Ctrl+Left" << QKeySequence(Qt::CTRL + Qt::Key_Left);
- QTest::newRow("Ctrl++") << "Ctrl++" << QKeySequence(Qt::CTRL + Qt::Key_Plus);
+ QTest::newRow("CTRL+LEFT") << "CTRL+LEFT" << QKeySequence(Qt::CTRL + Qt::Key_Left);
QTest::newRow("Meta+A") << "Meta+a" << QKeySequence(Qt::META + Qt::Key_A);
+ QTest::newRow("mEtA+A") << "mEtA+a" << QKeySequence(Qt::META + Qt::Key_A);
+ QTest::newRow("Ctrl++") << "Ctrl++" << QKeySequence(Qt::CTRL + Qt::Key_Plus);
+
+ // Invalid modifiers
QTest::newRow("Win+A") << "Win+a" << QKeySequence(Qt::Key_unknown);
- QTest::newRow("4+3=2") << "4+3=2" << QKeySequence(Qt::Key_unknown);
QTest::newRow("Super+Meta+A") << "Super+Meta+A" << QKeySequence(Qt::Key_unknown);
+
+ // Invalid Keys
QTest::newRow("Meta+Trolls") << "Meta+Trolls" << QKeySequence(Qt::Key_unknown);
+ QTest::newRow("Meta+Period") << "Meta+Period" << QKeySequence(Qt::Key_unknown);
+ QTest::newRow("Meta+Ypsilon") << "Meta+Ypsilon" << QKeySequence(Qt::Key_unknown);
+
+ // Garbage
+ QTest::newRow("4+3=2") << "4+3=2" << QKeySequence(Qt::Key_unknown);
QTest::newRow("Alabama") << "Alabama" << QKeySequence(Qt::Key_unknown);
QTest::newRow("Simon+G") << "Simon+G" << QKeySequence(Qt::Key_unknown);
+ QTest::newRow("Shift+++2") << "Shift+++2" << QKeySequence(Qt::Key_unknown);
+
+ // Wrong order
+ QTest::newRow("A+Meta") << "a+Meta" << QKeySequence(Qt::Key_unknown);
+ QTest::newRow("Meta+++Shift") << "Meta+++Shift" << QKeySequence(Qt::Key_unknown);
+ QTest::newRow("Meta+a+Shift") << "Meta+a+Shift" << QKeySequence(Qt::Key_unknown);
+
+ // Only Modifiers - currently not supported
+ //QTest::newRow("Meta+Shift") << "Meta+Shift" << QKeySequence(Qt::META + Qt::SHIFT);
+ //QTest::newRow("Ctrl") << "Ctrl" << QKeySequence(Qt::CTRL);
+ //QTest::newRow("Shift") << "Shift" << QKeySequence(Qt::SHIFT);
+
+ // Only Keys
+ QTest::newRow("a") << "a" << QKeySequence(Qt::Key_A);
+ QTest::newRow("A") << "A" << QKeySequence(Qt::Key_A);
+
+ // Incomplete
+ QTest::newRow("Meta+Shift+") << "Meta+Shift+" << QKeySequence(Qt::Key_unknown);
}
void tst_QKeySequence::parseString()
@@ -608,7 +637,7 @@ void tst_QKeySequence::translated()
{
QFETCH(QString, transKey);
QFETCH(QString, compKey);
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
QSKIP("No need to translate modifiers on Mac OS X");
#elif defined(Q_OS_WINCE)
QSKIP("No need to translate modifiers on WinCE");
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index aca3ffc9cb..d8f1f0640e 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
index ce006eaa99..d2627fe378 100644
--- a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
+++ b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
index 5474c4097d..cc46831965 100644
--- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
+++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
index ab798a7351..475b6ca2a8 100644
--- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
+++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -90,6 +90,11 @@ void tst_QScreen::angleBetween_data()
<< uint(Qt::InvertedLandscapeOrientation)
<< uint(Qt::LandscapeOrientation)
<< 180;
+
+ QTest::newRow("Landscape Primary")
+ << uint(Qt::LandscapeOrientation)
+ << uint(Qt::PrimaryOrientation)
+ << QGuiApplication::primaryScreen()->angleBetween(Qt::LandscapeOrientation, QGuiApplication::primaryScreen()->primaryOrientation());
}
void tst_QScreen::angleBetween()
@@ -101,8 +106,8 @@ void tst_QScreen::angleBetween()
Qt::ScreenOrientation a = Qt::ScreenOrientation(oa);
Qt::ScreenOrientation b = Qt::ScreenOrientation(ob);
- QCOMPARE(QScreen::angleBetween(a, b), expected);
- QCOMPARE(QScreen::angleBetween(b, a), (360 - expected) % 360);
+ QCOMPARE(QGuiApplication::primaryScreen()->angleBetween(a, b), expected);
+ QCOMPARE(QGuiApplication::primaryScreen()->angleBetween(b, a), (360 - expected) % 360);
}
void tst_QScreen::transformBetween_data()
@@ -149,6 +154,12 @@ void tst_QScreen::transformBetween_data()
<< uint(Qt::LandscapeOrientation)
<< rect
<< QTransform(-1, 0, 0, -1, rect.width(), rect.height());
+
+ QTest::newRow("Landscape Primary")
+ << uint(Qt::LandscapeOrientation)
+ << uint(Qt::PrimaryOrientation)
+ << rect
+ << QGuiApplication::primaryScreen()->transformBetween(Qt::LandscapeOrientation, QGuiApplication::primaryScreen()->primaryOrientation(), rect);
}
void tst_QScreen::transformBetween()
@@ -161,7 +172,7 @@ void tst_QScreen::transformBetween()
Qt::ScreenOrientation a = Qt::ScreenOrientation(oa);
Qt::ScreenOrientation b = Qt::ScreenOrientation(ob);
- QCOMPARE(QScreen::transformBetween(a, b, rect), expected);
+ QCOMPARE(QGuiApplication::primaryScreen()->transformBetween(a, b, rect), expected);
}
void tst_QScreen::orientationChange()
@@ -169,10 +180,10 @@ void tst_QScreen::orientationChange()
QScreen *screen = QGuiApplication::primaryScreen();
QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation);
- QTRY_COMPARE(screen->currentOrientation(), Qt::LandscapeOrientation);
+ QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation);
QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation);
- QTRY_COMPARE(screen->currentOrientation(), Qt::PortraitOrientation);
+ QTRY_COMPARE(screen->orientation(), Qt::PortraitOrientation);
}
#include <tst_qscreen.moc>
diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
index 228b73414e..97c749e5ba 100644
--- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index 95e644987f..391600dd57 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 77fffef13a..d7c153dca1 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,6 +57,8 @@ private slots:
void touchToMouseTranslation();
void mouseToTouchTranslation();
void mouseToTouchLoop();
+ void orientation();
+ void close();
void initTestCase()
{
touchDevice = new QTouchDevice;
@@ -246,10 +248,12 @@ public:
keyReleaseCode = event->key();
}
void mousePressEvent(QMouseEvent *event) {
- if (ignoreMouse)
+ if (ignoreMouse) {
event->ignore();
- else
+ } else {
mousePressButton = event->button();
+ mousePressScreenPos = event->screenPos();
+ }
}
void mouseReleaseEvent(QMouseEvent *event) {
if (ignoreMouse)
@@ -257,6 +261,14 @@ public:
else
mouseReleaseButton = event->button();
}
+ void mouseMoveEvent(QMouseEvent *event) {
+ if (ignoreMouse) {
+ event->ignore();
+ } else {
+ mouseMoveButton = event->button();
+ mouseMoveScreenPos = event->screenPos();
+ }
+ }
void touchEvent(QTouchEvent *event) {
if (ignoreTouch) {
event->ignore();
@@ -285,7 +297,8 @@ public:
}
int keyPressCode, keyReleaseCode;
- int mousePressButton, mouseReleaseButton;
+ int mousePressButton, mouseReleaseButton, mouseMoveButton;
+ QPointF mousePressScreenPos, mouseMoveScreenPos;
int touchPressedCount, touchReleasedCount;
bool ignoreMouse, ignoreTouch;
@@ -339,12 +352,25 @@ void tst_QWindow::touchToMouseTranslation()
QList<QWindowSystemInterface::TouchPoint> points;
QWindowSystemInterface::TouchPoint tp1, tp2;
+ const QRectF pressArea(101, 102, 4, 4);
+ const QRectF moveArea(105, 108, 4, 4);
tp1.id = 1;
tp1.state = Qt::TouchPointPressed;
+ tp1.area = pressArea;
tp2.id = 2;
tp2.state = Qt::TouchPointPressed;
points << tp1 << tp2;
QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
+ // Now an update but with changed list order. The mouse event should still
+ // be generated from the point with id 1.
+ tp1.id = 2;
+ tp1.state = Qt::TouchPointStationary;
+ tp2.id = 1;
+ tp2.state = Qt::TouchPointMoved;
+ tp2.area = moveArea;
+ points.clear();
+ points << tp1 << tp2;
+ QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
points[0].state = Qt::TouchPointReleased;
points[1].state = Qt::TouchPointReleased;
QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
@@ -352,6 +378,8 @@ void tst_QWindow::touchToMouseTranslation()
QTRY_COMPARE(window.mousePressButton, int(Qt::LeftButton));
QTRY_COMPARE(window.mouseReleaseButton, int(Qt::LeftButton));
+ QTRY_COMPARE(window.mousePressScreenPos, pressArea.center());
+ QTRY_COMPARE(window.mouseMoveScreenPos, moveArea.center());
window.mousePressButton = 0;
window.mouseReleaseButton = 0;
@@ -455,5 +483,41 @@ void tst_QWindow::mouseToTouchLoop()
qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false);
}
+void tst_QWindow::orientation()
+{
+ QWindow window;
+ window.setGeometry(80, 80, 40, 40);
+ window.create();
+
+ window.reportContentOrientationChange(Qt::PortraitOrientation);
+ QCOMPARE(window.contentOrientation(), Qt::PortraitOrientation);
+
+ window.reportContentOrientationChange(Qt::PrimaryOrientation);
+ QCOMPARE(window.contentOrientation(), Qt::PrimaryOrientation);
+
+ QVERIFY(!window.requestWindowOrientation(Qt::LandscapeOrientation) || window.windowOrientation() == Qt::LandscapeOrientation);
+ QVERIFY(!window.requestWindowOrientation(Qt::PortraitOrientation) || window.windowOrientation() == Qt::PortraitOrientation);
+ QVERIFY(!window.requestWindowOrientation(Qt::PrimaryOrientation) || window.windowOrientation() == Qt::PrimaryOrientation);
+
+ QSignalSpy spy(&window, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)));
+ window.reportContentOrientationChange(Qt::LandscapeOrientation);
+ QCOMPARE(spy.count(), 1);
+}
+
+void tst_QWindow::close()
+{
+ QWindow a;
+ QWindow b;
+ QWindow c(&a);
+
+ a.show();
+ b.show();
+
+ // we can not close a non top level window
+ QVERIFY(!c.close());
+ QVERIFY(a.close());
+ QVERIFY(b.close());
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow);