summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp27
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp2
-rw-r--r--tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp2
-rw-r--r--tests/auto/gui/painting/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/gui/painting/qpolygon/qpolygon.pro2
-rw-r--r--tests/auto/gui/painting/qtransform/qtransform.pro2
-rw-r--r--tests/auto/gui/painting/qwmatrix/qwmatrix.pro2
-rw-r--r--tests/auto/gui/text/qstatictext/qstatictext.pro4
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp61
-rw-r--r--tests/auto/gui/text/text.pro1
10 files changed, 71 insertions, 34 deletions
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index 079b14a64e..3c4610a892 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -31,6 +31,7 @@
#include <QImageReader>
#include <qicon.h>
#include <qiconengine.h>
+#include <QtCore/QStandardPaths>
#include <algorithm>
@@ -648,9 +649,20 @@ void tst_QIcon::fromTheme()
QVERIFY(!fullPathIcon.isNull());
}
+static inline QString findGtkUpdateIconCache()
+{
+ QString binary = QLatin1String("gtk-update-icon-cache");
+#ifdef Q_OS_WIN
+ binary += QLatin1String(".exe");
+#endif
+ return QStandardPaths::findExecutable(binary);
+}
+
void tst_QIcon::fromThemeCache()
{
QTemporaryDir dir;
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
+
QVERIFY(QDir().mkpath(dir.path() + QLatin1String("/testcache/16x16/actions")));
QVERIFY(QFile(QStringLiteral(":/styles/commonstyle/images/standardbutton-open-16.png"))
.copy( dir.path() + QLatin1String("/testcache/16x16/actions/button-open.png")));
@@ -700,11 +712,20 @@ void tst_QIcon::fromThemeCache()
QVERIFY(!QIcon::fromTheme("button-open").isNull());
// Try to run the actual gtk-update-icon-cache and make sure that icons are still found
+ const QString gtkUpdateIconCache = findGtkUpdateIconCache();
+ if (gtkUpdateIconCache.isEmpty()) {
+ QIcon::setThemeSearchPaths(QStringList());
+ QSKIP("gtk-update-icon-cache not run (binary not found)");
+ }
QProcess process;
- process.start(QStringLiteral("gtk-update-icon-cache"),
+ process.start(gtkUpdateIconCache,
QStringList() << QStringLiteral("-f") << QStringLiteral("-t") << (dir.path() + QLatin1String("/testcache")));
- if (!process.waitForFinished())
- QSKIP("gtk-update-icon-cache not run");
+ QVERIFY2(process.waitForStarted(), qPrintable(QLatin1String("Unable to start: ")
+ + gtkUpdateIconCache + QLatin1String(": ")
+ + process.errorString()));
+ QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
QVERIFY(QFileInfo(cacheName).lastModified() >= QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified());
QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes
QVERIFY(!QIcon::fromTheme("button-open").isNull());
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index ba5cfd1757..c12c8a9cf4 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -109,7 +109,7 @@ void tst_QImageWriter::initTestCase()
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
- writePrefix = m_temporaryDir.path();
+ writePrefix = m_temporaryDir.path() + QLatin1Char('/');
}
// Testing get/set functions
diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
index bd68400047..db0bfaf622 100644
--- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
@@ -137,7 +137,7 @@ void tst_QKeyEvent::modifiers_data()
for (quint64 bitmask = 1; bitmask < (1 << kNumModifiers) ; ++bitmask) {
QVector<int> modifierCombination;
for (quint64 modifier = 0; modifier < kNumModifiers; ++modifier) {
- if (bitmask & (1 << modifier))
+ if (bitmask & (quint64(1) << modifier))
modifierCombination.append(modifier);
}
modifierCombinations.append(modifierCombination);
diff --git a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
index 2536cb24c0..e153460bf2 100644
--- a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
+++ b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
@@ -7,4 +7,4 @@ QT += gui-private testlib
requires(contains(QT_CONFIG,private_tests))
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qpolygon/qpolygon.pro b/tests/auto/gui/painting/qpolygon/qpolygon.pro
index 9385b6458d..6bda0f8709 100644
--- a/tests/auto/gui/painting/qpolygon/qpolygon.pro
+++ b/tests/auto/gui/painting/qpolygon/qpolygon.pro
@@ -3,6 +3,6 @@ TARGET = tst_qpolygon
QT += testlib
SOURCES += tst_qpolygon.cpp
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qtransform/qtransform.pro b/tests/auto/gui/painting/qtransform/qtransform.pro
index 62c7518da0..6af8485628 100644
--- a/tests/auto/gui/painting/qtransform/qtransform.pro
+++ b/tests/auto/gui/painting/qtransform/qtransform.pro
@@ -3,4 +3,4 @@ TARGET = tst_qtransform
SOURCES += tst_qtransform.cpp
QT += testlib
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro
index efa2963091..de6454025c 100644
--- a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro
+++ b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro
@@ -3,4 +3,4 @@ TARGET = tst_qwmatrix
SOURCES += tst_qwmatrix.cpp
QT += testlib
-unix:!mac:!haiku:LIBS+=-lm
+unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro
index 002cead51d..0f4906ce4d 100644
--- a/tests/auto/gui/text/qstatictext/qstatictext.pro
+++ b/tests/auto/gui/text/qstatictext/qstatictext.pro
@@ -1,5 +1,7 @@
CONFIG += testcase
TARGET = tst_qstatictext
QT += testlib
-QT += core-private gui-private
+
SOURCES += tst_qstatictext.cpp
+
+contains(QT_CONFIG, private_tests): QT += core-private gui-private
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
index 7f4a11c5a5..ec30cc8b67 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -34,7 +34,9 @@
#include <qstatictext.h>
#include <qpaintengine.h>
+#ifdef QT_BUILD_INTERNAL
#include <private/qstatictext_p.h>
+#endif
// #define DEBUG_SAVE_IMAGE
@@ -89,8 +91,10 @@ private slots:
void unprintableCharacter_qtbug12614();
+#ifdef QT_BUILD_INTERNAL
void underlinedColor_qtbug20159();
void textDocumentColor();
+#endif
private:
bool supportsTransformations() const;
@@ -592,6 +596,29 @@ void tst_QStaticText::plainTextVsRichText()
QCOMPARE(imagePlainText, imageRichText);
}
+static bool checkPixels(const QImage &image,
+ Qt::GlobalColor expectedColor1, Qt::GlobalColor expectedColor2,
+ QByteArray *errorMessage)
+{
+ const QRgb expectedRgb1 = QColor(expectedColor1).rgba();
+ const QRgb expectedRgb2 = QColor(expectedColor2).rgba();
+
+ for (int x = 0, w = image.width(); x < w; ++x) {
+ for (int y = 0, h = image.height(); y < h; ++y) {
+ const QRgb pixel = image.pixel(x, y);
+ if (pixel != expectedRgb1 && pixel != expectedRgb2) {
+ QString message;
+ QDebug(&message) << "Color mismatch in image" << image
+ << "at" << x << ',' << y << ':' << showbase << hex << pixel
+ << "(expected: " << expectedRgb1 << ',' << expectedRgb2 << ')';
+ *errorMessage = message.toLocal8Bit();
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
void tst_QStaticText::setPenPlainText_data()
{
QTest::addColumn<QImage::Format>("format");
@@ -622,13 +649,9 @@ void tst_QStaticText::setPenPlainText()
p.drawStaticText(0, 0, staticText);
}
- for (int x=0; x<image.width(); ++x) {
- for (int y=0; y<image.height(); ++y) {
- QRgb pixel = image.pixel(x, y);
- QVERIFY(pixel == QColor(Qt::white).rgba()
- || pixel == QColor(Qt::yellow).rgba());
- }
- }
+ QByteArray errorMessage;
+ QVERIFY2(checkPixels(image, Qt::yellow, Qt::white, &errorMessage),
+ errorMessage.constData());
}
void tst_QStaticText::setPenRichText()
@@ -650,14 +673,9 @@ void tst_QStaticText::setPenRichText()
p.drawStaticText(0, 0, staticText);
}
- QImage img = image.toImage();
- for (int x=0; x<img.width(); ++x) {
- for (int y=0; y<img.height(); ++y) {
- QRgb pixel = img.pixel(x, y);
- QVERIFY(pixel == QColor(Qt::white).rgba()
- || pixel == QColor(Qt::green).rgba());
- }
- }
+ QByteArray errorMessage;
+ QVERIFY2(checkPixels(image.toImage(), Qt::green, Qt::white, &errorMessage),
+ errorMessage.constData());
}
void tst_QStaticText::richTextOverridesPen()
@@ -679,14 +697,9 @@ void tst_QStaticText::richTextOverridesPen()
p.drawStaticText(0, 0, staticText);
}
- QImage img = image.toImage();
- for (int x=0; x<img.width(); ++x) {
- for (int y=0; y<img.height(); ++y) {
- QRgb pixel = img.pixel(x, y);
- QVERIFY(pixel == QColor(Qt::white).rgba()
- || pixel == QColor(Qt::red).rgba());
- }
- }
+ QByteArray errorMessage;
+ QVERIFY2(checkPixels(image.toImage(), Qt::red, Qt::white, &errorMessage),
+ errorMessage.constData());
}
void tst_QStaticText::drawStruckOutText()
@@ -802,6 +815,7 @@ void tst_QStaticText::unprintableCharacter_qtbug12614()
QVERIFY(staticText.size().isValid()); // Force layout. Should not crash.
}
+#ifdef QT_BUILD_INTERNAL
void tst_QStaticText::underlinedColor_qtbug20159()
{
QString multiScriptText;
@@ -838,6 +852,7 @@ void tst_QStaticText::textDocumentColor()
QCOMPARE(d->items[1].color, QColor(Qt::red));
}
+#endif
QTEST_MAIN(tst_QStaticText)
#include "tst_qstatictext.moc"
diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro
index 6c0def4d63..dc67794a98 100644
--- a/tests/auto/gui/text/text.pro
+++ b/tests/auto/gui/text/text.pro
@@ -30,6 +30,5 @@ win32:SUBDIRS -= qtextpiecetable
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qfontcache \
qcssparser \
- qstatictext \
qtextlayout \
qtextpiecetable \