summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/_Categories/QtCore.txt9
-rw-r--r--tests/auto/_Categories/QtGui.txt1
-rw-r--r--tests/auto/_Categories/QtNetwork.txt2
-rw-r--r--tests/auto/_Categories/QtSql.txt1
-rw-r--r--tests/auto/_networkselftest/_networkselftest.pro2
-rw-r--r--tests/auto/_networkselftest/tst_networkselftest.cpp30
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp6
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp45
-rw-r--r--tests/auto/symbian/orientationchange/orientationchange.pro7
-rw-r--r--tests/auto/symbian/orientationchange/tst_orientationchange.cpp165
-rw-r--r--tests/auto/symbian/qsymbiantests.pro2
11 files changed, 248 insertions, 22 deletions
diff --git a/tests/auto/_Categories/QtCore.txt b/tests/auto/_Categories/QtCore.txt
index fc19f45..7238bf8 100644
--- a/tests/auto/_Categories/QtCore.txt
+++ b/tests/auto/_Categories/QtCore.txt
@@ -3,13 +3,14 @@
collections
exceptionsafety
qabstractitemmodel
-# Requires std
-#qalgorithms
+#Requires STL
+qalgorithms
qatomicint
qatomicpointer
qbitarray
qbuffer
qbytearray
+qbytearraymatcher
qcache
qchar
qcoreapplication
@@ -68,7 +69,8 @@ qsignalspy
qsize
qsizef
qsocketnotifier
-#qstl requires STL
+#Requires STL
+qstl
qstring
qstringlist
qstringmatcher
@@ -103,3 +105,4 @@ qwaitcondition
qwineventnotifier
qwritelocker
q_func_info
+utf8
diff --git a/tests/auto/_Categories/QtGui.txt b/tests/auto/_Categories/QtGui.txt
index f0975e4..b03a870 100644
--- a/tests/auto/_Categories/QtGui.txt
+++ b/tests/auto/_Categories/QtGui.txt
@@ -1,4 +1,5 @@
languagechange
+modeltest
qabstractbutton
qabstractitemview
#qabstractprintdialog NO PRINTING SUPPORT
diff --git a/tests/auto/_Categories/QtNetwork.txt b/tests/auto/_Categories/QtNetwork.txt
index 60df74a..f5d191d 100644
--- a/tests/auto/_Categories/QtNetwork.txt
+++ b/tests/auto/_Categories/QtNetwork.txt
@@ -1,3 +1,5 @@
+_networkselftest
+#qsocketnotifier
qabstractnetworkcache
qabstractsocket
qftp
diff --git a/tests/auto/_Categories/QtSql.txt b/tests/auto/_Categories/QtSql.txt
index 55c1464..1232500 100644
--- a/tests/auto/_Categories/QtSql.txt
+++ b/tests/auto/_Categories/QtSql.txt
@@ -1,6 +1,7 @@
qsql
qsqlbatch
qsqldatabase
+qsqldriver
qsqlerror
qsqlfield
qsqlquery
diff --git a/tests/auto/_networkselftest/_networkselftest.pro b/tests/auto/_networkselftest/_networkselftest.pro
index 9e2ad0e..a2e1adf 100644
--- a/tests/auto/_networkselftest/_networkselftest.pro
+++ b/tests/auto/_networkselftest/_networkselftest.pro
@@ -2,5 +2,5 @@ load(qttest_p4)
SOURCES += tst_networkselftest.cpp
QT = core network
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/_networkselftest/tst_networkselftest.cpp b/tests/auto/_networkselftest/tst_networkselftest.cpp
index dab4433..0e64988 100644
--- a/tests/auto/_networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/_networkselftest/tst_networkselftest.cpp
@@ -43,9 +43,17 @@
#include <QtNetwork/QtNetwork>
#include "../network-settings.h"
+#if defined(Q_OS_SYMBIAN)
+#define SRCDIR ""
+#endif
+
class tst_NetworkSelfTest: public QObject
{
Q_OBJECT
+public:
+ tst_NetworkSelfTest();
+ virtual ~tst_NetworkSelfTest();
+
private slots:
void hostTest();
void dnsResolution_data();
@@ -60,7 +68,7 @@ private slots:
void httpServer();
void httpsServer();
void httpProxy();
- void httpProxyBasicAuth();
+ void httpProxyBasicAuth();
void httpProxyNtlmAuth();
void socks5Proxy();
void socks5ProxyAuth();
@@ -309,6 +317,15 @@ static void netChat(int port, const QList<Chat> &chat)
}
}
+tst_NetworkSelfTest::tst_NetworkSelfTest()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_NetworkSelfTest::~tst_NetworkSelfTest()
+{
+}
+
void tst_NetworkSelfTest::hostTest()
{
// this is a localhost self-test
@@ -360,13 +377,18 @@ void tst_NetworkSelfTest::remotePortsOpen_data()
QTest::newRow("https") << 443;
QTest::newRow("http-proxy") << 3128;
QTest::newRow("http-proxy-auth-basic") << 3129;
- QTest::newRow("http-proxy-auth-ntlm") << 3130;
+ QTest::newRow("http-proxy-auth-ntlm") << 3130;
QTest::newRow("socks5-proxy") << 1080;
QTest::newRow("socks5-proxy-auth") << 1081;
}
void tst_NetworkSelfTest::remotePortsOpen()
{
+#ifdef Q_OS_SYMBIAN
+ if (qstrcmp(QTest::currentDataTag(), "http-proxy-auth-ntlm") == 0)
+ QSKIP("NTML authentication not yet supported in Symbian", SkipSingle);
+#endif
+
QFETCH(int, portNumber);
QTcpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), portNumber);
@@ -520,6 +542,9 @@ void tst_NetworkSelfTest::httpProxyBasicAuth()
void tst_NetworkSelfTest::httpProxyNtlmAuth()
{
+#ifdef Q_OS_SYMBIAN
+ QSKIP("NTML authentication not yet supported in Symbian", SkipAll);
+#else
netChat(3130, QList<Chat>()
// test auth required response
<< Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n"
@@ -532,6 +557,7 @@ void tst_NetworkSelfTest::httpProxyNtlmAuth()
<< Chat::discardUntil("\r\nProxy-Authenticate: NTLM\r\n")
<< Chat::DiscardUntilDisconnect
);
+#endif
}
// SOCKSv5 is a binary protocol
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 13ffd67..4973d4f 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -2219,7 +2219,7 @@ void tst_QComboBox::setItemDelegate()
QComboBox comboBox;
QStyledItemDelegate *itemDelegate = new QStyledItemDelegate;
comboBox.setItemDelegate(itemDelegate);
- QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+ QCOMPARE(static_cast<QStyledItemDelegate*>(comboBox.itemDelegate()), itemDelegate);
}
void tst_QComboBox::task253944_itemDelegateIsReset()
@@ -2229,10 +2229,10 @@ void tst_QComboBox::task253944_itemDelegateIsReset()
comboBox.setItemDelegate(itemDelegate);
comboBox.setEditable(true);
- QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+ QCOMPARE(static_cast<QStyledItemDelegate*>(comboBox.itemDelegate()), itemDelegate);
comboBox.setStyleSheet("QComboBox { border: 1px solid gray; }");
- QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+ QCOMPARE(static_cast<QStyledItemDelegate*>(comboBox.itemDelegate()), itemDelegate);
}
QTEST_MAIN(tst_QComboBox)
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 444b400..67a6819 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -66,6 +66,7 @@ private slots:
void filterMouseEvents();
void requestSoftwareInputPanel();
void closeSoftwareInputPanel();
+ void selections();
};
void tst_QInputContext::maximumTextLength()
@@ -86,7 +87,7 @@ void tst_QInputContext::maximumTextLength()
class QFilterInputContext : public QInputContext
{
public:
- QFilterInputContext() : lastType(QEvent::None) {}
+ QFilterInputContext() {}
~QFilterInputContext() {}
QString identifierName() { return QString(); }
@@ -98,12 +99,12 @@ public:
bool filterEvent( const QEvent *event )
{
- lastType = event->type();
+ lastTypes.append(event->type());
return false;
}
public:
- QEvent::Type lastType;
+ QList<QEvent::Type> lastTypes;
};
void tst_QInputContext::filterMouseEvents()
@@ -116,7 +117,7 @@ void tst_QInputContext::filterMouseEvents()
le.setInputContext(ic);
QTest::mouseClick(&le, Qt::LeftButton);
- QCOMPARE(ic->lastType, QEvent::MouseButtonRelease);
+ QVERIFY(ic->lastTypes.indexOf(QEvent::MouseButtonRelease) >= 0);
le.setInputContext(0);
}
@@ -142,20 +143,22 @@ void tst_QInputContext::requestSoftwareInputPanel()
QApplication::setActiveWindow(&w);
// Testing single click panel activation.
- QApplication::setTwoClicksToRequestSIP(false);
+ qApp->setAutoSipOnMouseFocus(true);
QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
- QCOMPARE(ic2->lastType, QEvent::RequestSoftwareInputPanel);
+ QVERIFY(ic2->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0);
+ ic2->lastTypes.clear();
// Testing double click panel activation.
- QApplication::setTwoClicksToRequestSIP(true);
+ qApp->setAutoSipOnMouseFocus(false);
QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
- QVERIFY(ic1->lastType != QEvent::RequestSoftwareInputPanel);
+ QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0);
QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
- QCOMPARE(ic1->lastType, QEvent::RequestSoftwareInputPanel);
+ QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0);
+ ic1->lastTypes.clear();
// Testing right mouse button
QTest::mouseClick(le1, Qt::RightButton, Qt::NoModifier, QPoint(5, 5));
- QVERIFY(ic1->lastType != QEvent::RequestSoftwareInputPanel);
+ QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0);
}
void tst_QInputContext::closeSoftwareInputPanel()
@@ -184,11 +187,29 @@ void tst_QInputContext::closeSoftwareInputPanel()
// Testing that panel doesn't close between two input methods aware widgets.
QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
- QVERIFY(ic2->lastType != QEvent::CloseSoftwareInputPanel);
+ QVERIFY(ic2->lastTypes.indexOf(QEvent::CloseSoftwareInputPanel) < 0);
// Testing that panel closes when focusing non-aware widget.
QTest::mouseClick(rb, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
- QCOMPARE(ic2->lastType, QEvent::CloseSoftwareInputPanel);
+ QVERIFY(ic2->lastTypes.indexOf(QEvent::CloseSoftwareInputPanel) >= 0);
+}
+
+void tst_QInputContext::selections()
+{
+ QLineEdit le;
+ le.setText("Test text");
+ le.setSelection(2, 2);
+ QCOMPARE(le.inputMethodQuery(Qt::ImCursorPosition).toInt(), 4);
+ QCOMPARE(le.inputMethodQuery(Qt::ImAnchorPosition).toInt(), 2);
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 5, 3, QVariant()));
+ QInputMethodEvent event("", attributes);
+ QApplication::sendEvent(&le, &event);
+ QCOMPARE(le.cursorPosition(), 8);
+ QCOMPARE(le.selectionStart(), 5);
+ QCOMPARE(le.inputMethodQuery(Qt::ImCursorPosition).toInt(), 8);
+ QCOMPARE(le.inputMethodQuery(Qt::ImAnchorPosition).toInt(), 5);
}
QTEST_MAIN(tst_QInputContext)
diff --git a/tests/auto/symbian/orientationchange/orientationchange.pro b/tests/auto/symbian/orientationchange/orientationchange.pro
new file mode 100644
index 0000000..d240fa1
--- /dev/null
+++ b/tests/auto/symbian/orientationchange/orientationchange.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+HEADERS +=
+SOURCES += tst_orientationchange.cpp
+
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
new file mode 100644
index 0000000..9d57ae1
--- /dev/null
+++ b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#ifdef Q_OS_SYMBIAN
+
+#include <eikenv.h>
+#include <aknappui.h>
+
+class tst_orientationchange : public QObject
+{
+ Q_OBJECT
+public:
+ tst_orientationchange(){};
+ ~tst_orientationchange(){};
+
+private slots:
+ void resizeEventOnOrientationChange();
+};
+
+class TestWidget : public QWidget
+{
+public:
+ TestWidget(QWidget *parent = 0);
+
+ void reset();
+public:
+ void resizeEvent(QResizeEvent *event);
+
+public:
+ QSize resizeEventSize;
+ int resizeEventCount;
+};
+
+TestWidget::TestWidget(QWidget *parent)
+: QWidget(parent)
+{
+ reset();
+}
+
+void TestWidget::reset()
+{
+ resizeEventSize = QSize();
+ resizeEventCount = 0;
+}
+
+void TestWidget::resizeEvent(QResizeEvent *event)
+{
+ QWidget::resizeEvent(event);
+
+ // Size delivered in first resize event is stored.
+ if (!resizeEventCount)
+ resizeEventSize = event->size();
+
+ resizeEventCount++;
+}
+
+void tst_orientationchange::resizeEventOnOrientationChange()
+{
+ // This will test that when orientation 'changes', then
+ // at most one resize event is generated.
+
+ TestWidget *normalWidget = new TestWidget();
+ TestWidget *fullScreenWidget = new TestWidget();
+ TestWidget *maximizedWidget = new TestWidget();
+
+ fullScreenWidget->showFullScreen();
+ maximizedWidget->showMaximized();
+ normalWidget->show();
+
+ QCoreApplication::sendPostedEvents();
+ QCoreApplication::sendPostedEvents();
+
+ QCOMPARE(fullScreenWidget->resizeEventCount, 1);
+ QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize);
+ QCOMPARE(maximizedWidget->resizeEventCount, 1);
+ QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize);
+ QCOMPARE(normalWidget->resizeEventCount, 1);
+ QCOMPARE(normalWidget->size(), normalWidget->resizeEventSize);
+
+ fullScreenWidget->reset();
+ maximizedWidget->reset();
+ normalWidget->reset();
+
+ // Assumes that Qt application is AVKON application.
+ CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi());
+
+ // Determine 'opposite' orientation to the current orientation.
+
+ CAknAppUi::TAppUiOrientation orientation = CAknAppUi::EAppUiOrientationLandscape;
+ if (fullScreenWidget->size().width() > fullScreenWidget->size().height()) {
+ orientation = CAknAppUi::EAppUiOrientationPortrait;
+ }
+
+ TRAPD(err, appUi->SetOrientationL(orientation));
+
+ QCoreApplication::sendPostedEvents();
+ QCoreApplication::sendPostedEvents();
+
+ // setOrientationL is not guaranteed to change orientation
+ // (if emulator configured to support just portrait or landscape, then
+ // setOrientationL call shouldn't do anything).
+ // So let's ensure that we do not get resize event twice.
+
+ QVERIFY(fullScreenWidget->resizeEventCount <= 1);
+ if (fullScreenWidget->resizeEventCount) {
+ QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize);
+ }
+ QVERIFY(maximizedWidget->resizeEventCount <= 1);
+ if (fullScreenWidget->resizeEventCount) {
+ QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize);
+ }
+ QCOMPARE(normalWidget->resizeEventCount, 0);
+
+ TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified));
+
+ delete normalWidget;
+ delete fullScreenWidget;
+ delete maximizedWidget;
+}
+
+QTEST_MAIN(tst_orientationchange)
+#include "tst_orientationchange.moc"
+#else
+QTEST_NOOP_MAIN
+#endif
diff --git a/tests/auto/symbian/qsymbiantests.pro b/tests/auto/symbian/qsymbiantests.pro
index 151d7ec..648335e 100644
--- a/tests/auto/symbian/qsymbiantests.pro
+++ b/tests/auto/symbian/qsymbiantests.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = qmainexceptions \ No newline at end of file
+SUBDIRS = qmainexceptions orientationchange \ No newline at end of file