summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp25
-rw-r--r--tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro2
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml27
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp115
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp117
-rw-r--r--tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro2
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp6
-rw-r--r--tests/auto/qbytearray/qbytearray.pro2
-rw-r--r--tests/auto/qchar/qchar.pro2
-rw-r--r--tests/auto/qclipboard/test/test.pro6
-rw-r--r--tests/auto/qclipboard/tst_qclipboard.cpp64
-rw-r--r--tests/auto/qcolumnview/tst_qcolumnview.cpp1
-rw-r--r--tests/auto/qelapsedtimer/qelapsedtimer.pro2
-rw-r--r--tests/auto/qfileinfo/qfileinfo.pro4
-rw-r--r--tests/auto/qfontdatabase/tst_qfontdatabase.cpp14
-rw-r--r--tests/auto/qglthreads/tst_qglthreads.cpp1
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp95
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp108
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp68
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp53
-rw-r--r--tests/auto/qgroupbox/tst_qgroupbox.cpp23
-rw-r--r--tests/auto/qicon/tst_qicon.cpp62
-rw-r--r--tests/auto/qimagereader/images/test-flag-rle.tgabin0 -> 7971 bytes
-rw-r--r--tests/auto/qimagereader/images/test-flag.tgabin0 -> 480044 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.pro1
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp51
-rw-r--r--tests/auto/qintvalidator/tst_qintvalidator.cpp9
-rw-r--r--tests/auto/qlibrary/qlibrary.pro2
-rw-r--r--tests/auto/qlocalsocket/test/test.pro2
-rw-r--r--tests/auto/qmdiarea/tst_qmdiarea.cpp20
-rw-r--r--tests/auto/qmessagebox/tst_qmessagebox.cpp3
-rw-r--r--tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp54
-rw-r--r--tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp6
-rw-r--r--tests/auto/qnetworkreply/.gitattributes1
-rw-r--r--tests/auto/qnetworkreply/index.html3
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp212
-rw-r--r--tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp2
-rw-r--r--tests/auto/qobjectrace/tst_qobjectrace.cpp12
-rw-r--r--tests/auto/qplugin/qplugin.pro2
-rw-r--r--tests/auto/qpluginloader/qpluginloader.pro4
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp29
-rw-r--r--tests/auto/qprogressbar/tst_qprogressbar.cpp39
-rw-r--r--tests/auto/qresourceengine/qresourceengine.pro2
-rw-r--r--tests/auto/qsharedpointer/qsharedpointer.pro7
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h10
-rw-r--r--tests/auto/qstyle/tst_qstyle.cpp4
-rw-r--r--tests/auto/qtemporaryfile/qtemporaryfile.pro2
-rw-r--r--tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro6
-rw-r--r--tests/auto/qtextbrowser/tst_qtextbrowser.cpp24
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp19
-rw-r--r--tests/auto/qtranslator/i18n/hellotr_en.qmbin0 -> 230 bytes
-rw-r--r--tests/auto/qtranslator/tst_qtranslator.cpp40
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp19
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp45
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp20
-rw-r--r--tests/auto/selftests/selftests.pro1
-rwxr-xr-xtests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh5
-rw-r--r--tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd37
-rw-r--r--tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp5
64 files changed, 1371 insertions, 157 deletions
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index be9b402..3c6ba9b 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -294,7 +294,7 @@ void tst_QDeclarativeDebug::initTestCase()
qRegisterMetaType<QDeclarativeDebugWatch::State>();
qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3768...");
+ QTest::ignoreMessage(QtDebugMsg, "QDeclarativeDebugServer: Waiting for connection on port 3768...");
m_engine = new QDeclarativeEngine(this);
QList<QByteArray> qml;
@@ -375,7 +375,7 @@ void tst_QDeclarativeDebug::initTestCase()
m_conn = new QDeclarativeDebugConnection(this);
m_conn->connectToHost("127.0.0.1", 3768);
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
+ QTest::ignoreMessage(QtDebugMsg, "QDeclarativeDebugServer: Connection established");
bool ok = m_conn->waitForConnected();
QVERIFY(ok);
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
index 4846d67..eb673bf 100644
--- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
+++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
@@ -69,7 +69,7 @@ private slots:
void tst_QDeclarativeDebugClient::initTestCase()
{
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13770...");
+ QTest::ignoreMessage(QtDebugMsg, "QDeclarativeDebugServer: Waiting for connection on port 13770...");
new QDeclarativeEngine(this);
m_conn = new QDeclarativeDebugConnection(this);
@@ -79,7 +79,7 @@ void tst_QDeclarativeDebugClient::initTestCase()
m_conn->connectToHost("127.0.0.1", 13770);
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
+ QTest::ignoreMessage(QtDebugMsg, "QDeclarativeDebugServer: Connection established");
bool ok = m_conn->waitForConnected();
QVERIFY(ok);
diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
index 85d459b..62fb5ad 100644
--- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
+++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
@@ -73,13 +73,13 @@ private slots:
void tst_QDeclarativeDebugService::initTestCase()
{
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13769...");
+ QTest::ignoreMessage(QtDebugMsg, "QDeclarativeDebugServer: Waiting for connection on port 13769...");
new QDeclarativeEngine(this);
m_conn = new QDeclarativeDebugConnection(this);
m_conn->connectToHost("127.0.0.1", 13769);
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
+ QTest::ignoreMessage(QtDebugMsg, "QDeclarativeDebugServer: Connection established");
bool ok = m_conn->waitForConnected();
QVERIFY(ok);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index 2cc2971..96bea68 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QDebug>
+#include <QtCore/qlibraryinfo.h>
#include "../shared/testhttpserver.h"
#include "../../../shared/util.h"
@@ -70,6 +71,7 @@ private slots:
void remoteImportWithUnquotedUri();
void versionNotInstalled();
void versionNotInstalled_data();
+ void importPath();
};
#ifdef Q_OS_SYMBIAN
@@ -308,6 +310,29 @@ void tst_qdeclarativemoduleplugin::versionNotInstalled()
VERIFY_ERRORS(errorFile.toLatin1().constData());
}
+void tst_qdeclarativemoduleplugin::importPath()
+{
+#ifndef Q_OS_SYMBIAN
+ QSKIP("Import path order testing for Symbian only", SkipAll);
+#else
+ QDeclarativeEngine engine;
+ QStringList imports = engine.importPathList();
+ QString installImportsPath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::ImportsPath));
+ QString driveOrder(QLatin1String("ZABCDEFGHIJKLMNOPQRSTUVWXY"));
+ int lastOrder = 30;
+ foreach(QString import, imports)
+ {
+ if (import.endsWith(installImportsPath))
+ {
+ int order = driveOrder.indexOf(import[0]);
+ QVERIFY(order < lastOrder);
+ lastOrder = order;
+ }
+ }
+ QVERIFY(lastOrder != 30);
+#endif
+}
+
QTEST_MAIN(tst_qdeclarativemoduleplugin)
#include "tst_qdeclarativemoduleplugin.moc"
diff --git a/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro b/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro
index 2c13644..3bdb3fc 100644
--- a/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro
+++ b/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro
@@ -7,7 +7,7 @@ SOURCES += tst_qdeclarativepincharea.cpp
symbian: {
importFiles.sources = data
importFiles.path = .
- DEPLOYMENT = importFiles
+ DEPLOYMENT += importFiles
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml
new file mode 100644
index 0000000..ed1f22f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash3.qml
@@ -0,0 +1,27 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: myRect
+ width: 400
+ height: 400
+
+ onHeightChanged: console.log("base state")
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state1")
+ color: "green"
+ }
+ },
+ State {
+ name: "state2";
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state2")
+ color: "red"
+ }
+ }]
+}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 9fafa7d..e90e6fb 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -113,6 +113,7 @@ private slots:
void signalOverride();
void signalOverrideCrash();
void signalOverrideCrash2();
+ void signalOverrideCrash3();
void parentChange();
void parentChangeErrors();
void anchorChanges();
@@ -520,6 +521,22 @@ void tst_qdeclarativestates::signalOverrideCrash2()
delete rect;
}
+void tst_qdeclarativestates::signalOverrideCrash3()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash3.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QDeclarativeItemPrivate::get(rect)->setState("state1");
+ QDeclarativeItemPrivate::get(rect)->setState("");
+ QDeclarativeItemPrivate::get(rect)->setState("state2");
+ QDeclarativeItemPrivate::get(rect)->setState("");
+
+ delete rect;
+}
+
void tst_qdeclarativestates::parentChange()
{
QDeclarativeEngine engine;
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 33f74a9..4d8bd0b 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -156,6 +156,7 @@ private slots:
void inputContextMouseHandler();
void inputMethodComposing();
void cursorRectangleSize();
+ void deselect();
private:
void simulateKey(QDeclarativeView *, int key, Qt::KeyboardModifiers modifiers = 0);
@@ -2699,6 +2700,120 @@ void tst_qdeclarativetextedit::cursorRectangleSize()
QCOMPARE(microFocusFromScene.size(), cursorRect.size());
QCOMPARE(microFocusFromApp.size(), cursorRect.size());
}
+
+void tst_qdeclarativetextedit::deselect()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/CursorRect.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextEdit *textEdit = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(textEdit != 0);
+
+ textEdit->setText("Select");
+
+ QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
+ QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged()));
+
+ textEdit->select(5, 6);
+
+ QCOMPARE(selectionStartSpy.count(), 1);
+ QCOMPARE(selectionEndSpy.count(), 1);
+ QCOMPARE(selectionSpy.count(), 1);
+ QCOMPARE(textEdit->selectionStart(), 5);
+ QCOMPARE(textEdit->selectionEnd(), 6);
+ QCOMPARE(textEdit->selectedText(), QLatin1String("t"));
+ QCOMPARE(textEdit->cursorPosition(), 6);
+
+ textEdit->deselect();
+
+ QCOMPARE(selectionStartSpy.count(), 2);
+ QCOMPARE(selectionEndSpy.count(), 1);
+ QCOMPARE(selectionSpy.count(), 2);
+ QCOMPARE(textEdit->selectionStart(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectionEnd(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectedText(), QLatin1String(""));
+ QCOMPARE(textEdit->cursorPosition(), 6);
+
+ textEdit->select(5, 6);
+
+ QCOMPARE(selectionStartSpy.count(), 3);
+ QCOMPARE(selectionEndSpy.count(), 1);
+ QCOMPARE(selectionSpy.count(), 3);
+ QCOMPARE(textEdit->selectionStart(), 5);
+ QCOMPARE(textEdit->selectionEnd(), 6);
+ QCOMPARE(textEdit->selectedText(), QLatin1String("t"));
+ QCOMPARE(textEdit->cursorPosition(), 6);
+
+ QKeyEvent leftArrowPress(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
+ QKeyEvent leftArrowRelese(QEvent::KeyRelease, Qt::Key_Left, Qt::NoModifier);
+ QApplication::sendEvent(canvas, &leftArrowPress);
+ QApplication::sendEvent(canvas, &leftArrowRelese);
+
+ QCOMPARE(selectionStartSpy.count(), 3);
+ QCOMPARE(selectionEndSpy.count(), 2);
+ QCOMPARE(selectionSpy.count(), 4);
+ QCOMPARE(textEdit->selectionStart(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectionEnd(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectedText(), QLatin1String(""));
+ QCOMPARE(textEdit->cursorPosition(), 5);
+
+ textEdit->select(5, 6);
+
+ QCOMPARE(selectionStartSpy.count(), 3);
+ QCOMPARE(selectionEndSpy.count(), 3);
+ QCOMPARE(selectionSpy.count(), 5);
+ QCOMPARE(textEdit->selectionStart(), 5);
+ QCOMPARE(textEdit->selectionEnd(), 6);
+ QCOMPARE(textEdit->selectedText(), QLatin1String("t"));
+ QCOMPARE(textEdit->cursorPosition(), 6);
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
+ QInputMethodEvent event(QLatin1String(""), attributes);
+ QApplication::sendEvent(canvas, &event);
+
+ QCOMPARE(selectionStartSpy.count(), 4);
+ QCOMPARE(selectionEndSpy.count(), 4);
+ QCOMPARE(selectionSpy.count(), 6);
+ QCOMPARE(textEdit->selectionStart(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectionEnd(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectedText(), QLatin1String(""));
+ QCOMPARE(textEdit->cursorPosition(), 0);
+
+ textEdit->setCursorPosition(1);
+
+ QCOMPARE(selectionStartSpy.count(), 5);
+ QCOMPARE(selectionEndSpy.count(), 5);
+ QCOMPARE(selectionSpy.count(), 6);
+
+ QKeyEvent leftArrowShiftPress(QEvent::KeyPress, Qt::Key_Left, Qt::ShiftModifier);
+ QKeyEvent leftArrowShiftRelese(QEvent::KeyRelease, Qt::Key_Left, Qt::ShiftModifier);
+ QApplication::sendEvent(canvas, &leftArrowShiftPress);
+ QApplication::sendEvent(canvas, &leftArrowShiftRelese);
+
+ QCOMPARE(selectionStartSpy.count(), 6);
+ QCOMPARE(selectionEndSpy.count(), 5);
+ QCOMPARE(selectionSpy.count(), 7);
+ QCOMPARE(textEdit->selectionStart(), 0);
+ QCOMPARE(textEdit->selectionEnd(), 1);
+ QCOMPARE(textEdit->selectedText(), QLatin1String("S"));
+ QCOMPARE(textEdit->cursorPosition(), 0);
+
+ QApplication::sendEvent(canvas, &event);
+
+ QCOMPARE(selectionStartSpy.count(), 6);
+ QCOMPARE(selectionEndSpy.count(), 6);
+ QCOMPARE(selectionSpy.count(), 8);
+ QCOMPARE(textEdit->selectionStart(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectionEnd(), textEdit->cursorPosition());
+ QCOMPARE(textEdit->selectedText(), QLatin1String(""));
+ QCOMPARE(textEdit->cursorPosition(), 0);
+}
QTEST_MAIN(tst_qdeclarativetextedit)
#include "tst_qdeclarativetextedit.moc"
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index bb895bf..b077670 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -147,6 +147,7 @@ private slots:
void inputContextMouseHandler();
void inputMethodComposing();
void cursorRectangleSize();
+ void deselect();
private:
void simulateKey(QDeclarativeView *, int key);
@@ -2367,7 +2368,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus()
QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled));
// input method should not be enabled
- // if TextEdit is read only.
+ // if TextInput is read only.
input.setReadOnly(true);
ic.openInputPanelReceived = false;
input.setFocus(true);
@@ -2815,6 +2816,120 @@ void tst_qdeclarativetextinput::cursorRectangleSize()
QCOMPARE(microFocusFromApp.size(), cursorRect.size());
}
+void tst_qdeclarativetextinput::deselect()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextInput *textInput = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textInput != 0);
+
+ textInput->setText("Select");
+
+ QSignalSpy selectionStartSpy(textInput, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textInput, SIGNAL(selectionEndChanged()));
+ QSignalSpy selectedTextSpy(textInput, SIGNAL(selectedTextChanged()));
+
+ textInput->select(5, 6);
+
+ QCOMPARE(selectionStartSpy.count(), 1);
+ QCOMPARE(selectionEndSpy.count(), 0);
+ QCOMPARE(selectedTextSpy.count(), 1);
+ QCOMPARE(textInput->selectionStart(), 5);
+ QCOMPARE(textInput->selectionEnd(), 6);
+ QCOMPARE(textInput->selectedText(), QLatin1String("t"));
+ QCOMPARE(textInput->cursorPosition(), 6);
+
+ textInput->deselect();
+
+ QCOMPARE(selectionStartSpy.count(), 2);
+ QCOMPARE(selectionEndSpy.count(), 1);
+ QCOMPARE(selectedTextSpy.count(), 2);
+ QCOMPARE(textInput->selectionStart(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectionEnd(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectedText(), QLatin1String(""));
+ QCOMPARE(textInput->cursorPosition(), 6);
+
+ textInput->select(5, 6);
+
+ QCOMPARE(selectionStartSpy.count(), 3);
+ QCOMPARE(selectionEndSpy.count(), 1);
+ QCOMPARE(selectedTextSpy.count(), 3);
+ QCOMPARE(textInput->selectionStart(), 5);
+ QCOMPARE(textInput->selectionEnd(), 6);
+ QCOMPARE(textInput->selectedText(), QLatin1String("t"));
+ QCOMPARE(textInput->cursorPosition(), 6);
+
+ QKeyEvent leftArrowPress(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
+ QKeyEvent leftArrowRelese(QEvent::KeyRelease, Qt::Key_Left, Qt::NoModifier);
+ QApplication::sendEvent(canvas, &leftArrowPress);
+ QApplication::sendEvent(canvas, &leftArrowRelese);
+
+ QCOMPARE(selectionStartSpy.count(), 4);
+ QCOMPARE(selectionEndSpy.count(), 2);
+ QCOMPARE(selectedTextSpy.count(), 4);
+ QCOMPARE(textInput->selectionStart(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectionEnd(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectedText(), QLatin1String(""));
+ QCOMPARE(textInput->cursorPosition(), 5);
+
+ textInput->select(5, 6);
+
+ QCOMPARE(selectionStartSpy.count(), 4);
+ QCOMPARE(selectionEndSpy.count(), 3);
+ QCOMPARE(selectedTextSpy.count(), 5);
+ QCOMPARE(textInput->selectionStart(), 5);
+ QCOMPARE(textInput->selectionEnd(), 6);
+ QCOMPARE(textInput->selectedText(), QLatin1String("t"));
+ QCOMPARE(textInput->cursorPosition(), 6);
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
+ QInputMethodEvent event(QLatin1String(""), attributes);
+ QApplication::sendEvent(canvas, &event);
+
+ QCOMPARE(selectionStartSpy.count(), 5);
+ QCOMPARE(selectionEndSpy.count(), 4);
+ QCOMPARE(selectedTextSpy.count(), 6);
+ QCOMPARE(textInput->selectionStart(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectionEnd(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectedText(), QLatin1String(""));
+ QCOMPARE(textInput->cursorPosition(), 0);
+
+ textInput->setCursorPosition(1);
+
+ QCOMPARE(selectionStartSpy.count(), 6);
+ QCOMPARE(selectionEndSpy.count(), 5);
+ QCOMPARE(selectedTextSpy.count(), 6);
+
+ QKeyEvent leftArrowShiftPress(QEvent::KeyPress, Qt::Key_Left, Qt::ShiftModifier);
+ QKeyEvent leftArrowShiftRelese(QEvent::KeyRelease, Qt::Key_Left, Qt::ShiftModifier);
+ QApplication::sendEvent(canvas, &leftArrowShiftPress);
+ QApplication::sendEvent(canvas, &leftArrowShiftRelese);
+
+ QCOMPARE(selectionStartSpy.count(), 7);
+ QCOMPARE(selectionEndSpy.count(), 5);
+ QCOMPARE(selectedTextSpy.count(), 7);
+ QCOMPARE(textInput->selectionStart(), 0);
+ QCOMPARE(textInput->selectionEnd(), 1);
+ QCOMPARE(textInput->selectedText(), QLatin1String("S"));
+ QCOMPARE(textInput->cursorPosition(), 0);
+
+ QApplication::sendEvent(canvas, &event);
+
+ QCOMPARE(selectionStartSpy.count(), 8);
+ QCOMPARE(selectionEndSpy.count(), 6);
+ QCOMPARE(selectedTextSpy.count(), 8);
+ QCOMPARE(textInput->selectionStart(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectionEnd(), textInput->cursorPosition());
+ QCOMPARE(textInput->selectedText(), QLatin1String(""));
+ QCOMPARE(textInput->cursorPosition(), 0);
+}
+
QTEST_MAIN(tst_qdeclarativetextinput)
#include "tst_qdeclarativetextinput.moc"
diff --git a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro
index b8f509d..90a99c0 100644
--- a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro
+++ b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro
@@ -6,7 +6,7 @@ HEADERS += TestNodeModel.h LoadingModel.h
include (../xmlpatterns.pri)
-wince*: {
+wince*|symbian: {
addFiles.files = tree.xml
addFiles.path = .
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index d452820..d24f52f 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -2531,6 +2531,12 @@ void tst_QAccessibility::menuTest()
QCOMPARE(interface->actionText(QAccessible::DefaultAction, QAccessible::Name, 4), QString());
QCOMPARE(interface->actionText(QAccessible::DefaultAction, QAccessible::Name, 5), QString("Execute"));
+ // QTBUG-21578 - after setting accessible name on a menu it would no longer
+ // return the right names for it's children.
+ QCOMPARE(interface->text(QAccessible::Name, 1), QString("New..."));
+ file->setAccessibleName("File");
+ QCOMPARE(interface->text(QAccessible::Name, 1), QString("New..."));
+
QAccessibleInterface *iface = 0;
QAccessibleInterface *iface2 = 0;
diff --git a/tests/auto/qbytearray/qbytearray.pro b/tests/auto/qbytearray/qbytearray.pro
index f195dc8..b954ca0 100644
--- a/tests/auto/qbytearray/qbytearray.pro
+++ b/tests/auto/qbytearray/qbytearray.pro
@@ -14,6 +14,8 @@ wince* {
DEFINES += SRCDIR=\\\"./\\\"
} else:symbian {
TARGET.EPOCHEAPSIZE="0x100 0x800000"
+} else:integrity {
+ DEFINES += SRCDIR=\"/\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro
index 1681220..cbbde7c 100644
--- a/tests/auto/qchar/qchar.pro
+++ b/tests/auto/qchar/qchar.pro
@@ -10,6 +10,8 @@ DEPLOYMENT += deploy
symbian: {
DEFINES += SRCDIR=""
+} else:integrity {
+ DEFINES += SRCDIR=\"/\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro
index 12c6b6c..2e8f6db 100644
--- a/tests/auto/qclipboard/test/test.pro
+++ b/tests/auto/qclipboard/test/test.pro
@@ -15,7 +15,7 @@ wince*|symbian: {
copier.path = copier
paster.files = ../paster/paster.exe
paster.path = paster
-
+
symbian: {
LIBS += -lbafl -lestor -letext
@@ -27,6 +27,6 @@ wince*|symbian: {
reg_resource.files += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc
reg_resource.path = $$REG_RESOURCE_IMPORT_DIR
}
-
+
DEPLOYMENT += copier paster rsc reg_resource
-} \ No newline at end of file
+}
diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp
index 94981cf..ea470e7 100644
--- a/tests/auto/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/qclipboard/tst_qclipboard.cpp
@@ -73,6 +73,7 @@ private slots:
#ifdef Q_OS_SYMBIAN
void pasteCopySymbian();
void copyPasteSymbian();
+ void copyCopyPasteSymbian();
#endif
private:
@@ -347,17 +348,17 @@ void tst_QClipboard::clearBeforeSetText()
QCOMPARE(QApplication::clipboard()->text(), text);
}
+#ifdef Q_OS_SYMBIAN
/*
Test that text copied from qt application
can be pasted with symbian clipboard
*/
-#ifdef Q_OS_SYMBIAN
// ### This test case only makes sense in symbian
void tst_QClipboard::pasteCopySymbian()
{
if (!nativeClipboardWorking())
QSKIP("Native clipboard not working in this setup", SkipAll);
- const QString string("Test string symbian.");
+ const QString string("Test string qt->symbian.");
QApplication::clipboard()->setText(string);
const TInt KPlainTextBegin = 0;
@@ -381,19 +382,9 @@ void tst_QClipboard::pasteCopySymbian()
QCOMPARE(string, storeString);
}
-#endif
-/*
- Test that text copied to symbian clipboard
- can be pasted to qt clipboard
-*/
-#ifdef Q_OS_SYMBIAN
-// ### This test case only makes sense in symbian
-void tst_QClipboard::copyPasteSymbian()
+static void nativeCopyHelper(const QString &string)
{
- if (!nativeClipboardWorking())
- QSKIP("Native clipboard not working in this setup", SkipAll);
- const QString string("Test string symbian.");
const TInt KPlainTextBegin = 0;
RFs fs = qt_s60GetRFs();
@@ -412,8 +403,55 @@ void tst_QClipboard::copyPasteSymbian()
(cb->StreamDictionary()).AssignL(KClipboardUidTypePlainText, symbianStId);
cb->CommitL();
CleanupStack::PopAndDestroy(2, cb);
+}
+
+/*
+ Test that text copied to symbian clipboard
+ can be pasted to qt clipboard
+*/
+// ### This test case only makes sense in symbian
+void tst_QClipboard::copyPasteSymbian()
+{
+ if (!nativeClipboardWorking())
+ QSKIP("Native clipboard not working in this setup", SkipAll);
+ const QString string("Test string symbian->qt.");
+
+ nativeCopyHelper(string);
+
+ QCOMPARE(QApplication::clipboard()->text(), string);
+}
+
+/*
+ Test that text copied to symbian clipboard
+ can be pasted to qt clipboard, even if Qt
+ clipboard already had copied formatted text
+*/
+// ### This test case only makes sense in symbian
+void tst_QClipboard::copyCopyPasteSymbian()
+{
+ if (!nativeClipboardWorking())
+ QSKIP("Native clipboard not working in this setup", SkipAll);
+
+ //first copy some mime data with text/html and text/plain representations
+ QMimeData *mimeData = new QMimeData;
+ const QString preCopy(QLatin1String("qt_symbian"));
+ mimeData->setText(preCopy);
+ mimeData->setHtml(preCopy);
+ QApplication::clipboard()->setMimeData(mimeData);
+
+ //check both representations are pastable
+ QCOMPARE(QApplication::clipboard()->mimeData()->html(), preCopy);
+ QCOMPARE(QApplication::clipboard()->mimeData()->text(), preCopy);
+
+ //native copy some plain text
+ const QString string("symbian_qt");
+ nativeCopyHelper(string);
+ //check text/plain is pastable
QCOMPARE(QApplication::clipboard()->text(), string);
+ QCOMPARE(QApplication::clipboard()->mimeData()->text(), string);
+ //check text/html is cleared
+ QVERIFY(QApplication::clipboard()->mimeData()->html().isEmpty());
}
#endif
diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp
index 7f6d43a..65e23bf 100644
--- a/tests/auto/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp
@@ -461,6 +461,7 @@ void tst_QColumnView::scrollTo()
view.setCurrentIndex(index);
QTest::qWait(ANIMATION_DELAY);
view.scrollTo(index, QAbstractItemView::EnsureVisible);
+ QTest::qWait(ANIMATION_DELAY);
index = index.parent();
if (start != level) {
if (!reverse)
diff --git a/tests/auto/qelapsedtimer/qelapsedtimer.pro b/tests/auto/qelapsedtimer/qelapsedtimer.pro
index 8768876..1d74fc5 100644
--- a/tests/auto/qelapsedtimer/qelapsedtimer.pro
+++ b/tests/auto/qelapsedtimer/qelapsedtimer.pro
@@ -7,6 +7,8 @@ wince* {
} else:symbian {
# do not define SRCDIR at all
TARGET.EPOCHEAPSIZE = 0x100000 0x3000000
+} else:integrity {
+ DEFINES += SRCDIR=\"/\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro
index b35b1e0..d0e284b 100644
--- a/tests/auto/qfileinfo/qfileinfo.pro
+++ b/tests/auto/qfileinfo/qfileinfo.pro
@@ -19,13 +19,15 @@ symbian {
TARGET.CAPABILITY=AllFiles
LIBS *= -lefsrv
INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
- }
+}
# support for running test from shadow build directory
wince* {
DEFINES += SRCDIR=\\\"\\\"
} else:symbian {
# do not define SRCDIR at all
+} else:integrity {
+ DEFINES += SRCDIR=\"/\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
index 735c7e4..7bbd32d 100644
--- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp
@@ -80,6 +80,10 @@ private slots:
void addAppFont_data();
void addAppFont();
+
+#ifdef Q_WS_MAC
+ void localizedFonts();
+#endif
};
tst_QFontDatabase::tst_QFontDatabase()
@@ -275,5 +279,15 @@ void tst_QFontDatabase::addAppFont()
QVERIFY(db.families() == oldFamilies);
}
+#ifdef Q_WS_MAC
+void tst_QFontDatabase::localizedFonts()
+{
+ QFontDatabase db;
+
+ QVERIFY(db.hasFamily(QString::fromUtf8("ヒラギノ明朝 Pro")));
+ QVERIFY(!db.hasFamily(QString::fromUtf8("NotValidFont")));
+}
+#endif
+
QTEST_MAIN(tst_QFontDatabase)
#include "tst_qfontdatabase.moc"
diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp
index 859f47f..60fb10c 100644
--- a/tests/auto/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/qglthreads/tst_qglthreads.cpp
@@ -49,6 +49,7 @@
#include <unistd.h> // for usleep
#define RUNNING_TIME 2000 // save GPU mem by running shorter time.
#else
+#include "qplatformdefs.h" // for usleep
#define RUNNING_TIME 5000
#endif
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 1f5563c..9c189cb 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -78,6 +78,8 @@ private slots:
void dropShadowClipping();
void childrenVisibilityShouldInvalidateCache();
void prepareGeometryChangeInvalidateCache();
+ void graphicsEffectUpdateShouldNotInvalidateGraphicsItemCache();
+ void graphicsEffectUpdateShouldInvalidateParentGraphicsEffect();
void itemHasNoContents();
};
@@ -732,6 +734,99 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache()
QCOMPARE(item->nbPaint, 0);
}
+class MyGraphicsEffect : public QGraphicsEffect
+{
+ public:
+ MyGraphicsEffect(QObject *parent = 0) :
+ QGraphicsEffect(parent), nbSourceInvalidations(0)
+ {}
+ int nbSourceInvalidations;
+ protected:
+ void draw(QPainter *painter)
+ {
+ drawSource(painter);
+ }
+
+ void sourceChanged(ChangeFlags flags)
+ {
+ if (flags == SourceInvalidated)
+ nbSourceInvalidations++;
+ }
+};
+
+void tst_QGraphicsEffect::graphicsEffectUpdateShouldNotInvalidateGraphicsItemCache()
+{
+ QGraphicsScene scene;
+ MyGraphicsItem parent;
+ parent.resize(200, 200);
+ parent.setCacheMode(QGraphicsItem::ItemCoordinateCache);
+ scene.addItem(&parent);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(parent.nbPaint, 1);
+
+ //we set an effect on the parent
+ MyGraphicsEffect* opacityEffect = new MyGraphicsEffect(&parent);
+ opacityEffect->update();
+ parent.setGraphicsEffect(opacityEffect);
+ //flush the events
+ QApplication::processEvents();
+ //new effect applied->repaint
+ QCOMPARE(parent.nbPaint, 1);
+
+ opacityEffect->update();
+ //flush the events
+ QApplication::processEvents();
+ //A change to the effect shouldn't invalidate the graphicsitem's cache
+ // => it shouldn't trigger a paint
+ QCOMPARE(parent.nbPaint, 1);
+}
+
+void tst_QGraphicsEffect::graphicsEffectUpdateShouldInvalidateParentGraphicsEffect()
+{
+ QGraphicsScene scene;
+ // Add the parent
+ MyGraphicsItem parent;
+ parent.resize(200, 200);
+ scene.addItem(&parent);
+ // Add a child to the parent
+ MyGraphicsItem child(&parent);
+ child.resize(100, 100);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ //flush the events
+ QApplication::processEvents();
+ QTRY_COMPARE(parent.nbPaint, 1);
+ QTRY_COMPARE(child.nbPaint, 1);
+
+ //we set an effect on the parent and the child
+ MyGraphicsEffect* effectForParent = new MyGraphicsEffect(&parent);
+ parent.setGraphicsEffect(effectForParent);
+
+ MyGraphicsEffect* effectForChild = new MyGraphicsEffect(&child);
+ child.setGraphicsEffect(effectForChild);
+ //flush the events
+ QApplication::processEvents();
+ // Both effects should start with no source invalidations
+ QCOMPARE(effectForParent->nbSourceInvalidations, 0);
+ QCOMPARE(effectForChild->nbSourceInvalidations, 0);
+
+ // Trigger an update of the child graphics effect
+ effectForChild->update();
+ //flush the events
+ QApplication::processEvents();
+ // An update of the effect on the child shouldn't tell that effect that its source has been invalidated
+ QCOMPARE(effectForChild->nbSourceInvalidations, 0);
+ // The effect on the parent should however be notified of an invalidated source
+ QCOMPARE(effectForParent->nbSourceInvalidations, 1);
+}
+
void tst_QGraphicsEffect::itemHasNoContents()
{
QGraphicsRectItem *parent = new QGraphicsRectItem;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 9b834d5..b6a402e 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -306,6 +306,7 @@ private slots:
void inputMethodHints();
void toolTip();
void visible();
+ void isVisibleTo();
void explicitlyVisible();
void enabled();
void explicitlyEnabled();
@@ -1138,6 +1139,113 @@ void tst_QGraphicsItem::visible()
QVERIFY(!item->hasFocus());
}
+void tst_QGraphicsItem::isVisibleTo()
+{
+ QGraphicsScene scene;
+ QGraphicsItem *parent = scene.addRect(QRectF(0, 0, 100, 100));
+ QGraphicsItem *child = scene.addRect(QRectF(25, 25, 50, 50));
+ QGraphicsItem *grandChild = scene.addRect(QRectF(50, 50, 50, 50));
+ QGraphicsItem *stranger = scene.addRect(100, 100, 100, 100);
+
+ child->setParentItem(parent);
+ grandChild->setParentItem(child);
+
+ QVERIFY(grandChild->isVisible());
+ QVERIFY(grandChild->isVisibleTo(grandChild));
+ QVERIFY(grandChild->isVisibleTo(child));
+ QVERIFY(grandChild->isVisibleTo(parent));
+ QVERIFY(grandChild->isVisibleTo(0));
+ QVERIFY(child->isVisible());
+ QVERIFY(child->isVisibleTo(child));
+ QVERIFY(child->isVisibleTo(parent));
+ QVERIFY(child->isVisibleTo(0));
+ QVERIFY(parent->isVisible());
+ QVERIFY(parent->isVisibleTo(parent));
+ QVERIFY(parent->isVisibleTo(0));
+ QVERIFY(!parent->isVisibleTo(child));
+ QVERIFY(!child->isVisibleTo(grandChild));
+ QVERIFY(!grandChild->isVisibleTo(stranger));
+ QVERIFY(!child->isVisibleTo(stranger));
+ QVERIFY(!parent->isVisibleTo(stranger));
+ QVERIFY(!stranger->isVisibleTo(grandChild));
+ QVERIFY(!stranger->isVisibleTo(child));
+ QVERIFY(!stranger->isVisibleTo(parent));
+
+ // Case 1: only parent is explicitly hidden
+ parent->hide();
+
+ QVERIFY(!grandChild->isVisible());
+ QVERIFY(grandChild->isVisibleTo(grandChild));
+ QVERIFY(grandChild->isVisibleTo(child));
+ QVERIFY(grandChild->isVisibleTo(parent));
+ QVERIFY(!grandChild->isVisibleTo(0));
+ QVERIFY(!child->isVisible());
+ QVERIFY(child->isVisibleTo(child));
+ QVERIFY(child->isVisibleTo(parent));
+ QVERIFY(!child->isVisibleTo(0));
+ QVERIFY(!parent->isVisible());
+ QVERIFY(!parent->isVisibleTo(parent));
+ QVERIFY(!parent->isVisibleTo(0));
+ QVERIFY(!parent->isVisibleTo(child));
+ QVERIFY(!child->isVisibleTo(grandChild));
+ QVERIFY(!grandChild->isVisibleTo(stranger));
+ QVERIFY(!child->isVisibleTo(stranger));
+ QVERIFY(!parent->isVisibleTo(stranger));
+ QVERIFY(!stranger->isVisibleTo(grandChild));
+ QVERIFY(!stranger->isVisibleTo(child));
+ QVERIFY(!stranger->isVisibleTo(parent));
+
+ // Case 2: only child is hidden
+ parent->show();
+ child->hide();
+
+ QVERIFY(!grandChild->isVisible());
+ QVERIFY(grandChild->isVisibleTo(grandChild));
+ QVERIFY(grandChild->isVisibleTo(child));
+ QVERIFY(!grandChild->isVisibleTo(parent));
+ QVERIFY(!grandChild->isVisibleTo(0));
+ QVERIFY(!child->isVisible());
+ QVERIFY(!child->isVisibleTo(child));
+ QVERIFY(!child->isVisibleTo(parent));
+ QVERIFY(!child->isVisibleTo(0));
+ QVERIFY(parent->isVisible());
+ QVERIFY(parent->isVisibleTo(parent));
+ QVERIFY(parent->isVisibleTo(0));
+ QVERIFY(!parent->isVisibleTo(child));
+ QVERIFY(!child->isVisibleTo(grandChild));
+ QVERIFY(!grandChild->isVisibleTo(stranger));
+ QVERIFY(!child->isVisibleTo(stranger));
+ QVERIFY(!parent->isVisibleTo(stranger));
+ QVERIFY(!stranger->isVisibleTo(grandChild));
+ QVERIFY(!stranger->isVisibleTo(child));
+ QVERIFY(!stranger->isVisibleTo(parent));
+
+ // Case 3: only grand child is hidden
+ child->show();
+ grandChild->hide();
+
+ QVERIFY(!grandChild->isVisible());
+ QVERIFY(!grandChild->isVisibleTo(grandChild));
+ QVERIFY(!grandChild->isVisibleTo(child));
+ QVERIFY(!grandChild->isVisibleTo(parent));
+ QVERIFY(!grandChild->isVisibleTo(0));
+ QVERIFY(child->isVisible());
+ QVERIFY(child->isVisibleTo(child));
+ QVERIFY(child->isVisibleTo(parent));
+ QVERIFY(child->isVisibleTo(0));
+ QVERIFY(parent->isVisible());
+ QVERIFY(parent->isVisibleTo(parent));
+ QVERIFY(parent->isVisibleTo(0));
+ QVERIFY(!parent->isVisibleTo(child));
+ QVERIFY(!child->isVisibleTo(grandChild));
+ QVERIFY(!grandChild->isVisibleTo(stranger));
+ QVERIFY(!child->isVisibleTo(stranger));
+ QVERIFY(!parent->isVisibleTo(stranger));
+ QVERIFY(!stranger->isVisibleTo(grandChild));
+ QVERIFY(!stranger->isVisibleTo(child));
+ QVERIFY(!stranger->isVisibleTo(parent));
+}
+
void tst_QGraphicsItem::explicitlyVisible()
{
QGraphicsScene scene;
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index b8741fe..8a26323 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -290,6 +290,7 @@ private slots:
void taskQT_3674_doNotCrash();
void taskQTBUG_15977_renderWithDeviceCoordinateCache();
void taskQTBUG_16401_focusItem();
+ void taskQTBUG_19680_tabWidgetFocus();
};
void tst_QGraphicsScene::initTestCase()
@@ -4711,5 +4712,72 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem()
QVERIFY(!scene.focusItem());
}
+void tst_QGraphicsScene::taskQTBUG_19680_tabWidgetFocus()
+{
+ QTabWidget tabWidget;
+ QGraphicsScene scene1;
+ QGraphicsScene scene2;
+ QGraphicsView view1(&scene1);
+ QGraphicsView view2(&scene2);
+
+ tabWidget.show();
+
+ tabWidget.addTab(&view1, "view1");
+ tabWidget.setCurrentWidget(&view1);
+
+ QGraphicsTextItem *textItem1 = scene1.addText("Text1");
+ textItem1->setFlags(QGraphicsItem::ItemIsFocusable);
+ textItem1->setTextInteractionFlags(Qt::TextEditorInteraction);
+ textItem1->setEnabled(true);
+ textItem1->setFocus();
+
+ tabWidget.addTab(&view2, "view2");
+ tabWidget.setCurrentWidget(&view2);
+
+ QGraphicsTextItem *textItem2 = scene2.addText("Text2");
+ textItem2->setFlags(QGraphicsItem::ItemIsFocusable);
+ textItem2->setTextInteractionFlags(Qt::TextEditorInteraction);
+ textItem2->setEnabled(true);
+ textItem2->setFocus();
+
+ scene2.clearFocus();
+
+ view2.clearFocus();
+ view2.setEnabled(false);
+ view2.setInteractive(false);
+ view2.setVisible(false);
+ view2.setShown(false);
+ view2.hide();
+
+ tabWidget.clearFocus();
+ tabWidget.setEnabled(false);
+ tabWidget.setShown(false);
+ tabWidget.setVisible(false);
+ tabWidget.hide();
+
+ tabWidget.setFocus();
+ tabWidget.setEnabled(true);
+ tabWidget.activateWindow();
+ tabWidget.setShown(true);
+ tabWidget.setVisible(true);
+ tabWidget.show();
+
+ view2.setFocus();
+ view2.setEnabled(true);
+ view2.activateWindow();
+ view2.setInteractive(true);
+ view2.setVisible(true);
+ view2.setShown(true);
+ view2.show();
+
+ QTest::qWaitForWindowShown(&view2);
+ QApplication::setActiveWindow(&tabWidget);
+
+ textItem2->setFocus();
+
+ QVERIFY(scene2.isActive());
+ QVERIFY(textItem2->hasFocus());
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 1df9d38..7b273d2 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -124,6 +124,8 @@ private slots:
void layout();
void layoutDirection_data();
void layoutDirection();
+ void recursiveLayoutDirection_data();
+ void recursiveLayoutDirection();
void paint_data();
void paint();
void palettePropagation();
@@ -1213,14 +1215,20 @@ void tst_QGraphicsWidget::layout()
void tst_QGraphicsWidget::layoutDirection_data()
{
QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
- QTest::newRow("rtl") << Qt::RightToLeft;
- QTest::newRow("ltr") << Qt::LeftToRight;
+ QTest::addColumn<bool>("setDirectionBeforeAddingWidget");
+
+ QTest::newRow("rtl, setting direction before adding widget") << Qt::RightToLeft << true;
+ QTest::newRow("ltr, setting direction before adding widget") << Qt::LeftToRight << true;
+ QTest::newRow("rtl, setting direction after adding widget") << Qt::RightToLeft << false;
+ QTest::newRow("ltr, setting direction after adding widget") << Qt::LeftToRight << false;
+
}
// Qt::LayoutDirection layoutDirection() const public
void tst_QGraphicsWidget::layoutDirection()
{
QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(bool, setDirectionBeforeAddingWidget);
QGraphicsScene scene;
QGraphicsView *view = new QGraphicsView(&scene);
SubQGraphicsWidget widget;
@@ -1228,13 +1236,16 @@ void tst_QGraphicsWidget::layoutDirection()
QCOMPARE(widget.layoutDirection(), Qt::LeftToRight);
QCOMPARE(widget.testAttribute(Qt::WA_SetLayoutDirection), false);
+ if (setDirectionBeforeAddingWidget)
+ widget.setLayoutDirection(layoutDirection);
QList<SubQGraphicsWidget*> children;
for (int i = 0; i < 10; ++i) {
SubQGraphicsWidget *item = new SubQGraphicsWidget(&widget);
children.append(item);
QCOMPARE(item->testAttribute(Qt::WA_SetLayoutDirection), false);
}
- widget.setLayoutDirection(layoutDirection);
+ if (!setDirectionBeforeAddingWidget)
+ widget.setLayoutDirection(layoutDirection);
QCOMPARE(widget.testAttribute(Qt::WA_SetLayoutDirection), true);
view->show();
QTest::qWaitForWindowShown(view);
@@ -1247,6 +1258,42 @@ void tst_QGraphicsWidget::layoutDirection()
delete view;
}
+void tst_QGraphicsWidget::recursiveLayoutDirection_data()
+{
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<bool>("setDirectionBeforeAddingWidget");
+
+ QTest::newRow("rtl, setting direction before adding widget") << Qt::RightToLeft << true;
+ QTest::newRow("ltr, setting direction before adding widget") << Qt::LeftToRight << true;
+ QTest::newRow("rtl, setting direction after adding widget") << Qt::RightToLeft << false;
+ QTest::newRow("ltr, setting direction after adding widget") << Qt::LeftToRight << false;
+}
+
+void tst_QGraphicsWidget::recursiveLayoutDirection()
+{
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(bool, setDirectionBeforeAddingWidget);
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget);
+ QGraphicsWidget *widget2 = new QGraphicsWidget;
+ QGraphicsLinearLayout *layout2 = new QGraphicsLinearLayout(widget2);
+ QGraphicsWidget *widget3 = new QGraphicsWidget;
+ QGraphicsLinearLayout *layout3 = new QGraphicsLinearLayout(widget3);
+
+ if (setDirectionBeforeAddingWidget)
+ widget->setLayoutDirection(layoutDirection);
+ layout->addItem(widget2);
+ layout2->addItem(widget3);
+ if (!setDirectionBeforeAddingWidget)
+ widget->setLayoutDirection(layoutDirection);
+
+ QCOMPARE(widget->layoutDirection(), layoutDirection);
+ QCOMPARE(widget2->layoutDirection(), layoutDirection);
+ QCOMPARE(widget3->layoutDirection(), layoutDirection);
+
+ delete widget;
+}
+
void tst_QGraphicsWidget::paint_data()
{
// currently QGraphicsWidget doesn't paint or do anything ...
diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp
index f1388bc..f3d26ef 100644
--- a/tests/auto/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/qgroupbox/tst_qgroupbox.cpp
@@ -83,6 +83,7 @@ private slots:
void toggledVsClicked();
void childrenAreDisabled();
void propagateFocus();
+ void task_QTBUG_19170_ignoreMouseReleseEvent();
private:
bool checked;
@@ -473,5 +474,27 @@ void tst_QGroupBox::propagateFocus()
QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(&lineEdit));
}
+void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleseEvent()
+{
+ QGroupBox box;
+ box.setCheckable(true);
+ box.setChecked(false);
+ box.setTitle("This is a test for QTBUG-19170");
+ box.show();
+
+ QStyleOptionGroupBox option;
+ option.initFrom(&box);
+ option.subControls = QStyle::SubControls(QStyle::SC_All);
+ QRect rect = box.style()->subControlRect(QStyle::CC_GroupBox, &option,
+ QStyle::SC_GroupBoxCheckBox, &box);
+
+ QTest::mouseClick(&box, Qt::LeftButton, 0, rect.center());
+ QCOMPARE(box.isChecked(), true);
+
+ box.setChecked(false);
+ QTest::mouseRelease(&box, Qt::LeftButton, 0, rect.center());
+ QCOMPARE(box.isChecked(), false);
+}
+
QTEST_MAIN(tst_QGroupBox)
#include "tst_qgroupbox.moc"
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp
index cd3f84f..b62dfbd 100644
--- a/tests/auto/qicon/tst_qicon.cpp
+++ b/tests/auto/qicon/tst_qicon.cpp
@@ -92,7 +92,7 @@ private:
const static QIcon staticIcon;
};
-// Creating an icon statically should not cause a crash.
+// Creating an icon statically should not cause a crash.
// But we do not officially support this. See QTBUG-8666
const QIcon tst_QIcon::staticIcon = QIcon::fromTheme("edit-find");
@@ -468,7 +468,19 @@ void tst_QIcon::addFile()
icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-32.png"), QSize(), QIcon::Selected);
icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-128.png"), QSize(), QIcon::Selected);
-#ifndef Q_OS_WINCE
+#ifdef Q_OS_WINCE
+ // WinCE only includes the 16x16 images for size reasons
+ QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() ==
+ QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
+ QVERIFY(icon.pixmap(16, QIcon::Selected).toImage() ==
+ QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-16.png")).toImage());
+#elif defined(Q_OS_SYMBIAN)
+ // Symbian only includes the 32x32 images for size reasons
+ QVERIFY(icon.pixmap(32, QIcon::Normal).toImage() ==
+ QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-32.png")).toImage());
+ QVERIFY(icon.pixmap(32, QIcon::Selected).toImage() ==
+ QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-32.png")).toImage());
+#else
QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() ==
QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
QVERIFY(icon.pixmap(32, QIcon::Normal).toImage() ==
@@ -481,12 +493,6 @@ void tst_QIcon::addFile()
QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-32.png")).toImage());
QVERIFY(icon.pixmap(128, QIcon::Selected).toImage() ==
QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-128.png")).toImage());
-#else
- // WinCE only includes the 16x16 images for size reasons
- QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() ==
- QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
- QVERIFY(icon.pixmap(16, QIcon::Selected).toImage() ==
- QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-save-16.png")).toImage());
#endif
}
@@ -537,18 +543,27 @@ void tst_QIcon::availableSizes()
QVERIFY(availableSizes.isEmpty());
}
+#ifndef Q_OS_SYMBIAN
+ const int defaultDimension = 16;
+ QLatin1String standardIcon(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png");
+#else
+ // In Symbian, only 32 times 32 icons are included.
+ const int defaultDimension = 32;
+ QLatin1String standardIcon(":/trolltech/styles/commonstyle/images/standardbutton-open-32.png");
+#endif
+
{
// we try to load an icon from resources
- QIcon icon(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png"));
+ QIcon icon(standardIcon);
QList<QSize> availableSizes = icon.availableSizes();
QCOMPARE(availableSizes.size(), 1);
- QCOMPARE(availableSizes.at(0), QSize(16, 16));
+ QCOMPARE(availableSizes.at(0), QSize(defaultDimension, defaultDimension));
}
{
// load an icon from binary data.
QPixmap pix;
- QFile file(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png"));
+ QFile file(standardIcon);
QVERIFY(file.open(QIODevice::ReadOnly));
uchar *data = file.map(0, file.size());
QVERIFY(data != 0);
@@ -557,7 +572,7 @@ void tst_QIcon::availableSizes()
QList<QSize> availableSizes = icon.availableSizes();
QCOMPARE(availableSizes.size(), 1);
- QCOMPARE(availableSizes.at(0), QSize(16,16));
+ QCOMPARE(availableSizes.at(0), QSize(defaultDimension, defaultDimension));
}
{
@@ -719,18 +734,29 @@ void tst_QIcon::fromTheme()
void tst_QIcon::task223279_inconsistentAddFile()
{
+#ifndef Q_OS_SYMBIAN
+ const int defaultDimension = 16;
+ const int invalidIconDimension = 32;
+ QLatin1String standardIcon(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png");
+#else
+ // Only 32 times 32 icons are included in Symbian
+ const int defaultDimension = 32;
+ const int invalidIconDimension = 64;
+ QLatin1String standardIcon(":/trolltech/styles/commonstyle/images/standardbutton-open-32.png");
+#endif
+
QIcon icon1;
- icon1.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png"));
- icon1.addFile(QLatin1String("IconThatDoesntExist"), QSize(32, 32));
- QPixmap pm1 = icon1.pixmap(32, 32);
+ icon1.addFile(standardIcon);
+ icon1.addFile(QLatin1String("IconThatDoesntExist"), QSize(invalidIconDimension, invalidIconDimension));
+ QPixmap pm1 = icon1.pixmap(invalidIconDimension, invalidIconDimension);
QIcon icon2;
- icon2.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png"));
+ icon2.addFile(standardIcon);
icon2.addFile(QLatin1String("IconThatDoesntExist"));
- QPixmap pm2 = icon1.pixmap(32, 32);
+ QPixmap pm2 = icon1.pixmap(invalidIconDimension, invalidIconDimension);
QCOMPARE(pm1.isNull(), false);
- QCOMPARE(pm1.size(), QSize(16,16));
+ QCOMPARE(pm1.size(), QSize(defaultDimension, defaultDimension));
QCOMPARE(pm1.isNull(), pm2.isNull());
QCOMPARE(pm1.size(), pm2.size());
}
diff --git a/tests/auto/qimagereader/images/test-flag-rle.tga b/tests/auto/qimagereader/images/test-flag-rle.tga
new file mode 100644
index 0000000..c14c712
--- /dev/null
+++ b/tests/auto/qimagereader/images/test-flag-rle.tga
Binary files differ
diff --git a/tests/auto/qimagereader/images/test-flag.tga b/tests/auto/qimagereader/images/test-flag.tga
new file mode 100644
index 0000000..c6d0c89
--- /dev/null
+++ b/tests/auto/qimagereader/images/test-flag.tga
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro
index 827819d..a9bfa1d 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -10,6 +10,7 @@ RESOURCES += qimagereader.qrc
!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG
!contains(QT_CONFIG, no-tiff):DEFINES += QTEST_HAVE_TIFF
!contains(QT_CONFIG, no-svg):DEFINES += QTEST_HAVE_SVG
+!contains(QT_CONFIG, no-tga):DEFINES += QTEST_HAVE_TGA
win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 2c70652..03c03d6 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -67,5 +67,7 @@
<file>images/corrupt.svgz</file>
<file>images/qtbug13653-no_eoi.jpg</file>
<file>images/txts.png</file>
+ <file>images/test-flag.tga</file>
+ <file>images/test-flag-rle.tga</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 5d958d7..2b867c3 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -168,6 +168,10 @@ private slots:
void tiffGrayscale();
#endif
+#if defined QTEST_HAVE_TGA
+ void tgaTestImages();
+#endif
+
void autoDetectImageFormat();
void fileNameProbing();
@@ -569,6 +573,10 @@ void tst_QImageReader::imageFormat_data()
QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng") << QImage::Format_Invalid;
QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg") << QImage::Format_ARGB32_Premultiplied;
QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz") << QImage::Format_ARGB32_Premultiplied;
+#if defined QTEST_HAVE_TGA
+ QTest::newRow("tga") << QString("test-flag.tga") << QByteArray("tga") << QImage::Format_ARGB32;
+ QTest::newRow("tga-rle") << QString("test-flag-rle.tga") << QByteArray("tga") << QImage::Format_ARGB32;
+#endif
}
void tst_QImageReader::imageFormat()
@@ -578,22 +586,31 @@ void tst_QImageReader::imageFormat()
QFETCH(QImage::Format, imageFormat);
if (QImageReader::imageFormat(prefix + fileName).isEmpty()) {
- if (QByteArray("jpeg") == format)
+ if (QByteArray("jpeg") == format) {
#ifndef QTEST_HAVE_JPEG
return;
#endif // !QTEST_HAVE_JPEG
- if (QByteArray("gif") == format)
+ }
+ if (QByteArray("gif") == format) {
#ifndef QTEST_HAVE_GIF
return;
#endif // !QTEST_HAVE_GIF
- if (QByteArray("mng") == format)
+ }
+ if (QByteArray("mng") == format) {
#ifndef QTEST_HAVE_MNG
return;
#endif // !QTEST_HAVE_MNG
- if (QByteArray("svg") == format || QByteArray("svgz") == format)
+ }
+ if (QByteArray("svg") == format || QByteArray("svgz") == format) {
#ifndef QTEST_HAVE_SVG
return;
#endif // !QTEST_HAVE_SVG
+ }
+ if (QByteArray("tga") == format) {
+#ifndef QTEST_HAVE_TGA
+ return;
+#endif // !QTEST_HAVE_TGA
+ }
QSKIP(("Qt does not support the " + format + " format.").constData(), SkipSingle);
} else {
QCOMPARE(QImageReader::imageFormat(prefix + fileName), format);
@@ -734,6 +751,11 @@ void tst_QImageReader::sizeBeforeRead()
{
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
+
+ if (fileName == QLatin1String("test-flag-rle.tga")) {
+ QSKIP("Qt does not support reading RLE compressed TGA files", SkipSingle);
+ }
+
QImageReader reader(prefix + fileName);
QVERIFY(reader.canRead());
if (format == "mng") {
@@ -1711,6 +1733,27 @@ void tst_QImageReader::tiffGrayscale()
}
#endif
+#if defined QTEST_HAVE_TGA
+void tst_QImageReader::tgaTestImages()
+{
+ QImage tgaTest(prefix + "test-flag.tga");
+
+ // Test image is 400x400 of a "flag" with a blue circle in the middle
+ // and a green square top left, and red rectangle on the bottom so
+ // so we test for pixels in those areas to ensure the image is not
+ // inverted or the palette is not messed up.
+ QVERIFY(!tgaTest.isNull());
+ QCOMPARE(tgaTest.size().width(), 400);
+ QCOMPARE(tgaTest.size().height(), 400);
+ QRgb pixel = tgaTest.pixel(200,200);
+ QCOMPARE(qRgb(0, 0, 255), pixel);
+ pixel = tgaTest.pixel(0, 0);
+ QCOMPARE(qRgb(0, 255, 0), pixel);
+ pixel = tgaTest.pixel(0, 399);
+ QCOMPARE(qRgb(255, 0, 0), pixel);
+}
+#endif
+
void tst_QImageReader::dotsPerMeter_data()
{
QTest::addColumn<QString>("fileName");
diff --git a/tests/auto/qintvalidator/tst_qintvalidator.cpp b/tests/auto/qintvalidator/tst_qintvalidator.cpp
index d537635..7e36093 100644
--- a/tests/auto/qintvalidator/tst_qintvalidator.cpp
+++ b/tests/auto/qintvalidator/tst_qintvalidator.cpp
@@ -168,6 +168,15 @@ void tst_QIntValidator::validate_data()
QTest::newRow("8.9") << -1 << 100 << QString("5") << ACC;
QTest::newRow("8.10") << -1 << 100 << QString("+") << INT;
QTest::newRow("8.11") << -1 << 100 << QString("+50") << ACC;
+
+ QTest::newRow("9.0") << -10 << 10 << QString("000") << ACC;
+ QTest::newRow("9.1") << -10 << 10 << QString("008") << ACC;
+ QTest::newRow("9.2") << -10 << 10 << QString("-008") << ACC;
+ QTest::newRow("9.3") << -10 << 10 << QString("00010") << ACC;
+ QTest::newRow("9.4") << -10 << 10 << QString("-00010") << ACC;
+ QTest::newRow("9.5") << -10 << 10 << QString("00020") << INV;
+ QTest::newRow("9.6") << -10 << 10 << QString("-00020") << INV;
+
}
void tst_QIntValidator::validateArabic()
diff --git a/tests/auto/qlibrary/qlibrary.pro b/tests/auto/qlibrary/qlibrary.pro
index 5dc129f..b351753 100644
--- a/tests/auto/qlibrary/qlibrary.pro
+++ b/tests/auto/qlibrary/qlibrary.pro
@@ -6,6 +6,8 @@ symbian: {
# Can't build two versions of lib with same name in symbian, so just build one
SUBDIRS = lib2 \
tst
+} else:integrity {
+# no shared support, empty test
} else {
SUBDIRS = lib \
lib2 \
diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro
index b2755b5..7d85cba 100644
--- a/tests/auto/qlocalsocket/test/test.pro
+++ b/tests/auto/qlocalsocket/test/test.pro
@@ -44,7 +44,7 @@ wince*|symbian {
scriptFiles.path = lackey/scripts
DEPLOYMENT += additionalFiles scriptFiles
QT += script # for easy deployment of QtScript
-
+
requires(contains(QT_CONFIG,script))
}
diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp
index c752362..f782bf8 100644
--- a/tests/auto/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp
@@ -661,7 +661,7 @@ void tst_QMdiArea::changeWindowTitle()
#else
widget->setWindowState(Qt::WindowMaximized);
#endif
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
#endif
@@ -671,7 +671,7 @@ void tst_QMdiArea::changeWindowTitle()
qApp->processEvents();
QTest::qWaitForWindowShown(mw);
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
#endif
@@ -689,7 +689,7 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowMaximized);
#endif
qApp->processEvents();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
widget->setWindowTitle( wc2 );
QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) );
@@ -707,7 +707,7 @@ void tst_QMdiArea::changeWindowTitle()
#endif
qApp->processEvents();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) );
#endif
#ifdef USE_SHOW
@@ -716,7 +716,7 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowNoState);
#endif
qApp->processEvents();
-#if defined(Q_WS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QCOMPARE(mw->windowTitle(), mwc);
#else
QCOMPARE( mw->windowTitle(), mwc2 );
@@ -728,7 +728,7 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowMaximized);
#endif
qApp->processEvents();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) );
#endif
@@ -777,7 +777,7 @@ void tst_QMdiArea::changeModified()
QCOMPARE( mw->isWindowModified(), false);
QCOMPARE( widget->isWindowModified(), true);
widget->setWindowState(Qt::WindowMaximized);
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QCOMPARE( mw->isWindowModified(), true);
#endif
QCOMPARE( widget->isWindowModified(), true);
@@ -787,7 +787,7 @@ void tst_QMdiArea::changeModified()
QCOMPARE( widget->isWindowModified(), true);
widget->setWindowState(Qt::WindowMaximized);
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QCOMPARE( mw->isWindowModified(), true);
#endif
QCOMPARE( widget->isWindowModified(), true);
@@ -797,7 +797,7 @@ void tst_QMdiArea::changeModified()
QCOMPARE( widget->isWindowModified(), false);
widget->setWindowModified(true);
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QCOMPARE( mw->isWindowModified(), true);
#endif
QCOMPARE( widget->isWindowModified(), true);
@@ -2046,7 +2046,7 @@ void tst_QMdiArea::delayedPlacement()
void tst_QMdiArea::iconGeometryInMenuBar()
{
-#if !defined (Q_WS_MAC) && !defined(Q_OS_WINCE)
+#if !defined (Q_WS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
QMainWindow mainWindow;
QMenuBar *menuBar = mainWindow.menuBar();
QMdiArea *mdiArea = new QMdiArea;
diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp
index ed085ce..06e242c 100644
--- a/tests/auto/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp
@@ -720,7 +720,8 @@ void tst_QMessageBox::detailsButtonText()
QAbstractButton* btn = NULL;
foreach(btn, list) {
if (btn && (btn->inherits("QPushButton"))) {
- if (btn->text() != QMessageBox::tr("OK") && btn->text() != QMessageBox::tr("Show Details...")) {
+ if (btn->text().remove("&") != QMessageBox::tr("OK")
+ && btn->text() != QMessageBox::tr("Show Details...")) {
QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text())));
}
}
diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
index a83f6dd..e4c88cd 100644
--- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
+++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
@@ -181,6 +181,14 @@ void tst_QNetworkCookie::parseSingleCookie_data()
QTest::newRow("with-value-with-special4") << "a = \"\\\"\" " << cookie;
cookie.setValue("\"\\\"a, b; c\\\"\"");
QTest::newRow("with-value-with-special5") << "a = \"\\\"a, b; c\\\"\"" << cookie;
+ // RFC6265 states that cookie values shouldn't contain commas, but we still allow them
+ // since they are only reserved for future compatibility and other browsers do the same.
+ cookie.setValue(",");
+ QTest::newRow("with-value-with-special6") << "a = ," << cookie;
+ cookie.setValue(",b");
+ QTest::newRow("with-value-with-special7") << "a = ,b" << cookie;
+ cookie.setValue("b,");
+ QTest::newRow("with-value-with-special8") << "a = b," << cookie;
cookie.setValue("b c");
QTest::newRow("with-value-with-whitespace") << "a = b c" << cookie;
@@ -599,7 +607,6 @@ void tst_QNetworkCookie::parseSingleCookie()
//QEXPECT_FAIL("network2", "QDateTime parsing problem: the date is beyond year 8000", Abort);
QCOMPARE(result.count(), 1);
- QEXPECT_FAIL("network3", "Cookie value contains commas, violating the HTTP spec", Abort);
QCOMPARE(result.at(0), expectedCookie);
result = QNetworkCookie::parseCookies(result.at(0).toRawForm());
@@ -634,48 +641,17 @@ void tst_QNetworkCookie::parseMultipleCookies_data()
// reason: malformed NAME=VALUE pair
QTest::newRow("invalid-05") << "foo" << list;
QTest::newRow("invalid-06") << "=b" << list;
- QTest::newRow("invalid-09") << "foo,a=b" << list;
- QTest::newRow("invalid-11") << ";path=/" << list;
+ QTest::newRow("invalid-07") << ";path=/" << list;
// reason: malformed expiration date string
- QTest::newRow("invalid-12") << "a=b;expires=" << list;
- QTest::newRow("invalid-13") << "a=b;expires=foobar" << list;
- QTest::newRow("invalid-14") << "a=b;expires=foobar, abc" << list;
- QTest::newRow("invalid-15") << "a=b;expires=foobar, dd-mmm-yyyy hh:mm:ss GMT; path=/" << list;
- QTest::newRow("invalid-16") << "a=b;expires=foobar, 32-Caz-1999 24:01:60 GMT; path=/" << list;
-
- QNetworkCookie cookie;
- cookie.setName("a");
- list += cookie;
- cookie.setName("c");
- cookie.setValue("d");
- list += cookie;
- QTest::newRow("two-1") << "a=,c=d" << list;
- QTest::newRow("two-2") << "a=, c=d" << list;
- QTest::newRow("two-3") << "a= ,c=d" << list;
- QTest::newRow("two-4") << "a= , c=d" << list;
-
- list.clear();
- list += cookie;
- cookie.setName("a");
- cookie.setValue(QByteArray());
- list += cookie;
- QTest::newRow("two-5") << "c=d,a=" << list;
- QTest::newRow("two-6") << "c=d, a=" << list;
- QTest::newRow("two-7") << "c=d , a=" << list;
-
- cookie.setName("foo");
- cookie.setValue("bar");
- cookie.setPath("/");
- list += cookie;
- QTest::newRow("complex-1") << "c=d, a=, foo=bar; path=/" << list;
-
- cookie.setName("baz");
- cookie.setDomain(".qt.nokia.com");
- list.prepend(cookie);
- QTest::newRow("complex-2") << "baz=bar; path=/; domain=.qt.nokia.com, c=d,a=,foo=bar; path=/" << list;
+ QTest::newRow("invalid-08") << "a=b;expires=" << list;
+ QTest::newRow("invalid-09") << "a=b;expires=foobar" << list;
+ QTest::newRow("invalid-10") << "a=b;expires=foobar, abc" << list;
+ QTest::newRow("invalid-11") << "a=b;expires=foobar, dd-mmm-yyyy hh:mm:ss GMT; path=/" << list;
+ QTest::newRow("invalid-12") << "a=b;expires=foobar, 32-Caz-1999 24:01:60 GMT; path=/" << list;
// cookies obtained from the network:
+ QNetworkCookie cookie;
cookie = QNetworkCookie("id", "51706646077999719");
cookie.setDomain(".bluestreak.com");
cookie.setPath("/");
diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index d1c376a..0125fc0 100644
--- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -417,6 +417,12 @@ void tst_QNetworkCookieJar::effectiveTLDs_data()
QTest::newRow("yes7") << "org.ws" << true;
QTest::newRow("yes8") << "co.uk" << true;
QTest::newRow("yes9") << "wallonie.museum" << true;
+ QTest::newRow("yes10") << "dyndns-at-home.com" << true;
+ QTest::newRow("yes11") << "forgot.her.name" << true;
+ QTest::newRow("yes12") << "is-a-llama.com" << true;
+ QTest::newRow("yes13") << "gov.uk" << true;
+ QTest::newRow("yes14") << "manchester.museum" << true;
+ QTest::newRow("yes15") << "gov.ir" << true;
QTest::newRow("no1") << "anything.com" << false;
QTest::newRow("no2") << "anything.de" << false;
diff --git a/tests/auto/qnetworkreply/.gitattributes b/tests/auto/qnetworkreply/.gitattributes
index 80252cf..7fa30e3 100644
--- a/tests/auto/qnetworkreply/.gitattributes
+++ b/tests/auto/qnetworkreply/.gitattributes
@@ -1,3 +1,4 @@
rfc3252.txt -crlf
bigfile -crlf
resource -crlf
+index.html -crlf
diff --git a/tests/auto/qnetworkreply/index.html b/tests/auto/qnetworkreply/index.html
new file mode 100644
index 0000000..135db79
--- /dev/null
+++ b/tests/auto/qnetworkreply/index.html
@@ -0,0 +1,3 @@
+<h1>Welcome to qt-test-server</h1>
+<img src="gif/fluke.gif" alt="fluke">
+<p>This is a network test server. It serves as a cacheing ftp and http proxy, transparent http/socks5 proxy, imap, ftp and http server, plus more.</p>
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 70287a9..371ac57 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -168,6 +168,7 @@ public Q_SLOTS:
void gotError();
void authenticationRequired(QNetworkReply*,QAuthenticator*);
void proxyAuthenticationRequired(const QNetworkProxy &,QAuthenticator*);
+ void pipeliningHelperSlot();
#ifndef QT_NO_OPENSSL
void sslErrors(QNetworkReply*,const QList<QSslError> &);
@@ -197,6 +198,8 @@ private Q_SLOTS:
void getFromHttp();
void getErrors_data();
void getErrors();
+ void headFromHttp_data();
+ void headFromHttp();
void putToFile_data();
void putToFile();
void putToFtp_data();
@@ -366,6 +369,7 @@ private Q_SLOTS:
void qtbug15311doubleContentLength();
void qtbug18232gzipContentLengthZero();
+ void nb279420gzipNoContentLengthEmptyContentDisconnect();
void synchronousRequest_data();
void synchronousRequest();
@@ -376,6 +380,8 @@ private Q_SLOTS:
void httpAbort();
void dontInsertPartialContentIntoTheCache();
+ void synchronousAuthenticationCache();
+ void pipelining();
// NOTE: This test must be last!
void parentingRepliesToTheApp();
@@ -497,6 +503,14 @@ protected:
client->setParent(this);
++totalConnections;
}
+
+ virtual void reply() {
+ // we need to emulate the bytesWrittenSlot call if the data is empty.
+ if (dataToTransmit.size() == 0)
+ QMetaObject::invokeMethod(this, "bytesWrittenSlot", Qt::QueuedConnection);
+ else
+ client->write(dataToTransmit);
+ }
private:
void connectSocketSignals()
{
@@ -530,11 +544,7 @@ public slots:
if (multiple)
receivedData.remove(0, doubleEndlPos+4);
- // we need to emulate the bytesWrittenSlot call if the data is empty.
- if (dataToTransmit.size() == 0)
- QMetaObject::invokeMethod(this, "bytesWrittenSlot", Qt::QueuedConnection);
- else
- client->write(dataToTransmit);
+ reply();
}
}
@@ -1610,6 +1620,65 @@ void tst_QNetworkReply::getFromHttp()
QCOMPARE(reply->readAll(), reference.readAll());
}
+void tst_QNetworkReply::headFromHttp_data()
+{
+ QTest::addColumn<qint64>("referenceSize");
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QString>("contentType");
+ QTest::addColumn<QNetworkProxy>("proxy");
+
+ qint64 rfcsize = QFileInfo(SRCDIR "/rfc3252.txt").size();
+ qint64 bigfilesize = QFileInfo(SRCDIR "/bigfile").size();
+ qint64 indexsize = QFileInfo(SRCDIR "/index.html").size();
+
+ //testing proxies, mainly for the 407 response from http proxy
+ for (int i = 0; i < proxies.count(); ++i) {
+ QTest::newRow("rfc" + proxies.at(i).tag) << rfcsize << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt") << "text/plain" << proxies.at(i).proxy;
+ QTest::newRow("bigfile" + proxies.at(i).tag) << bigfilesize << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/bigfile") << "text/plain" << proxies.at(i).proxy;
+ QTest::newRow("index" + proxies.at(i).tag) << indexsize << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/") << "text/html" << proxies.at(i).proxy;
+ QTest::newRow("with-authentication" + proxies.at(i).tag) << rfcsize << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt") << "text/plain" << proxies.at(i).proxy;
+ QTest::newRow("cgi" + proxies.at(i).tag) << (qint64)-1 << QUrl("http://qt-test-server/qtest/cgi-bin/httpcachetest_expires500.cgi") << "text/html" << proxies.at(i).proxy;
+ }
+}
+
+void tst_QNetworkReply::headFromHttp()
+{
+ QFETCH(qint64, referenceSize);
+ QFETCH(QUrl, url);
+ QFETCH(QString, contentType);
+ QFETCH(QNetworkProxy, proxy);
+
+ QNetworkRequest request(url);
+ QNetworkReplyPtr reply;
+
+ QElapsedTimer time;
+ time.start();
+
+ manager.setProxy(proxy);
+ connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
+ SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*)));
+ connect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
+
+ RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::HeadOperation, request, reply));
+
+ manager.disconnect(SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
+ this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*)));
+ manager.disconnect(SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
+
+ QVERIFY(time.elapsed() < 8000); //check authentication didn't wait for the server to timeout the http connection (15s on qt test server)
+
+ QCOMPARE(reply->url(), request.url());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
+ // only compare when the header is set.
+ if (reply->header(QNetworkRequest::ContentLengthHeader).isValid() && referenceSize >= 0)
+ QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), referenceSize);
+ if (reply->header(QNetworkRequest::ContentTypeHeader).isValid())
+ QCOMPARE(reply->header(QNetworkRequest::ContentTypeHeader).toString(), contentType);
+}
+
void tst_QNetworkReply::getErrors_data()
{
QTest::addColumn<QString>("url");
@@ -6073,6 +6142,28 @@ void tst_QNetworkReply::qtbug18232gzipContentLengthZero()
QCOMPARE(reply->readAll(), QByteArray());
}
+// Reproduced a crash in QHttpNetworkReplyPrivate::gunzipBodyPartiallyEnd
+// where zlib inflateEnd was called for uninitialized zlib stream
+void tst_QNetworkReply::nb279420gzipNoContentLengthEmptyContentDisconnect()
+{
+ // Response with no Content-Length in header and empty content
+ QByteArray response("HTTP/1.0 200 OK\r\nContent-Encoding: gzip\r\n\r\n");
+ MiniHttpServer server(response);
+ server.doClose = true;
+
+ QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(reply->isFinished());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->size(), qint64(0));
+ QVERIFY(!reply->header(QNetworkRequest::ContentLengthHeader).isValid());
+ QCOMPARE(reply->readAll(), QByteArray());
+}
+
void tst_QNetworkReply::synchronousRequest_data()
{
QTest::addColumn<QUrl>("url");
@@ -6283,6 +6374,117 @@ void tst_QNetworkReply::dontInsertPartialContentIntoTheCache()
QCOMPARE(memoryCache->m_insertedUrls.count(), 0);
}
+void tst_QNetworkReply::synchronousAuthenticationCache()
+{
+ class MiniAuthServer : public MiniHttpServer {
+ public:
+ MiniAuthServer(QThread *thread) : MiniHttpServer(QByteArray(), false, thread) {};
+ virtual void reply() {
+
+ dataToTransmit =
+ "HTTP/1.0 401 Unauthorized\r\n"
+ "WWW-Authenticate: Basic realm=\"QNetworkAccessManager Test Realm\"\r\n"
+ "Content-Length: 4\r\n"
+ "Connection: close\r\n"
+ "Content-Type: text/plain\r\n"
+ "\r\n"
+ "auth";
+ QRegExp rx("Authorization: Basic ([^\r\n]*)\r\n");
+ if (rx.indexIn(receivedData) > 0) {
+ if (QByteArray::fromBase64(rx.cap(1).toLatin1()) == "login:password") {
+ dataToTransmit =
+ "HTTP/1.0 200 OK\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Length: 2\r\n"
+ "\r\n"
+ "OK";
+ }
+ }
+ receivedData.clear();
+ MiniHttpServer::reply();
+ }
+ };
+
+ // when using synchronous commands, we need a different event loop for
+ // the server thread, because the client is never returning to the
+ // event loop
+ QScopedPointer<QThread, QThreadCleanup> serverThread(new QThread);
+ QScopedPointer<MiniHttpServer, QDeleteLaterCleanup> server(new MiniAuthServer(serverThread.data()));
+ server->doClose = true;
+
+ //1) URL without credentials, we are not authenticated
+ {
+ QUrl url = "http://localhost:" + QString::number(server->serverPort()) + "/path";
+ QNetworkRequest request(url);
+ request.setAttribute(QNetworkRequest::SynchronousRequestAttribute, true);
+
+ QNetworkReplyPtr reply = manager.get(request);
+ QVERIFY(reply->isFinished());
+ QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError);
+ }
+
+ //2) URL with credentials, we are authenticated
+ {
+ QUrl url = "http://login:password@localhost:" + QString::number(server->serverPort()) + "/path2";
+ QNetworkRequest request(url);
+ request.setAttribute(QNetworkRequest::SynchronousRequestAttribute, true);
+
+ QNetworkReplyPtr reply = manager.get(request);
+ QVERIFY(reply->isFinished());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->readAll().constData(), "OK");
+ }
+
+ //3) URL without credentials, we are authenticated because they are cached
+ {
+ QUrl url = "http://localhost:" + QString::number(server->serverPort()) + "/path3";
+ QNetworkRequest request(url);
+ request.setAttribute(QNetworkRequest::SynchronousRequestAttribute, true);
+
+ QNetworkReplyPtr reply = manager.get(request);
+ QVERIFY(reply->isFinished());
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->readAll().constData(), "OK");
+ }
+}
+
+void tst_QNetworkReply::pipelining()
+{
+ QString urlString("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi?");
+ QList<QNetworkReplyPtr> replies;
+ for (int a = 0; a < 20; a++) {
+ QNetworkRequest request(urlString + QString::number(a));
+ request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, QVariant(true));
+ replies.append(manager.get(request));
+ connect(replies.at(a), SIGNAL(finished()), this, SLOT(pipeliningHelperSlot()));
+ }
+ QTestEventLoop::instance().enterLoop(20);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+}
+
+void tst_QNetworkReply::pipeliningHelperSlot() {
+ static int a = 0;
+
+ // check that pipelining was used in at least one of the replies
+ static bool pipeliningWasUsed = false;
+ QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
+ bool pipeliningWasUsedInReply = reply->attribute(QNetworkRequest::HttpPipeliningWasUsedAttribute).toBool();
+ if (pipeliningWasUsedInReply)
+ pipeliningWasUsed = true;
+
+ // check that the contents match (the response to echo.cgi?3 should return 3 etc.)
+ QString urlQueryString = reply->url().queryItems().at(0).first;
+ QString content = reply->readAll();
+ QVERIFY2(urlQueryString == content, "data corruption with pipelining detected");
+
+ a++;
+
+ if (a == 20) { // all replies have finished
+ QTestEventLoop::instance().exitLoop();
+ QVERIFY2(pipeliningWasUsed, "pipelining was not used in any of the replies when trying to test pipelining");
+ }
+}
+
// NOTE: This test must be last testcase in tst_qnetworkreply!
void tst_QNetworkReply::parentingRepliesToTheApp()
{
diff --git a/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp
index 9052716..02d1e5a 100644
--- a/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp
+++ b/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp
@@ -414,7 +414,7 @@ void tst_QNetworkRequest::rawHeaderParsing_data()
QTest::newRow("SetCookie-3") << QNetworkRequest::SetCookieHeader
<< qVariantFromValue(QList<QNetworkCookie>() << cookie << cookie2)
<< true << "Set-Cookie"
- << "a=b; path=/, c=d";
+ << "a=b; path=/\nc=d";
}
void tst_QNetworkRequest::rawHeaderParsing()
diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp
index 1f52aec..f9ec6ce 100644
--- a/tests/auto/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp
@@ -139,11 +139,6 @@ private slots:
void tst_QObjectRace::moveToThreadRace()
{
-#if defined(Q_OS_SYMBIAN)
- // ### FIXME: task 257411 - remove xfail once this is fixed
- QEXPECT_FAIL("", "Symbian event dispatcher can't handle this kind of race, see task: 257411", Abort);
- QVERIFY(false);
-#endif
RaceObject *object = new RaceObject;
enum { ThreadCount = 6 };
@@ -229,13 +224,6 @@ public:
void tst_QObjectRace::destroyRace()
{
-#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86)
- // ### FIXME: task 257411 - remove xfail once this is fixed.
- // Oddly enough, this seems to work properly in HW, if given enough time and memory.
- QEXPECT_FAIL("", "Symbian event dispatcher can't handle this kind of race on emulator, see task: 257411", Abort);
- QVERIFY(false);
-#endif
-
enum { ThreadCount = 10, ObjectCountPerThread = 733,
ObjectCount = ThreadCount * ObjectCountPerThread };
diff --git a/tests/auto/qplugin/qplugin.pro b/tests/auto/qplugin/qplugin.pro
index 37a12da..1dcf0a7 100644
--- a/tests/auto/qplugin/qplugin.pro
+++ b/tests/auto/qplugin/qplugin.pro
@@ -22,7 +22,7 @@ mac {
SUBDIRS = debugplugin releaseplugin
tst_qplugin_pro.depends += debugplugin releaseplugin
}
-SUBDIRS += tst_qplugin.pro
+!integrity:SUBDIRS += tst_qplugin.pro
CONFIG += parallel_test
diff --git a/tests/auto/qpluginloader/qpluginloader.pro b/tests/auto/qpluginloader/qpluginloader.pro
index 6e41b4c..cb25b0f 100644
--- a/tests/auto/qpluginloader/qpluginloader.pro
+++ b/tests/auto/qpluginloader/qpluginloader.pro
@@ -1,10 +1,10 @@
QT = core
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS = lib \
+!integrity:SUBDIRS = lib \
theplugin \
tst
-!win32: !macx-*: !symbian: SUBDIRS += almostplugin
+!win32: !macx-*: !symbian: !integrity: SUBDIRS += almostplugin
TARGET = tst_qpluginloader
# no special install rule for subdir
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index d2d92a5..152d1f4 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -272,10 +272,10 @@ void tst_QPluginLoader::loadHints()
void tst_QPluginLoader::deleteinstanceOnUnload()
{
- for (int pass = 0; pass < 2; ++pass) {
+ for (int pass = 0; pass < 4; ++pass) {
QPluginLoader loader1;
loader1.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin
- if (pass == 0)
+ if (pass < 2)
loader1.load(); // not recommended, instance() should do the job.
PluginInterface *instance1 = qobject_cast<PluginInterface*>(loader1.instance());
QVERIFY(instance1);
@@ -283,21 +283,32 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
QPluginLoader loader2;
loader2.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin
- if (pass == 0)
+ if (pass < 2)
loader2.load(); // not recommended, instance() should do the job.
PluginInterface *instance2 = qobject_cast<PluginInterface*>(loader2.instance());
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed()));
QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed()));
- if (pass == 0) {
- QCOMPARE(loader2.unload(), false); // refcount not reached 0, not really unloaded
- QCOMPARE(spy1.count(), 0);
- QCOMPARE(spy2.count(), 0);
- }
+
+ // refcount not reached 0, not really unloaded
+ if (pass % 2)
+ QCOMPARE(loader1.unload(), false);
+ else
+ QCOMPARE(loader2.unload(), false);
+
+ QCOMPARE(spy1.count(), 0);
+ QCOMPARE(spy2.count(), 0);
+
QCOMPARE(instance1->pluginName(), QLatin1String("Plugin ok"));
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
- QVERIFY(loader1.unload()); // refcount reached 0, did really unload
+
+ // refcount reached 0, did really unload
+ if (pass % 2)
+ QVERIFY(loader2.unload());
+ else
+ QVERIFY(loader1.unload());
+
QCOMPARE(spy1.count(), 1);
QCOMPARE(spy2.count(), 1);
}
diff --git a/tests/auto/qprogressbar/tst_qprogressbar.cpp b/tests/auto/qprogressbar/tst_qprogressbar.cpp
index 04b7ce7..878cce8 100644
--- a/tests/auto/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/qprogressbar/tst_qprogressbar.cpp
@@ -63,6 +63,7 @@ private slots:
void text();
void format();
void setValueRepaint();
+ void setMinMaxRepaint();
void sizeHint();
void formatedText_data();
void formatedText();
@@ -216,6 +217,44 @@ void tst_QProgressBar::setValueRepaint()
}
}
+void tst_QProgressBar::setMinMaxRepaint()
+{
+ ProgressBar pbar;
+ pbar.setMinimum(0);
+ pbar.setMaximum(10);
+ pbar.setFormat("%v");
+ pbar.show();
+ QTest::qWaitForWindowShown(&pbar);
+
+ QApplication::processEvents();
+
+ // No repaint when setting minimum to the current minimum
+ pbar.repainted = false;
+ pbar.setMinimum(0);
+ QTest::qWait(50);
+ QTRY_VERIFY(!pbar.repainted);
+
+ // No repaint when setting maximum to the current maximum
+ pbar.repainted = false;
+ pbar.setMaximum(10);
+ QTest::qWait(50);
+ QTRY_VERIFY(!pbar.repainted);
+
+ // Repaint when setting minimum
+ for (int i = 9; i >= 0; i--) {
+ pbar.repainted = false;
+ pbar.setMinimum(i);
+ QTRY_VERIFY(pbar.repainted);
+ }
+
+ // Repaint when setting maximum
+ for (int i = 0; i < 10; ++i) {
+ pbar.repainted = false;
+ pbar.setMaximum(i);
+ QTRY_VERIFY(pbar.repainted);
+ }
+}
+
void tst_QProgressBar::sizeHint()
{
ProgressBar bar;
diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro
index 9ca6994..6359549 100644
--- a/tests/auto/qresourceengine/qresourceengine.pro
+++ b/tests/auto/qresourceengine/qresourceengine.pro
@@ -40,6 +40,8 @@ wince*|symbian:{
testsub2.path = testqrc/test/test
DEPLOYMENT += deploy test alias other search1 search2 sub testsub testsub2
!symbian:DEFINES += SRCDIR=\\\"\\\"
+} else:integrity {
+ DEFINES += SRCDIR=\"/\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro
index 014006e..37ab4ce 100644
--- a/tests/auto/qsharedpointer/qsharedpointer.pro
+++ b/tests/auto/qsharedpointer/qsharedpointer.pro
@@ -9,7 +9,12 @@ HEADERS += forwarddeclared.h \
wrapper.h
QT = core
-!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+integrity {
+ DEFINES += SRCDIR=\"/\"
+} else:!symbian {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
include(externaltests.pri)
CONFIG += parallel_test
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index 497f5a4..95ead61 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -246,7 +246,8 @@ public:
// addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3308, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 4.1.1
// addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3309, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 5.0.18 Linux
// addDb( "QMYSQL3", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // MySQL 5.1.36 Windows
-// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql4-nokia.trolltech.com.au" ); // MySQL 4.1.22-2.el4 linux
+
+// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql41.apac.nokia.com" ); // MySQL 4.1.22-2.el4 linux
// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql50.apac.nokia.com" ); // MySQL 5.0.45-7.el5 linux
// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "bq-mysql51.apac.nokia.com" ); // MySQL 5.1.36-6.7.2.i586 linux
@@ -256,13 +257,15 @@ public:
// addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5436 ); // V7.4
// addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5437 ); // V8.0.3
// addDb( "QPSQL7", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // V8.2.1, UTF-8
-// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres74-nokia.trolltech.com.au" ); // Version 7.4.19-1.el4_6.1
+
+// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-postgres74.apac.nokia.com" ); // Version 7.4.19-1.el4_6.1
// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql81.apac.nokia.com" ); // Version 8.1.11-1.el5_1.1
// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql84.apac.nokia.com" ); // Version 8.4.1-2.1.i586
// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "bq-pgsql90.apac.nokia.com" ); // Version 9.0.0
// addDb( "QDB2", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // DB2 v9.1 on silence
+// addDb( "QDB2", "testdb", "testuser", "Ee4Gabf6_", "bq-db2-972.apac.nokia.com" ); // DB2
// yes - interbase really wants the physical path on the host machine.
// addDb( "QIBASE", "/opt/interbase/qttest.gdb", "SYSDBA", "masterkey", "horsehead.nokia.troll.no" );
@@ -271,6 +274,9 @@ public:
// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird1-nokia.trolltech.com.au" ); // Firebird 1.5.5
// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird2-nokia.trolltech.com.au" ); // Firebird 2.1.1
+// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "bq-firebird1.apac.nokia.com" ); // Firebird 1.5.5
+// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "bq-firebird2.apac.nokia.com" ); // Firebird 2.1.1
+
// use in-memory database to prevent local files
// addDb("QSQLITE", ":memory:");
addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") );
diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp
index 79c3ba8..a6c7a86 100644
--- a/tests/auto/qstyle/tst_qstyle.cpp
+++ b/tests/auto/qstyle/tst_qstyle.cpp
@@ -213,10 +213,10 @@ void tst_QStyle::testStyleFactory()
#endif
#ifdef Q_WS_WIN
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP &&
- QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
QVERIFY(keys.contains("WindowsXP"));
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
- QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
QVERIFY(keys.contains("WindowsVista"));
#endif
diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro
index 64a043b..4cbc76d 100644
--- a/tests/auto/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro
@@ -7,6 +7,8 @@ symbian {
testData.files = tst_qtemporaryfile.cpp
testData.path = .
DEPLOYMENT += testData
+} else:integrity {
+ DEFINES += SRCDIR=\"/\"
}else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
index 5f3cb11..c52ca52 100644
--- a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
+++ b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro
@@ -2,7 +2,11 @@ load(qttest_p4)
QT = core
HEADERS +=
SOURCES += tst_qtextboundaryfinder.cpp
-!symbian:*:DEFINES += SRCDIR=\\\"$$PWD\\\"
+integrity {
+ DEFINES += SRCDIR=\"/\"
+} else:!symbian {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
wince*|symbian:{
addFiles.files = data
diff --git a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp
index f36b335..4489daa 100644
--- a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp
+++ b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp
@@ -146,7 +146,7 @@ void tst_QTextBrowser::cleanup()
void tst_QTextBrowser::noReloadOnAnchorJump()
{
- QUrl url("anchor.html");
+ QUrl url("file:anchor.html");
browser->htmlLoadAttempts = 0;
browser->setSource(url);
@@ -162,7 +162,7 @@ void tst_QTextBrowser::noReloadOnAnchorJump()
void tst_QTextBrowser::bgColorOnSourceChange()
{
- browser->setSource(QUrl("pagewithbg.html"));
+ browser->setSource(QUrl("file:pagewithbg.html"));
QVERIFY(browser->document()->rootFrame()->frameFormat().hasProperty(QTextFormat::BackgroundBrush));
QVERIFY(browser->document()->rootFrame()->frameFormat().background().color() == Qt::blue);
@@ -179,7 +179,7 @@ void tst_QTextBrowser::forwardButton()
QVERIFY(browser->historyTitle(0).isEmpty());
QVERIFY(browser->historyTitle(1).isEmpty());
- browser->setSource(QUrl("pagewithbg.html"));
+ browser->setSource(QUrl("file:pagewithbg.html"));
QVERIFY(!forwardEmissions.isEmpty());
QVariant val = forwardEmissions.takeLast()[0];
@@ -192,7 +192,7 @@ void tst_QTextBrowser::forwardButton()
QVERIFY(val.toBool() == false);
QVERIFY(browser->historyTitle(-1).isEmpty());
- QCOMPARE(browser->historyUrl(0), QUrl("pagewithbg.html"));
+ QCOMPARE(browser->historyUrl(0), QUrl("file:pagewithbg.html"));
QCOMPARE(browser->documentTitle(), QString("Page With BG"));
QCOMPARE(browser->historyTitle(0), QString("Page With BG"));
QVERIFY(browser->historyTitle(1).isEmpty());
@@ -244,7 +244,7 @@ void tst_QTextBrowser::forwardButton()
void tst_QTextBrowser::viewportPositionInHistory()
{
- browser->setSource(QUrl("bigpage.html"));
+ browser->setSource(QUrl("file:bigpage.html"));
browser->scrollToAnchor("bottom");
QVERIFY(browser->verticalScrollBar()->value() > 0);
@@ -283,7 +283,7 @@ void tst_QTextBrowser::relativeLinks()
void tst_QTextBrowser::anchors()
{
- browser->setSource(QUrl("bigpage.html"));
+ browser->setSource(QUrl("file:bigpage.html"));
browser->setSource(QUrl("#bottom"));
QVERIFY(browser->verticalScrollBar()->value() > 0);
@@ -306,7 +306,7 @@ void tst_QTextBrowser::forwardBackwardAvailable()
QVERIFY(!browser->isBackwardAvailable());
QVERIFY(!browser->isForwardAvailable());
- browser->setSource(QUrl("anchor.html"));
+ browser->setSource(QUrl("file:anchor.html"));
QVERIFY(!browser->isBackwardAvailable());
QVERIFY(!browser->isForwardAvailable());
QCOMPARE(backwardSpy.count(), 1);
@@ -406,7 +406,7 @@ void tst_QTextBrowser::clearHistory()
backwardSpy.clear();
forwardSpy.clear();
- browser->setSource(QUrl("anchor.html"));
+ browser->setSource(QUrl("file:anchor.html"));
QVERIFY(!browser->isBackwardAvailable());
QVERIFY(!browser->isForwardAvailable());
QCOMPARE(backwardSpy.count(), 1);
@@ -447,7 +447,7 @@ void tst_QTextBrowser::clearHistory()
void tst_QTextBrowser::sourceInsideLoadResource()
{
- QUrl url("pagewithimage.html");
+ QUrl url("file:pagewithimage.html");
browser->setSource(url);
QCOMPARE(browser->lastResource.toString(), QUrl::fromLocalFile(QDir::current().filePath("foobar.png")).toString());
QEXPECT_FAIL("", "This is currently not supported", Continue);
@@ -532,7 +532,7 @@ void tst_QTextBrowser::adjacentAnchors()
void tst_QTextBrowser::loadResourceOnRelativeLocalFiles()
{
- browser->setSource(QUrl("subdir/index.html"));
+ browser->setSource(QUrl("file:subdir/index.html"));
QVERIFY(!browser->toPlainText().isEmpty());
QVariant v = browser->loadResource(QTextDocument::HtmlResource, QUrl("../anchor.html"));
QVERIFY(v.isValid());
@@ -543,7 +543,7 @@ void tst_QTextBrowser::loadResourceOnRelativeLocalFiles()
void tst_QTextBrowser::focusIndicator()
{
HackBrowser *browser = new HackBrowser;
- browser->setSource(QUrl("firstpage.html"));
+ browser->setSource(QUrl("file:firstpage.html"));
QVERIFY(!browser->textCursor().hasSelection());
browser->focusTheNextChild();
@@ -595,7 +595,7 @@ void tst_QTextBrowser::focusIndicator()
void tst_QTextBrowser::focusHistory()
{
HackBrowser *browser = new HackBrowser;
- browser->setSource(QUrl("firstpage.html"));
+ browser->setSource(QUrl("file:firstpage.html"));
QVERIFY(!browser->textCursor().hasSelection());
browser->focusTheNextChild();
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index 2414ab3..67d8269 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -129,6 +129,7 @@ private slots:
void textWidthWithLineSeparator();
void cursorInLigatureWithMultipleLines();
void xToCursorForLigatures();
+ void cursorInNonStopChars();
private:
QFont testFont;
@@ -1465,7 +1466,7 @@ void tst_QTextLayout::textWidthWithLineSeparator()
void tst_QTextLayout::cursorInLigatureWithMultipleLines()
{
#if !defined(Q_WS_MAC)
- QSKIP("This test can not be run on Mac", SkipAll);
+ QSKIP("This test can only be run on Mac", SkipAll);
#endif
QTextLayout layout("first line finish", QFont("Times", 20));
layout.beginLayout();
@@ -1481,7 +1482,7 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines()
void tst_QTextLayout::xToCursorForLigatures()
{
#if !defined(Q_WS_MAC)
- QSKIP("This test can not be run on Mac", SkipAll);
+ QSKIP("This test can only be run on Mac", SkipAll);
#endif
QTextLayout layout("fi", QFont("Times", 20));
layout.beginLayout();
@@ -1502,5 +1503,19 @@ void tst_QTextLayout::xToCursorForLigatures()
line.xToCursor(width) == line.xToCursor(width / 2));
}
+void tst_QTextLayout::cursorInNonStopChars()
+{
+#if defined(Q_WS_MAC)
+ QSKIP("This test can not be run on Mac", SkipAll);
+#endif
+ QTextLayout layout(QString::fromUtf8("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8"));
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QVERIFY(line.cursorToX(1) == line.cursorToX(3));
+ QVERIFY(line.cursorToX(2) == line.cursorToX(3));
+}
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qtranslator/i18n/hellotr_en.qm b/tests/auto/qtranslator/i18n/hellotr_en.qm
new file mode 100644
index 0000000..cc42afe
--- /dev/null
+++ b/tests/auto/qtranslator/i18n/hellotr_en.qm
Binary files differ
diff --git a/tests/auto/qtranslator/tst_qtranslator.cpp b/tests/auto/qtranslator/tst_qtranslator.cpp
index 8e2ed15..6f65e6a 100644
--- a/tests/auto/qtranslator/tst_qtranslator.cpp
+++ b/tests/auto/qtranslator/tst_qtranslator.cpp
@@ -66,6 +66,10 @@ protected:
private slots:
void load();
void load2();
+ void loadSubdir();
+ void loadSubdir2();
+ void loadSubdir3();
+ void loadSubdir4();
void threadLoad();
void testLanguageChange();
void plural();
@@ -124,6 +128,38 @@ void tst_QTranslator::load2()
QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
}
+void tst_QTranslator::loadSubdir()
+{
+ QTranslator tor( 0 );
+ tor.load("hellotr_en_GB", "i18n");
+ QVERIFY(!tor.isEmpty());
+ QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
+}
+
+void tst_QTranslator::loadSubdir2()
+{
+ QTranslator tor( 0 );
+ tor.load("i18n/hellotr_en_GB");
+ QVERIFY(!tor.isEmpty());
+ QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
+}
+
+void tst_QTranslator::loadSubdir3()
+{
+ QTranslator tor( 0 );
+ tor.load(QString(QLatin1String("i18n%1hellotr_en_GB")).arg(QDir::separator()));
+ QVERIFY(!tor.isEmpty());
+ QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
+}
+
+void tst_QTranslator::loadSubdir4()
+{
+ QTranslator tor( 0 );
+ tor.load("./hellotr_en_GB", "i18n");
+ QVERIFY(!tor.isEmpty());
+ QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!"));
+}
+
class TranslatorThread : public QThread
{
void run() {
@@ -249,10 +285,10 @@ void tst_QTranslator::loadFromResource()
void tst_QTranslator::loadDirectory()
{
- QVERIFY(QFileInfo("../qtranslator").isDir());
+ QVERIFY(QFileInfo("i18n").isDir());
QTranslator tor;
- tor.load("qtranslator", "..");
+ tor.load("qtranslator", "i18n");
QVERIFY(tor.isEmpty());
}
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index b902370..c37a4ea 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -45,6 +45,7 @@
#include <QtTest/QtTest>
#include <QtGui/QtGui>
+#include <private/qabstractitemview_p.h>
#include "../../shared/util.h"
//TESTED_CLASS=
@@ -112,6 +113,8 @@ struct PublicView : public QTreeView
inline QStyleOptionViewItem viewOptions() const { return QTreeView::viewOptions(); }
inline int sizeHintForColumn(int column) const { return QTreeView::sizeHintForColumn(column); }
+ inline void startDrag(Qt::DropActions supportedActions) { QTreeView::startDrag(supportedActions); }
+ QAbstractItemViewPrivate* aiv_priv() { return static_cast<QAbstractItemViewPrivate*>(d_ptr.data()); }
};
class tst_QTreeView : public QObject
@@ -2384,6 +2387,14 @@ void tst_QTreeView::extendedSelection()
QTreeView view(&topLevel);
view.resize(qMax(mousePressPos.x() * 2, 200), qMax(mousePressPos.y() * 2, 200));
view.setModel(&model);
+
+ //ensure that mousePressPos is below the last row if we want to unselect
+ if (!selectedCount) {
+ int minimumHeight = model.rowCount() * view.visualRect(model.index(0,0)).size().height();
+ if (mousePressPos.y() < minimumHeight)
+ mousePressPos.setY(minimumHeight + 10);
+ }
+
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
topLevel.show();
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, mousePressPos);
@@ -2939,7 +2950,7 @@ void tst_QTreeView::styleOptionViewItem()
bool allCollapsed;
};
- QTreeView view;
+ PublicView view;
QStandardItemModel model;
view.setModel(&model);
MyDelegate delegate;
@@ -2998,6 +3009,12 @@ void tst_QTreeView::styleOptionViewItem()
QApplication::processEvents();
QTRY_VERIFY(delegate.count >= 4);
+ // test that the rendering of drag pixmap sets the correct options too (QTBUG-15834)
+ delegate.count = 0;
+ QItemSelection sel(model.index(0,0), model.index(0,3));
+ QRect rect;
+ view.aiv_priv()->renderToPixmap(sel.indexes(), &rect);
+ QTRY_VERIFY(delegate.count >= 4);
//test dynamic models
{
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index ee06b53..a881583 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -397,6 +397,9 @@ private slots:
void minimizedWindowModeTransitions();
void normalWindowModeTransitions();
void focusSwitchClosesPopupMenu();
+#if !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE)
+ void opacityChangeCausesBackingStoreRecreation();
+#endif
#endif
void focusProxyAndInputMethods();
@@ -10334,7 +10337,47 @@ void tst_QWidget::focusSwitchClosesPopupMenu()
mainWindow.activateWindow();
QVERIFY(!CEikonEnv::Static()->AppUiFactory()->MenuBar()->IsDisplayed());
}
-#endif
+
+#if !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE)
+class OpacityChangeWidget : public QWidget
+{
+public:
+ OpacityChangeWidget() : m_paintEngineType(QPaintEngine::MaxUser) { }
+ void paintEvent(QPaintEvent *)
+ {
+ QPainter painter(this);
+ m_paintEngineType = painter.paintEngine()->type();
+ }
+ QPaintEngine::Type paintEngineType() const { return m_paintEngineType; }
+private:
+ QPaintEngine::Type m_paintEngineType;
+};
+
+void tst_QWidget::opacityChangeCausesBackingStoreRecreation()
+{
+ OpacityChangeWidget w;
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ const QPaintEngine::Type type = w.paintEngineType();
+ if (QPaintEngine::OpenGL != type && QPaintEngine::OpenVG != type) {
+ QSKIP("Test case is only valid when using opengl or openvg graphics system", SkipAll);
+ } else {
+ if (QApplicationPrivate::instance()->useTranslucentEGLSurfaces) {
+ QSKIP("Test case is only valid when EGL surface transparency is not supported", SkipAll);
+ } else {
+ // Making window transparent should force switch to raster graphics system
+ w.setAttribute(Qt::WA_TranslucentBackground, true);
+ w.repaint();
+ QCOMPARE(w.paintEngineType(), QPaintEngine::Raster);
+ // Making window opaque should cause switch back to previous graphics system
+ w.setAttribute(Qt::WA_TranslucentBackground, false);
+ w.repaint();
+ QCOMPARE(w.paintEngineType(), type);
+ }
+ }
+}
+#endif // !Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
+#endif // Q_OS_SYMBIAN
class InputContextTester : public QInputContext
{
diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp
index e443720..51bb88e 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -167,6 +167,7 @@ private Q_SLOTS:
void setFocusQString() const;
void setFocusQStringFailure() const;
void setFocusQStringSignature() const;
+ void setFocusQStringFailureAfterSucces() const;
void recompilationWithEvaluateToResultFailing() const;
void secondEvaluationWithEvaluateToResultFailing() const;
void recompilationWithEvaluateToReceiver() const;
@@ -1976,6 +1977,25 @@ void tst_QXmlQuery::setFocusQStringSignature() const
static_cast<bool>(query.setFocus(QString()));
}
+void tst_QXmlQuery::setFocusQStringFailureAfterSucces() const
+{
+ /* Test for QTBUG-18050. First call setFocus with a valid string,
+ * and then with an invalid string. evaluateTo should not crash. */
+ QXmlQuery query;
+ MessageSilencer silencer;
+ query.setMessageHandler(&silencer);
+
+ QVERIFY(query.setFocus(QLatin1String("<test>valid-input</test>")));
+ QVERIFY(!query.setFocus(QLatin1String("invalid-input")));
+
+ query.setQuery("/query");
+
+ QString output;
+ /* Last setFocus was with an invalid string, so evaluateTo should return
+ * false */
+ QVERIFY(!query.evaluateTo(&output));
+}
+
void tst_QXmlQuery::setFocusQIODeviceTriggerWarnings() const
{
/* A null pointer. */
diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro
index 74cd075..1494e38 100644
--- a/tests/auto/selftests/selftests.pro
+++ b/tests/auto/selftests/selftests.pro
@@ -12,5 +12,6 @@ INSTALLS =
QT = core
+integrity: SUBDIRS -= test
CONFIG += parallel_test
diff --git a/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh b/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh
index a61f0a1..894fa5a 100755
--- a/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh
+++ b/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh
@@ -47,6 +47,8 @@
#
# To run the script, Saxon package version 9 and above shall be installed
#
+# Installation instruction
+# http://johnbokma.com/mexit/2011/07/04/installing-saxon-he-ubuntu.html
DIRECTORY_NAME="xmlschema2006-11-06"
ARCHIVE_NAME="xsts-2007-06-20.tar.gz"
@@ -62,5 +64,6 @@ rm $ARCHIVE_NAME
#CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs checkout -d xmlschema2006-11-06-new XML/xml-schema-test-suite/2004-01-14/xmlschema2006-11-06
#Saxon need to be installed before the following command works.
-java -jar /usr/share/java/saxon.jar -xsl:unifyCatalog.xsl -s:$DIRECTORY_NAME/suite.xml > testSuites.xml
+#java -jar /usr/share/java/saxonb.jar -xsl:unifyCatalog.xsl -s:$DIRECTORY_NAME/suite.xml > testSuites.xml
+saxon9he-xslt -xsl:unifyCatalog.xsl -s:$DIRECTORY_NAME/suite.xml > testSuites.xml
diff --git a/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd b/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd
new file mode 100644
index 0000000..532efcb
--- /dev/null
+++ b/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Test for QTBUG-21375: xmlpatternsvalidator does not allow for non-numeric literals in xsd:double attributes
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:element name="test1" type="TestType1" />
+ <xsd:element name="test2" type="TestType2" />
+ <xsd:element name="test3" type="TestType3" />
+
+ <xsd:complexType name="TestType1">
+ <xsd:attribute name="attribute1" type="DoubleWithRestrictions" default="INF" />
+ </xsd:complexType>
+
+ <xsd:complexType name="TestType2">
+ <xsd:attribute name="attribute2" type="DoubleWithRestrictions" default="-INF" />
+ </xsd:complexType>
+
+ <xsd:complexType name="TestType3">
+ <xsd:attribute name="attribute3" type="DoubleWithRestrictions" default="NaN" />
+ </xsd:complexType>
+
+ <xsd:simpleType name="DoubleWithRestrictions">
+ <xsd:union>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:double">
+ <xsd:enumeration value="-INF" />
+ <xsd:enumeration value="INF" />
+ <xsd:enumeration value="NaN" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:union>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
index 817ea1a..60c1fe8 100644
--- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
+++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
@@ -222,6 +222,11 @@ void tst_XmlPatternsValidator::xsdSupport_data() const
<< (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml")
<< QLatin1String("files/dateTime-with-microseconds.xsd"))
<< QString();
+
+ QTest::newRow("QTBUG-21375 A schema with a xs:double based simple type with non-numeric restrictions")
+ << 0
+ << (QStringList() << QLatin1String("files/schema-with-restrictions.xsd"))
+ << QString();
}
QTEST_MAIN(tst_XmlPatternsValidator)