diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-24 21:10:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-07-24 22:37:52 +0200 |
commit | a1d2bf257e5240aadcd0d3b95f04ee2c86925b88 (patch) | |
tree | 874e4cc617fdae7e558a1ee653b9e2fbf3df1ad2 /tests | |
parent | 223f5c0273452b1ccd48b6f1057598f507a1b2b9 (diff) | |
parent | abd3b8030cbcc50379578b88ce6019e338ff8597 (diff) |
Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 7 | ||||
-rw-r--r-- | tests/auto/gui/text/qcssparser/qcssparser.pro | 5 | ||||
-rw-r--r-- | tests/auto/gui/text/qcssparser/testdata.qrc | 18 | ||||
-rw-r--r-- | tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 4 | ||||
-rw-r--r-- | tests/auto/gui/text/qglyphrun/qglyphrun.pro | 12 | ||||
-rw-r--r-- | tests/auto/gui/text/qglyphrun/testdata.qrc | 5 | ||||
-rw-r--r-- | tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp | 2 | ||||
-rw-r--r-- | tests/auto/gui/text/qrawfont/qrawfont.pro | 5 | ||||
-rw-r--r-- | tests/auto/gui/text/qrawfont/testdata.qrc | 6 | ||||
-rw-r--r-- | tests/auto/gui/text/qzip/qzip.pro | 8 | ||||
-rw-r--r-- | tests/auto/gui/text/qzip/testdata.qrc | 6 | ||||
-rw-r--r-- | tests/auto/gui/text/qzip/tst_qzip.cpp | 4 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp | 71 | ||||
-rw-r--r-- | tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 32 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp | 29 |
15 files changed, 203 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index df090c3de9..28b68dc750 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1029,6 +1029,13 @@ void tst_QUrl::toString_data() QTest::newRow("underscore") << QString::fromLatin1("http://foo_bar.host.com/rss.php") << uint(QUrl::None) << QString::fromLatin1("http://foo_bar.host.com/rss.php"); + + QTest::newRow("mailto-brackets") << QString::fromLatin1("mailto:test[at]gmail[dot]com") + << uint(QUrl::PrettyDecoded) + << QString::fromLatin1("mailto:test[at]gmail[dot]com"); + QTest::newRow("mailto-query") << QString::fromLatin1("mailto:?to=test@example.com") + << uint(QUrl::PrettyDecoded) + << QString::fromLatin1("mailto:?to=test@example.com"); } void tst_QUrl::toString() diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro index 346a38d5f6..bb0c8c4f40 100644 --- a/tests/auto/gui/text/qcssparser/qcssparser.pro +++ b/tests/auto/gui/text/qcssparser/qcssparser.pro @@ -15,3 +15,8 @@ wince* { DEPLOYMENT += addFiles timesFont } +android { + RESOURCES += \ + testdata.qrc + +} diff --git a/tests/auto/gui/text/qcssparser/testdata.qrc b/tests/auto/gui/text/qcssparser/testdata.qrc new file mode 100644 index 0000000000..56e45cfbb0 --- /dev/null +++ b/tests/auto/gui/text/qcssparser/testdata.qrc @@ -0,0 +1,18 @@ +<RCC> + <qresource prefix="/"> + <file>testdata/scanner/comments/input</file> + <file>testdata/scanner/comments/output</file> + <file>testdata/scanner/comments2/input</file> + <file>testdata/scanner/comments2/output</file> + <file>testdata/scanner/comments3/input</file> + <file>testdata/scanner/comments3/output</file> + <file>testdata/scanner/comments4/input</file> + <file>testdata/scanner/comments4/output</file> + <file>testdata/scanner/quotedstring/input</file> + <file>testdata/scanner/quotedstring/output</file> + <file>testdata/scanner/simple/input</file> + <file>testdata/scanner/simple/output</file> + <file>testdata/scanner/unicode/input</file> + <file>testdata/scanner/unicode/output</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 86e282fad2..719ca5a0a7 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -130,7 +130,9 @@ void tst_QCssParser::scanner_data() QTest::addColumn<QString>("input"); QTest::addColumn<QString>("output"); -#if !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) +#if defined(Q_OS_ANDROID) + QDir d(":/"); +#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE) QDir d(SRCDIR); #else QDir d(QDir::current()); diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro index db28a690a7..0993a5c49c 100644 --- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro +++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro @@ -8,8 +8,14 @@ linux: CONFIG += insignificant_test SOURCES += \ tst_qglyphrun.cpp +android { + RESOURCES += \ + testdata.qrc +} + wince* { - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" + additionalFiles.files = test.ttf + additionalFiles.path = . + DEPLOYMENT += additionalFiles } + diff --git a/tests/auto/gui/text/qglyphrun/testdata.qrc b/tests/auto/gui/text/qglyphrun/testdata.qrc new file mode 100644 index 0000000000..c4e237ad2f --- /dev/null +++ b/tests/auto/gui/text/qglyphrun/testdata.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>test.ttf</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index 3d2cde5fd3..f576627745 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -94,7 +94,7 @@ void tst_QGlyphRun::initTestCase() { m_testFont_ok = false; - m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf"); + m_testFontId = QFontDatabase::addApplicationFont(QFINDTESTDATA("test.ttf")); QVERIFY(m_testFontId >= 0); m_testFont = QFont("QtsSpecialTestFont"); diff --git a/tests/auto/gui/text/qrawfont/qrawfont.pro b/tests/auto/gui/text/qrawfont/qrawfont.pro index 540ffb94d7..1891e7a9bf 100644 --- a/tests/auto/gui/text/qrawfont/qrawfont.pro +++ b/tests/auto/gui/text/qrawfont/qrawfont.pro @@ -8,3 +8,8 @@ SOURCES += \ tst_qrawfont.cpp TESTDATA += testfont_bold_italic.ttf testfont.ttf + +android { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc new file mode 100644 index 0000000000..7bea0d5a39 --- /dev/null +++ b/tests/auto/gui/text/qrawfont/testdata.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>testfont_bold_italic.ttf</file> + <file>testfont.ttf</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro index 309f2167d1..ebcd6ec022 100644 --- a/tests/auto/gui/text/qzip/qzip.pro +++ b/tests/auto/gui/text/qzip/qzip.pro @@ -7,7 +7,9 @@ wince* { addFiles.files = testdata addFiles.path = . DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" +} + +android { + RESOURCES += \ + testdata.qrc } diff --git a/tests/auto/gui/text/qzip/testdata.qrc b/tests/auto/gui/text/qzip/testdata.qrc new file mode 100644 index 0000000000..c7e3a6b14e --- /dev/null +++ b/tests/auto/gui/text/qzip/testdata.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>testdata/symlink.zip</file> + <file>testdata/test.zip</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp index c5ce6c2676..9a5c4aaab9 100644 --- a/tests/auto/gui/text/qzip/tst_qzip.cpp +++ b/tests/auto/gui/text/qzip/tst_qzip.cpp @@ -68,7 +68,7 @@ void tst_QZip::cleanup() void tst_QZip::basicUnpack() { - QZipReader zip(QString(SRCDIR) + "/testdata/test.zip", QIODevice::ReadOnly); + QZipReader zip(QFINDTESTDATA("/testdata/test.zip"), QIODevice::ReadOnly); QList<QZipReader::FileInfo> files = zip.fileInfoList(); QCOMPARE(files.count(), 2); @@ -104,7 +104,7 @@ void tst_QZip::basicUnpack() void tst_QZip::symlinks() { - QZipReader zip(QString(SRCDIR) + "/testdata/symlink.zip", QIODevice::ReadOnly); + QZipReader zip(QFINDTESTDATA("/testdata/symlink.zip"), QIODevice::ReadOnly); QList<QZipReader::FileInfo> files = zip.fileInfoList(); QCOMPARE(files.count(), 2); diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 4740b92b84..d28f11ff9d 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -85,6 +85,9 @@ private slots: void oldCacheVersionFile_data(); void oldCacheVersionFile(); + void streamVersion_data(); + void streamVersion(); + void sync(); void crashWhenParentingCache(); @@ -568,6 +571,74 @@ void tst_QNetworkDiskCache::oldCacheVersionFile() } } +void tst_QNetworkDiskCache::streamVersion_data() +{ + QTest::addColumn<int>("version"); + QTest::newRow("Qt 5.1") << int(QDataStream::Qt_5_1); + QDataStream ds; + QTest::newRow("current") << ds.version(); + QTest::newRow("higher than current") << ds.version() + 1; +} + +void tst_QNetworkDiskCache::streamVersion() +{ + SubQNetworkDiskCache cache; + QUrl url(EXAMPLE_URL); + cache.setupWithOne(tempDir.path(), url); + + QString cacheFile; + // find the file + QStringList files = countFiles(cache.cacheDirectory()); + foreach (const QString &file, files) { + QFileInfo info(file); + if (info.isFile()) { + cacheFile = file; + break; + } + } + + QFile file(cacheFile); + QVERIFY(file.open(QFile::ReadWrite|QIODevice::Truncate)); + QDataStream out(&file); + QFETCH(int, version); + if (version < out.version()) + out.setVersion(version); + out << qint32(0xe8); // cache magic + // Following code works only for cache file version 8 and should be updated on version change + out << qint32(8); + out << qint32(version); + + QNetworkCacheMetaData md; + md.setUrl(url); + QNetworkCacheMetaData::RawHeader header("content-type", "text/html"); + QNetworkCacheMetaData::RawHeaderList list; + list.append(header); + md.setRawHeaders(list); + md.setLastModified(QDateTime::currentDateTimeUtc().toOffsetFromUtc(3600)); + out << md; + + bool compressed = true; + out << compressed; + + QByteArray data("Hello World!"); + out << qCompress(data); + + file.close(); + + QNetworkCacheMetaData cachedMetaData = cache.call_fileMetaData(cacheFile); + if (version > out.version()) { + QVERIFY(!cachedMetaData.isValid()); + QVERIFY(!QFile::exists(cacheFile)); + } else { + QVERIFY(cachedMetaData.isValid()); + QVERIFY(QFile::exists(cacheFile)); + QIODevice *dataDevice = cache.data(url); + QVERIFY(dataDevice != 0); + QByteArray cachedData = dataDevice->readAll(); + QCOMPARE(cachedData, data); + } +} + class Runner : public QThread { diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index c3d2c4a9e7..cd9ff28891 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -50,6 +50,7 @@ #include <QVBoxLayout> #include <QSizeGrip> #include <QDesktopWidget> +#include <QWindow> #include <private/qguiapplication_p.h> #include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme_p.h> @@ -85,6 +86,8 @@ private slots: void setVisible(); void reject(); void snapToDefaultButton(); + void transientParent_data(); + void transientParent(); private: QDialog *testWidget; @@ -584,5 +587,34 @@ void tst_QDialog::snapToDefaultButton() #endif // !QT_NO_CURSOR } +void tst_QDialog::transientParent_data() +{ + QTest::addColumn<bool>("nativewidgets"); + QTest::newRow("Non-native") << false; + QTest::newRow("Native") << true; +} + +void tst_QDialog::transientParent() +{ + QFETCH(bool, nativewidgets); + testWidget->hide(); + QWidget topLevel; + topLevel.resize(200, 200); + topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100)); + QVBoxLayout *layout = new QVBoxLayout(&topLevel); + QWidget *innerWidget = new QWidget(&topLevel); + layout->addWidget(innerWidget); + if (nativewidgets) + innerWidget->winId(); + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QDialog dialog(innerWidget); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + // Transient parent should always be the top level, also when using + // native child widgets. + QCOMPARE(dialog.windowHandle()->transientParent(), topLevel.windowHandle()); +} + QTEST_MAIN(tst_QDialog) #include "tst_qdialog.moc" diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 8de3291207..d66a10ae56 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -54,6 +54,8 @@ #include <qtextedit.h> #include <qtreeview.h> #include <qlabel.h> +#include <qdialog.h> +#include <qscreen.h> #include <qdebug.h> // for file error messages QT_FORWARD_DECLARE_CLASS(QSplitter) @@ -94,6 +96,8 @@ private slots: void taskQTBUG_4101_ensureOneNonCollapsedWidget_data(); void taskQTBUG_4101_ensureOneNonCollapsedWidget(); void setLayout(); + void autoAdd(); + private: void removeThirdWidget(); void addThirdWidget(); @@ -781,5 +785,28 @@ void tst_QSplitter::setLayout() QCOMPARE(splitter.layout(), &layout); } +void tst_QSplitter::autoAdd() +{ + QSplitter splitter; + splitter.setWindowTitle("autoAdd"); + splitter.setMinimumSize(QSize(200, 200)); + splitter.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100)); + splitter.show(); + QVERIFY(QTest::qWaitForWindowExposed(&splitter)); + // Constructing a child widget on the splitter should + // automatically add and show it. + QWidget *childWidget = new QWidget(&splitter); + QCOMPARE(splitter.count(), 1); + QTRY_VERIFY(childWidget->isVisible()); + // Deleting should automatically remove it + delete childWidget; + QCOMPARE(splitter.count(), 0); + // QTBUG-40132, top level windows should not be affected by this. + QDialog *dialog = new QDialog(&splitter); + QCOMPARE(splitter.count(), 0); + QCoreApplication::processEvents(); + QVERIFY(!dialog->isVisible()); +} + QTEST_MAIN(tst_QSplitter) #include "tst_qsplitter.moc" |