summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-03-26 12:34:19 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2019-03-26 12:34:19 +0000
commit920622b803629a454ef73284a0065fe31c3dc62c (patch)
treec184a793df107ac44874c7608b2df3ea9e8c7c7d /tests
parentb58c723404594d04f0b31b425da77b4fcbeec3b9 (diff)
parent7f635d9777baf4af85a2575de123a75ec58bda78 (diff)
Merge "Merge remote-tracking branch 'origin/5.13' into dev" into refs/staging/dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/kernel/qtimer/BLACKLIST5
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp20
-rw-r--r--tests/auto/other/gestures/BLACKLIST1
-rw-r--r--tests/auto/tools/qmake/testcompiler.cpp4
-rw-r--r--tests/auto/tools/qmake/testcompiler.h3
-rw-r--r--tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro1
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp86
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp2
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp4
-rw-r--r--tests/manual/dialogs/main.cpp4
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp12
11 files changed, 120 insertions, 22 deletions
diff --git a/tests/auto/corelib/kernel/qtimer/BLACKLIST b/tests/auto/corelib/kernel/qtimer/BLACKLIST
new file mode 100644
index 0000000000..16cbab4587
--- /dev/null
+++ b/tests/auto/corelib/kernel/qtimer/BLACKLIST
@@ -0,0 +1,5 @@
+[remainingTime]
+windows
+osx
+[basic_chrono]
+osx
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 361055ce67..302180586e 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -230,6 +230,8 @@ private slots:
void convertColorTable();
+ void wideImage();
+
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void toWinHBITMAP_data();
void toWinHBITMAP();
@@ -3559,6 +3561,24 @@ void tst_QImage::convertColorTable()
QCOMPARE(rgb32.pixel(0,0), 0xffffffff);
}
+void tst_QImage::wideImage()
+{
+ // QTBUG-73731 and QTBUG-73732
+ QImage i(538994187, 2, QImage::Format_ARGB32);
+ QImage i2(32, 32, QImage::Format_ARGB32);
+ i2.fill(Qt::white);
+
+ // Test that it doesn't crash:
+ QPainter painter(&i);
+ // With the composition mode is SourceOver out it's an invalid write
+ // With the composition mode is Source it's an invalid read
+ painter.drawImage(0, 0, i2);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ painter.drawImage(0, 0, i2);
+
+ // Qt6: Test that it actually works on 64bit architectures.
+}
+
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &p, int hbitmapFormat = 0);
diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST
index 269bac5750..c465ff316e 100644
--- a/tests/auto/other/gestures/BLACKLIST
+++ b/tests/auto/other/gestures/BLACKLIST
@@ -1,5 +1,6 @@
[]
rhel-7.4
+rhel-7.6
ubuntu-18.04
[customGesture]
# QTBUG-67254
diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp
index da76b3f2ca..3276d97354 100644
--- a/tests/auto/tools/qmake/testcompiler.cpp
+++ b/tests/auto/tools/qmake/testcompiler.cpp
@@ -67,7 +67,9 @@ static QString targetName( BuildType buildMode, const QString& target, const QSt
break;
case Dll: // dll
targetName.prepend("lib");
- targetName.append("." + version + ".dylib");
+ if (!version.isEmpty())
+ targetName.append('.' + version);
+ targetName.append(".dylib");
break;
case Lib: // lib
targetName.prepend("lib");
diff --git a/tests/auto/tools/qmake/testcompiler.h b/tests/auto/tools/qmake/testcompiler.h
index a46c9b6b6a..d3fe6d88f8 100644
--- a/tests/auto/tools/qmake/testcompiler.h
+++ b/tests/auto/tools/qmake/testcompiler.h
@@ -60,7 +60,8 @@ public:
// executes a make in the specified workPath, with an optional target (eg. install)
bool make( const QString &workPath, const QString &target = QString(), bool expectFail = false );
// checks if the executable exists in destDir
- bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version );
+ bool exists(const QString &destDir, const QString &exeName, BuildType buildType,
+ const QString &version = QString());
// removes the makefile
bool removeMakefile( const QString &workPath );
// removes the project file specified by 'project' on the 'workPath'
diff --git a/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro
index 4e362bb918..d13f49bb89 100644
--- a/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro
+++ b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro
@@ -6,7 +6,6 @@ DEFINES += SIMPLEDLL_MAKEDLL
HEADERS = simple.h
SOURCES = simple.cpp
-VERSION = 1.0.0
INCLUDEPATH += . tmp
MOC_DIR = tmp
OBJECTS_DIR = tmp
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index 10aabcf196..2b822e682f 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -30,9 +30,11 @@
#include "testcompiler.h"
+#include <QDir>
+#include <QDirIterator>
#include <QObject>
#include <QStandardPaths>
-#include <QDir>
+#include <QTemporaryDir>
#if defined(DEBUG_BUILD)
# define DIR_INFIX "debug/"
@@ -46,8 +48,12 @@ class tst_qmake : public QObject
{
Q_OBJECT
+public:
+ tst_qmake();
+
private slots:
void initTestCase();
+ void cleanupTestCase();
void cleanup();
void simple_app();
void simple_app_shadowbuild();
@@ -78,11 +84,41 @@ private slots:
private:
TestCompiler test_compiler;
+ QTemporaryDir tempWorkDir;
QString base_path;
+ const QString origCurrentDirPath;
};
+tst_qmake::tst_qmake()
+ : tempWorkDir(QDir::tempPath() + "/tst_qmake"),
+ origCurrentDirPath(QDir::currentPath())
+{
+}
+
+static void copyDir(const QString &sourceDirPath, const QString &targetDirPath)
+{
+ QDir currentDir;
+ QDirIterator dit(sourceDirPath, QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden);
+ while (dit.hasNext()) {
+ dit.next();
+ const QString targetPath = targetDirPath + QLatin1Char('/') + dit.fileName();
+ currentDir.mkpath(targetPath);
+ copyDir(dit.filePath(), targetPath);
+ }
+
+ QDirIterator fit(sourceDirPath, QDir::Files | QDir::Hidden);
+ while (fit.hasNext()) {
+ fit.next();
+ const QString targetPath = targetDirPath + QLatin1Char('/') + fit.fileName();
+ QFile::remove(targetPath); // allowed to fail
+ QFile src(fit.filePath());
+ QVERIFY2(src.copy(targetPath), qPrintable(src.errorString()));
+ }
+}
+
void tst_qmake::initTestCase()
{
+ QVERIFY2(tempWorkDir.isValid(), qPrintable(tempWorkDir.errorString()));
QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
QString cmd = QString("%1/qmake").arg(binpath);
#ifdef Q_CC_MSVC
@@ -99,13 +135,31 @@ void tst_qmake::initTestCase()
#else
test_compiler.setBaseCommands( "make", cmd );
#endif
- //Detect the location of the testdata
- QString subProgram = QLatin1String("testdata/simple_app/main.cpp");
- base_path = QFINDTESTDATA(subProgram);
- if (base_path.lastIndexOf(subProgram) > 0)
- base_path = base_path.left(base_path.lastIndexOf(subProgram));
- else
- base_path = QCoreApplication::applicationDirPath();
+ const QString testDataSubDir = QStringLiteral("testdata");
+ const QString subProgram = testDataSubDir + QLatin1String("/simple_app/main.cpp");
+ QString testDataPath = QFINDTESTDATA(subProgram);
+ if (!testDataPath.endsWith(subProgram))
+ QFAIL("Cannot find test data directory.");
+ testDataPath.chop(subProgram.length() - testDataSubDir.length());
+
+ QString userWorkDir = qgetenv("TST_QMAKE_BUILD_DIR");
+ if (userWorkDir.isEmpty()) {
+ base_path = tempWorkDir.path();
+ } else {
+ if (!QFile::exists(userWorkDir)) {
+ QFAIL(qUtf8Printable(QStringLiteral("TST_QMAKE_BUILD_DIR %1 does not exist.")
+ .arg(userWorkDir)));
+ }
+ base_path = userWorkDir;
+ }
+
+ copyDir(testDataPath, base_path + QLatin1Char('/') + testDataSubDir);
+}
+
+void tst_qmake::cleanupTestCase()
+{
+ // On Windows, ~QTemporaryDir fails to remove the directory if we're still in there.
+ QDir::setCurrent(origCurrentDirPath);
}
void tst_qmake::cleanup()
@@ -205,12 +259,12 @@ void tst_qmake::subdirs()
D.remove( workDir + "/simple_dll/Makefile");
QVERIFY( test_compiler.qmake( workDir, "subdirs" ));
QVERIFY( test_compiler.make( workDir ));
- QVERIFY( test_compiler.exists( workDir + "/simple_app/dest dir", "simple app", Exe, "1.0.0" ));
- QVERIFY( test_compiler.exists( workDir + "/simple_dll/dest dir", "simple dll", Dll, "1.0.0" ));
+ QVERIFY( test_compiler.exists(workDir + "/simple_app/dest dir", "simple app", Exe));
+ QVERIFY( test_compiler.exists(workDir + "/simple_dll/dest dir", "simple dll", Dll));
QVERIFY( test_compiler.makeClean( workDir ));
// Should still exist after a make clean
- QVERIFY( test_compiler.exists( workDir + "/simple_app/dest dir", "simple app", Exe, "1.0.0" ));
- QVERIFY( test_compiler.exists( workDir + "/simple_dll/dest dir", "simple dll", Dll, "1.0.0" ));
+ QVERIFY( test_compiler.exists(workDir + "/simple_app/dest dir", "simple app", Exe));
+ QVERIFY( test_compiler.exists(workDir + "/simple_dll/dest dir", "simple dll", Dll));
// Since subdirs templates do not have a make dist clean, we should clean up ourselves
// properly
QVERIFY( test_compiler.makeDistClean( workDir ));
@@ -500,8 +554,8 @@ void tst_qmake::resources()
QVERIFY(test_compiler.qmake(workDir, "resources"));
{
- QFile qrcFile(workDir + "/.rcc/" DIR_INFIX "qmake_pro_file.qrc");
- QVERIFY(qrcFile.exists());
+ QFile qrcFile(workDir + '/' + DIR_INFIX "qmake_pro_file.qrc");
+ QVERIFY2(qrcFile.exists(), qPrintable(qrcFile.fileName()));
QVERIFY(qrcFile.open(QFile::ReadOnly));
QByteArray qrcXml = qrcFile.readAll();
QVERIFY(qrcXml.contains("alias=\"resources.pro\""));
@@ -509,7 +563,7 @@ void tst_qmake::resources()
}
{
- QFile qrcFile(workDir + "/.rcc/" DIR_INFIX "qmake_subdir.qrc");
+ QFile qrcFile(workDir + '/' + DIR_INFIX "qmake_subdir.qrc");
QVERIFY(qrcFile.exists());
QVERIFY(qrcFile.open(QFile::ReadOnly));
QByteArray qrcXml = qrcFile.readAll();
@@ -517,7 +571,7 @@ void tst_qmake::resources()
}
{
- QFile qrcFile(workDir + "/.rcc/" DIR_INFIX "qmake_qmake_immediate.qrc");
+ QFile qrcFile(workDir + '/' + DIR_INFIX "qmake_qmake_immediate.qrc");
QVERIFY(qrcFile.exists());
QVERIFY(qrcFile.open(QFile::ReadOnly));
QByteArray qrcXml = qrcFile.readAll();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 55139ff99a..28df3a3c38 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -4075,6 +4075,8 @@ void tst_QGraphicsView::update()
QTRY_COMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect) & viewportRect);
}
QTRY_VERIFY(!viewPrivate->fullUpdatePending);
+#else
+ Q_UNUSED(updateRect);
#endif
}
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index e628dd2265..800baae45e 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -438,9 +438,9 @@ void FileDialogPanel::restoreDefaults()
setComboBoxValue(m_viewMode, d.viewMode());
m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly));
m_allowedSchemes->setText(QString());
- m_confirmOverWrite->setChecked(d.confirmOverwrite());
+ m_confirmOverWrite->setChecked(!d.testOption(QFileDialog::DontConfirmOverwrite));
m_nameFilterDetailsVisible->setChecked(!d.testOption(QFileDialog::HideNameFilterDetails));
- m_resolveSymLinks->setChecked(d.resolveSymlinks());
+ m_resolveSymLinks->setChecked(!d.testOption(QFileDialog::DontResolveSymlinks));
m_readOnly->setChecked(d.isReadOnly());
m_native->setChecked(true);
m_customDirIcons->setChecked(d.testOption(QFileDialog::DontUseCustomDirectoryIcons));
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index 2676ceeb52..07df8f5cf4 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -126,6 +126,10 @@ void MainWindow::aboutDialog()
int main(int argc, char *argv[])
{
+#if QT_VERSION >= 0x050600
+ QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+#endif
+
for (int a = 1; a < argc; ++a) {
if (!qstrcmp(argv[a], "-n")) {
qDebug("AA_DontUseNativeDialogs");
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp
index d999dbc30c..8d64d2f6a6 100644
--- a/tests/manual/dialogs/printdialogpanel.cpp
+++ b/tests/manual/dialogs/printdialogpanel.cpp
@@ -55,6 +55,10 @@
#include <QTextStream>
#include <QDir>
+#if QT_VERSION >= 0x050000
+# include <QScreen>
+#endif
+
const FlagData printerModeComboData[] =
{
{"ScreenResolution", QPrinter::ScreenResolution},
@@ -705,7 +709,13 @@ void PrintDialogPanel::showPreviewDialog()
{
applySettings(m_printer.data());
PrintPreviewDialog dialog(m_printer.data(), this);
- dialog.resize(QApplication::desktop()->availableGeometry().size() * 4/ 5);
+#if QT_VERSION >= 0x050000
+ const int screenNumber = QApplication::desktop()->screenNumber(this);
+ const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize();
+#else
+ const QSize availableSize = QApplication::desktop()->availableGeometry().size();
+#endif
+ dialog.resize(availableSize * 4/ 5);
if (dialog.exec() == QDialog::Accepted)
retrieveSettings(m_printer.data());
}