summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp2
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp2
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp22
-rw-r--r--tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp9
-rw-r--r--tests/auto/corelib/thread/qsemaphore/BLACKLIST1
-rw-r--r--tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp8
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp6
-rw-r--r--tests/auto/other/lancelot/lancelot.pro2
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp9
-rw-r--r--tests/auto/other/lancelot/paintcommands.h5
-rw-r--r--tests/auto/other/lancelot/scripts/porter_duff.qps12
-rw-r--r--tests/auto/other/lancelot/scripts/porter_duff2.qps12
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp10
13 files changed, 76 insertions, 24 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index bb8bb6cc21..3465385ba7 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -100,11 +100,11 @@ tst_qmessagehandler::tst_qmessagehandler()
void tst_qmessagehandler::initTestCase()
{
+#if QT_CONFIG(process)
m_appDir = QFINDTESTDATA("app");
QVERIFY2(!m_appDir.isEmpty(), qPrintable(
QString::fromLatin1("Couldn't find helper app dir starting from %1.").arg(QDir::currentPath())));
-#if QT_CONFIG(process)
m_baseEnvironment = QProcess::systemEnvironment();
for (int i = 0; i < m_baseEnvironment.count(); ++i) {
if (m_baseEnvironment.at(i).startsWith("QT_MESSAGE_PATTERN=")) {
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 81c11ef085..9751bb4c9e 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -412,8 +412,10 @@ static QByteArray msgFileDoesNotExist(const QString &name)
void tst_QFile::initTestCase()
{
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
+#if QT_CONFIG(process)
m_stdinProcessDir = QFINDTESTDATA("stdinprocess");
QVERIFY(!m_stdinProcessDir.isEmpty());
+#endif
m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp");
QVERIFY(!m_testSourceFile.isEmpty());
m_testLogFile = QFINDTESTDATA("testlog.txt");
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
index dcd9eda4bb..9f67ccd9c9 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -101,6 +101,7 @@ private slots:
void testRoleNames();
void testDragActions();
+ void dragActionsFallsBackToDropActions();
void testFunctionPointerSignalConnection();
@@ -2157,6 +2158,27 @@ void tst_QAbstractItemModel::testDragActions()
QVERIFY(actions & Qt::MoveAction);
}
+class OverrideDropActions : public QStringListModel
+{
+ Q_OBJECT
+public:
+ OverrideDropActions(QObject *parent = 0)
+ : QStringListModel(parent)
+ {
+ }
+ Qt::DropActions supportedDropActions() const override
+ {
+ return Qt::MoveAction;
+ }
+};
+
+void tst_QAbstractItemModel::dragActionsFallsBackToDropActions()
+{
+ QAbstractItemModel *model = new OverrideDropActions(this);
+ QCOMPARE(model->supportedDragActions(), Qt::MoveAction);
+ QCOMPARE(model->supportedDropActions(), Qt::MoveAction);
+}
+
class SignalConnectionTester : public QObject
{
Q_OBJECT
diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
index f99241da3b..adc8c59bf7 100644
--- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
@@ -80,6 +80,8 @@ private slots:
void setData_emits_both_roles_data();
void setData_emits_both_roles();
+
+ void supportedDragDropActions();
};
void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved_data()
@@ -250,5 +252,12 @@ void tst_QStringListModel::setData_emits_both_roles()
expected);
}
+void tst_QStringListModel::supportedDragDropActions()
+{
+ QStringListModel model;
+ QCOMPARE(model.supportedDragActions(), Qt::CopyAction | Qt::MoveAction);
+ QCOMPARE(model.supportedDropActions(), Qt::CopyAction | Qt::MoveAction);
+}
+
QTEST_MAIN(tst_QStringListModel)
#include "tst_qstringlistmodel.moc"
diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST
index c198b90253..eb83b03556 100644
--- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST
+++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST
@@ -3,3 +3,4 @@ windows
osx-10.12
[tryAcquireWithTimeout:2s]
windows
+osx-10.12
diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
index dca718a6d8..cff26be7bb 100644
--- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
+++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp
@@ -125,6 +125,7 @@ private slots:
void itemRoleNames();
void getMimeDataWithInvalidModelIndex();
+ void supportedDragDropActions();
private:
QAbstractItemModel *m_model;
@@ -1666,5 +1667,12 @@ void tst_QStandardItemModel::getMimeDataWithInvalidModelIndex()
QVERIFY(!data);
}
+void tst_QStandardItemModel::supportedDragDropActions()
+{
+ QStandardItemModel model;
+ QCOMPARE(model.supportedDragActions(), Qt::CopyAction | Qt::MoveAction);
+ QCOMPARE(model.supportedDropActions(), Qt::CopyAction | Qt::MoveAction);
+}
+
QTEST_MAIN(tst_QStandardItemModel)
#include "tst_qstandarditemmodel.moc"
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index 757e4d16e4..16215714f3 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -699,9 +699,11 @@ void tst_QPainterPath::testOperatorDatastream()
path.addRect(0, 0, 100, 100);
path.setFillRule(Qt::WindingFill);
+ QTemporaryDir tempDir(QDir::tempPath() + "/tst_qpainterpath.XXXXXX");
+ QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
// Write out
{
- QFile data("data");
+ QFile data(tempDir.path() + "/data");
bool ok = data.open(QFile::WriteOnly);
QVERIFY(ok);
QDataStream stream(&data);
@@ -711,7 +713,7 @@ void tst_QPainterPath::testOperatorDatastream()
QPainterPath other;
// Read in
{
- QFile data("data");
+ QFile data(tempDir.path() + "/data");
bool ok = data.open(QFile::ReadOnly);
QVERIFY(ok);
QDataStream stream(&data);
diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro
index 73c12e67a2..6ece7315ed 100644
--- a/tests/auto/other/lancelot/lancelot.pro
+++ b/tests/auto/other/lancelot/lancelot.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_lancelot
-QT += testlib
+QT += testlib gui-private
SOURCES += tst_lancelot.cpp \
paintcommands.cpp
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index c28812e120..8419f93e3b 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -36,6 +36,7 @@
#include <qtextlayout.h>
#include <qdebug.h>
#include <QStaticText>
+#include <private/qimage_p.h>
#ifndef QT_NO_OPENGL
#include <QOpenGLFramebufferObjectFormat>
@@ -2402,7 +2403,13 @@ void PaintCommands::command_surface_begin(QRegExp re)
m_painter = new QPainter(&m_surface_pixmap);
#endif
} else {
- m_surface_image = QImage(qRound(w), qRound(h), QImage::Format_ARGB32_Premultiplied);
+ QImage::Format surface_format;
+ if (QImage::toPixelFormat(m_format).alphaUsage() != QPixelFormat::UsesAlpha)
+ surface_format = qt_alphaVersion(m_format);
+ else
+ surface_format = m_format;
+
+ m_surface_image = QImage(qRound(w), qRound(h), surface_format);
m_surface_image.fill(0);
m_painter = new QPainter(&m_surface_image);
}
diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h
index 4113fd6881..fc7496ce11 100644
--- a/tests/auto/other/lancelot/paintcommands.h
+++ b/tests/auto/other/lancelot/paintcommands.h
@@ -68,9 +68,10 @@ class PaintCommands
{
public:
// construction / initialization
- PaintCommands(const QStringList &cmds, int w, int h)
+ PaintCommands(const QStringList &cmds, int w, int h, QImage::Format format)
: m_painter(0)
, m_surface_painter(0)
+ , m_format(format)
, m_commands(cmds)
, m_gradientSpread(QGradient::PadSpread)
, m_gradientCoordinate(QGradient::LogicalMode)
@@ -246,8 +247,8 @@ private:
// attributes
QPainter *m_painter;
QPainter *m_surface_painter;
+ QImage::Format m_format;
QImage m_surface_image;
- QPixmap m_surface_pixmap;
QRectF m_surface_rect;
QStringList m_commands;
QString m_currentCommand;
diff --git a/tests/auto/other/lancelot/scripts/porter_duff.qps b/tests/auto/other/lancelot/scripts/porter_duff.qps
index 166e48a57f..94e9c68522 100644
--- a/tests/auto/other/lancelot/scripts/porter_duff.qps
+++ b/tests/auto/other/lancelot/scripts/porter_duff.qps
@@ -184,7 +184,7 @@ repeat_block postdraw
surface_end
-# Multiply
+# ColorBurn
surface_begin 100 300 100 100
repeat_block predraw
setCompositionMode ColorBurn
@@ -192,7 +192,7 @@ repeat_block postdraw
surface_end
-# Screen
+# HardLight
surface_begin 200 300 100 100
repeat_block predraw
setCompositionMode HardLight
@@ -200,7 +200,7 @@ repeat_block postdraw
surface_end
-# Overlay
+# SoftLight
surface_begin 300 300 100 100
repeat_block predraw
setCompositionMode SoftLight
@@ -208,7 +208,7 @@ repeat_block postdraw
surface_end
-# Darken
+# Difference
surface_begin 400 300 100 100
repeat_block predraw
setCompositionMode Difference
@@ -216,7 +216,7 @@ repeat_block postdraw
surface_end
-# Lighten
+# Exclusion
surface_begin 500 300 100 100
repeat_block predraw
setCompositionMode Exclusion
@@ -248,4 +248,4 @@ drawText 100 500 "ColorBurn"
drawText 200 500 "HardLight"
drawText 300 500 "SoftLight"
drawText 400 500 "Difference"
-drawText 500 500 "Exclusion" \ No newline at end of file
+drawText 500 500 "Exclusion"
diff --git a/tests/auto/other/lancelot/scripts/porter_duff2.qps b/tests/auto/other/lancelot/scripts/porter_duff2.qps
index a792d9b278..f538371ca1 100644
--- a/tests/auto/other/lancelot/scripts/porter_duff2.qps
+++ b/tests/auto/other/lancelot/scripts/porter_duff2.qps
@@ -194,7 +194,7 @@ repeat_block postdraw
surface_end
-# Multiply
+# ColorBurn
surface_begin 100 300 100 100
repeat_block predraw
setCompositionMode ColorBurn
@@ -202,7 +202,7 @@ repeat_block postdraw
surface_end
-# Screen
+# HardLight
surface_begin 200 300 100 100
repeat_block predraw
setCompositionMode HardLight
@@ -210,7 +210,7 @@ repeat_block postdraw
surface_end
-# Overlay
+# SoftLight
surface_begin 300 300 100 100
repeat_block predraw
setCompositionMode SoftLight
@@ -218,7 +218,7 @@ repeat_block postdraw
surface_end
-# Darken
+# Difference
surface_begin 400 300 100 100
repeat_block predraw
setCompositionMode Difference
@@ -226,7 +226,7 @@ repeat_block postdraw
surface_end
-# Lighten
+# Exclusion
surface_begin 500 300 100 100
repeat_block predraw
setCompositionMode Exclusion
@@ -258,4 +258,4 @@ drawText 100 500 "ColorBurn"
drawText 200 500 "HardLight"
drawText 300 500 "SoftLight"
drawText 400 500 "Difference"
-drawText 500 500 "Exclusion" \ No newline at end of file
+drawText 500 500 "Exclusion"
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index 63c62bab86..79d0f7c6cf 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -54,7 +54,7 @@ private:
void setupTestSuite(const QStringList& blacklist = QStringList());
void runTestSuite(GraphicsEngine engine, QImage::Format format, const QSurfaceFormat &contextFormat = QSurfaceFormat());
- void paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath);
+ void paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath);
QStringList qpsFiles;
QHash<QString, QStringList> scripts;
@@ -318,7 +318,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co
if (engine == Raster) {
QImage img(800, 800, format);
- paint(&img, engine, script, QFileInfo(filePath).absoluteFilePath());
+ paint(&img, engine, format, script, QFileInfo(filePath).absoluteFilePath());
rendered = img;
#ifndef QT_NO_OPENGL
} else if (engine == OpenGL) {
@@ -336,7 +336,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co
QOpenGLFramebufferObject fbo(800, 800, fmt);
fbo.bind();
QOpenGLPaintDevice pdv(800, 800);
- paint(&pdv, engine, script, QFileInfo(filePath).absoluteFilePath());
+ paint(&pdv, engine, format, script, QFileInfo(filePath).absoluteFilePath());
rendered = fbo.toImage().convertToFormat(format);
#endif
}
@@ -344,10 +344,10 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co
QBASELINE_TEST(rendered);
}
-void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, const QStringList &script, const QString &filePath)
+void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, QImage::Format format, const QStringList &script, const QString &filePath)
{
QPainter p(device);
- PaintCommands pcmd(script, 800, 800);
+ PaintCommands pcmd(script, 800, 800, format);
//pcmd.setShouldDrawText(false);
switch (engine) {
case OpenGL: