summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/gui.pro4
-rw-r--r--tests/auto/gui/image/image.pro2
-rw-r--r--tests/auto/gui/image/qicoimageformat/qicoimageformat.pro9
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp8
-rw-r--r--tests/auto/gui/image/qimage/qimage.pro2
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp202
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp12
-rw-r--r--tests/auto/gui/image/qmovie/qmovie.pro5
-rw-r--r--tests/auto/gui/image/qpixmap/qpixmap.pro4
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp33
-rw-r--r--tests/auto/gui/kernel/kernel.pro6
-rw-r--r--tests/auto/gui/kernel/noqteventloop/noqteventloop.pro2
-rw-r--r--tests/auto/gui/kernel/qclipboard/copier/main.cpp2
-rw-r--r--tests/auto/gui/kernel/qclipboard/paster/main.cpp4
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/test.pro4
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp6
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp12
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp18
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp12
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp16
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp4
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp21
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp56
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST4
-rw-r--r--tests/auto/gui/kernel/qwindow/qwindow.pro2
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp9
-rw-r--r--tests/auto/gui/painting/painting.pro2
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp52
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp63
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp21
-rw-r--r--tests/auto/gui/painting/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp77
-rw-r--r--tests/auto/gui/painting/qregion/tst_qregion.cpp40
-rw-r--r--tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp2
-rw-r--r--tests/auto/gui/qopengl/qopengl.pro2
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp2
-rw-r--r--tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp60
-rw-r--r--tests/auto/gui/text/qcssparser/qcssparser.pro12
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp114
-rw-r--r--tests/auto/gui/text/qfont/BLACKLIST2
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp31
-rw-r--r--tests/auto/gui/text/qfontcache/tst_qfontcache.cpp2
-rw-r--r--tests/auto/gui/text/qfontdatabase/qfontdatabase.pro7
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp20
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro11
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc1
-rw-r--r--tests/auto/gui/text/qrawfont/testfont_os2_v1.ttfbin0 -> 72960 bytes
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp30
-rw-r--r--tests/auto/gui/text/qstatictext/qstatictext.pro2
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp55
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp21
-rw-r--r--tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro2
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp2
-rw-r--r--tests/auto/gui/text/qzip/qzip.pro7
-rw-r--r--tests/auto/gui/text/qzip/tst_qzip.cpp2
-rw-r--r--tests/auto/gui/text/text.pro8
-rw-r--r--tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp2
57 files changed, 813 insertions, 300 deletions
diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro
index d3393663ed..8d8a2df393 100644
--- a/tests/auto/gui/gui.pro
+++ b/tests/auto/gui/gui.pro
@@ -3,7 +3,7 @@ TEMPLATE=subdirs
SUBDIRS = \
kernel
-!ios: SUBDIRS += \
+!uikit: SUBDIRS += \
image \
math3d \
painting \
@@ -13,4 +13,4 @@ SUBDIRS = \
util \
itemmodels \
-!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopengl qopenglconfig
+!qtConfig(opengl(es2)?): SUBDIRS -= qopengl qopenglconfig
diff --git a/tests/auto/gui/image/image.pro b/tests/auto/gui/image/image.pro
index 9199763c40..5a74df4c78 100644
--- a/tests/auto/gui/image/image.pro
+++ b/tests/auto/gui/image/image.pro
@@ -14,6 +14,6 @@ SUBDIRS=\
!qtHaveModule(network): SUBDIRS -= \
qimagereader
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qpixmapcache \
diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro
index 485472c70c..46bfb2a586 100644
--- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro
+++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro
@@ -3,14 +3,5 @@ TARGET = tst_qicoimageformat
SOURCES+= tst_qicoimageformat.cpp
QT += testlib
-wince {
- CONFIG(debug, debug|release):{
- addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll
- } else {
- addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll
- }
- addPlugins.path = imageformats
- DEPLOYMENT += addPlugins
-}
TESTDATA += icons/*
android:RESOURCES+=qicoimageformat.qrc
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index a0914b7700..4218d0751f 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -393,7 +393,6 @@ void tst_QIcon::addFile()
icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png"), QSize(), QIcon::Selected);
icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png"), QSize(), QIcon::Selected);
-#ifndef Q_OS_WINCE
QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() ==
QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
QVERIFY(icon.pixmap(32, QIcon::Normal).toImage() ==
@@ -406,13 +405,6 @@ void tst_QIcon::addFile()
QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png")).toImage());
QVERIFY(icon.pixmap(128, QIcon::Selected).toImage() ==
QPixmap(QLatin1String(":/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(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
- QVERIFY(icon.pixmap(16, QIcon::Selected).toImage() ==
- QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-16.png")).toImage());
-#endif
}
static bool sizeLess(const QSize &a, const QSize &b)
diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro
index 36d64a275f..39ce4e26cb 100644
--- a/tests/auto/gui/image/qimage/qimage.pro
+++ b/tests/auto/gui/image/qimage/qimage.pro
@@ -3,7 +3,7 @@ TARGET = tst_qimage
SOURCES += tst_qimage.cpp
QT += core-private gui-private testlib
-contains(QT_CONFIG, c++11): CONFIG += c++11
+qtConfig(c++11): CONFIG += c++11
android: RESOURCES+=qimage.qrc
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 85d258de5b..a1ab812aaa 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -39,6 +39,10 @@
#include <private/qimage_p.h>
#include <private/qdrawhelper_p.h>
+#ifdef Q_OS_DARWIN
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+
Q_DECLARE_METATYPE(QImage::Format)
Q_DECLARE_METATYPE(Qt::GlobalColor)
@@ -108,6 +112,7 @@ private slots:
void smoothScale();
void smoothScale2_data();
void smoothScale2();
+ void smoothScale3_data();
void smoothScale3();
void smoothScale4();
@@ -197,6 +202,14 @@ private slots:
void pixelColor();
void pixel();
+ void ditherGradient_data();
+ void ditherGradient();
+
+#ifdef Q_OS_DARWIN
+ void toCGImage_data();
+ void toCGImage();
+#endif
+
private:
const QString m_prefix;
};
@@ -292,17 +305,13 @@ void tst_QImage::swap()
void tst_QImage::create()
{
bool cr = true;
-#if !defined(Q_OS_WINCE)
QT_TRY {
-#endif
//QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian);
QImage image(7000000, 7000000, QImage::Format_Indexed8);
image.setColorCount(256);
cr = !image.isNull();
-#if !defined(Q_OS_WINCE)
} QT_CATCH (...) {
}
-#endif
QVERIFY( !cr );
}
@@ -1750,9 +1759,12 @@ static inline int rand8()
return int(256. * (qrand() / (RAND_MAX + 1.0)));
}
-// compares img.scale against the bilinear filtering used by QPainter
-void tst_QImage::smoothScale3()
+void tst_QImage::smoothScale3_data()
{
+ QTest::addColumn<QImage>("img");
+ QTest::addColumn<qreal>("scale_x");
+ QTest::addColumn<qreal>("scale_y");
+
QImage img(128, 128, QImage::Format_RGB32);
for (int y = 0; y < img.height(); ++y) {
for (int x = 0; x < img.width(); ++x) {
@@ -1765,36 +1777,49 @@ void tst_QImage::smoothScale3()
}
}
- qreal scales[2] = { .5, 2 };
+ QTest::newRow("(0.5, 0.5)") << img << qreal(0.5) << qreal(0.5);
+ QTest::newRow("(0.5, 1.0)") << img << qreal(0.5) << qreal(1.0);
+ QTest::newRow("(1.0, 0.5)") << img << qreal(1.0) << qreal(0.5);
+ QTest::newRow("(0.5, 2.0)") << img << qreal(0.5) << qreal(2.0);
+ QTest::newRow("(1.0, 2.0)") << img << qreal(1.0) << qreal(2.0);
+ QTest::newRow("(2.0, 0.5)") << img << qreal(2.0) << qreal(0.5);
+ QTest::newRow("(2.0, 1.0)") << img << qreal(2.0) << qreal(1.0);
+ QTest::newRow("(2.0, 2.0)") << img << qreal(2) << qreal(2);
+}
+// compares img.scale against the bilinear filtering used by QPainter
+void tst_QImage::smoothScale3()
+{
+ QFETCH(QImage, img);
+ QFETCH(qreal, scale_x);
+ QFETCH(qreal, scale_y);
- for (int i = 0; i < 2; ++i) {
- QImage a = img.scaled(img.size() * scales[i], Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- QImage b(a.size(), a.format());
- b.fill(0x0);
+ QImage a = img.scaled(img.width() * scale_x, img.height() * scale_y, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ QImage b(a.size(), a.format());
+ b.fill(0x0);
- QPainter p(&b);
- p.setRenderHint(QPainter::SmoothPixmapTransform);
- p.scale(scales[i], scales[i]);
- p.drawImage(0, 0, img);
- p.end();
- int err = 0;
-
- for (int y = 0; y < a.height(); ++y) {
- for (int x = 0; x < a.width(); ++x) {
- QRgb ca = a.pixel(x, y);
- QRgb cb = b.pixel(x, y);
-
- // tolerate a little bit of rounding errors
- bool r = true;
- r &= qAbs(qRed(ca) - qRed(cb)) <= 18;
- r &= qAbs(qGreen(ca) - qGreen(cb)) <= 18;
- r &= qAbs(qBlue(ca) - qBlue(cb)) <= 18;
- if (!r)
- err++;
- }
+ QPainter p(&b);
+ p.setRenderHint(QPainter::SmoothPixmapTransform);
+ p.scale(scale_x, scale_y);
+ p.drawImage(0, 0, img);
+ p.end();
+ int err = 0;
+
+ for (int y = 0; y < a.height(); ++y) {
+ for (int x = 0; x < a.width(); ++x) {
+ QRgb ca = a.pixel(x, y);
+ QRgb cb = b.pixel(x, y);
+
+ // tolerate a little bit of rounding errors
+ int tolerance = 3;
+ bool r = true;
+ r &= qAbs(qRed(ca) - qRed(cb)) <= tolerance;
+ r &= qAbs(qGreen(ca) - qGreen(cb)) <= tolerance;
+ r &= qAbs(qBlue(ca) - qBlue(cb)) <= tolerance;
+ if (!r)
+ err++;
}
- QCOMPARE(err, 0);
}
+ QCOMPARE(err, 0);
}
// Tests smooth upscale is smooth
@@ -1819,11 +1844,7 @@ void tst_QImage::smoothScale4()
void tst_QImage::smoothScaleBig()
{
-#if defined(Q_OS_WINCE)
- int bigValue = 2000;
-#else
int bigValue = 200000;
-#endif
QImage tall(4, bigValue, QImage::Format_ARGB32);
tall.fill(0x0);
@@ -3222,5 +3243,114 @@ void tst_QImage::pixel()
}
}
+void tst_QImage::ditherGradient_data()
+{
+ QTest::addColumn<QImage>("image");
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<int>("minimumExpectedGradient");
+
+ QImage rgb32(256, 16, QImage::Format_RGB32);
+ QLinearGradient gradient(QRectF(rgb32.rect()).topLeft(), QRectF(rgb32.rect()).topRight());
+ gradient.setColorAt(0.0, QColor(0, 0, 0));
+ gradient.setColorAt(1.0, QColor(255, 255, 255));
+ QPainter p;
+ p.begin(&rgb32);
+ p.fillRect(rgb32.rect(), gradient);
+ p.end();
+
+ QTest::newRow("rgb32 -> rgb444 (no dither)") << rgb32 << QImage::Format_RGB444 << 0 << 16;
+ QTest::newRow("rgb32 -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("rgb32 -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("rgb32 -> rgb16 (no dither)") << rgb32 << QImage::Format_RGB16 << 0 << 32;
+ QTest::newRow("rgb32 -> rgb16 (dithering)") << rgb32 << QImage::Format_RGB16 << int(Qt::PreferDither | Qt::OrderedDither) << 65;
+ QTest::newRow("rgb32 -> rgb666 (no dither)") << rgb32 << QImage::Format_RGB666 << 0 << 64;
+ QTest::newRow("rgb32 -> rgb666 (dithering)") << rgb32 << QImage::Format_RGB666 << int(Qt::PreferDither | Qt::OrderedDither) << 129;
+
+ // Test we get the same results for opaque input in the ARGBPM implementation.
+ rgb32 = qMove(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QTest::newRow("argb32pm -> argb4444pm (no dither)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << 0 << 16;
+ QTest::newRow("argb32pm -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("argb32pm -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("argb32pm -> argb8565pm (no dither)") << rgb32 << QImage::Format_ARGB8565_Premultiplied << 0 << 32;
+ QTest::newRow("argb32pm -> argb8565pm (dithering)") << rgb32 << QImage::Format_ARGB8565_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 65;
+ QTest::newRow("argb32pm -> argb6666pm (no dither)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << 0 << 64;
+ QTest::newRow("argb32pm -> argb6666pm (dithering)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 129;
+
+ QImage rgb30(1024, 16, QImage::Format_RGB30);
+ QLinearGradient gradient30(QRectF(rgb30.rect()).topLeft(), QRectF(rgb30.rect()).topRight());
+ gradient30.setColorAt(0.0, QColor(0, 0, 0));
+ gradient30.setColorAt(1.0, QColor(255, 255, 255));
+ p.begin(&rgb30);
+ p.fillRect(rgb30.rect(), gradient30);
+ p.end();
+
+ QTest::newRow("rgb30 -> rgb32 (no dither)") << rgb30 << QImage::Format_RGB32 << 0 << 256;
+ QTest::newRow("rgb30 -> rgb32 (dithering)") << rgb30 << QImage::Format_RGB32 << int(Qt::PreferDither | Qt::OrderedDither) << 513;
+ QTest::newRow("rgb30 -> rgb888 (no dither)") << rgb30 << QImage::Format_RGB888 << 0 << 256;
+ QTest::newRow("rgb30 -> rgb888 (dithering)") << rgb30 << QImage::Format_RGB888 << int(Qt::PreferDither | Qt::OrderedDither) << 513;
+}
+
+void tst_QImage::ditherGradient()
+{
+ QFETCH(QImage, image);
+ QFETCH(QImage::Format, format);
+ QFETCH(int, flags);
+ QFETCH(int, minimumExpectedGradient);
+
+ QImage converted = image.convertToFormat(format, (Qt::ImageConversionFlags)flags);
+ int observedGradientSteps = 0;
+ int lastTotal = -1;
+ for (int i = 0; i < converted.width(); ++i) {
+ int total = 0;
+ for (int j = 0; j < converted.height(); ++j) {
+ uint c = converted.pixel(i, j);
+ QCOMPARE(qAlpha(c), 255);
+ total += qRed(c);
+ }
+ if (total > lastTotal) {
+ observedGradientSteps++;
+ lastTotal = total;
+ }
+ }
+ QVERIFY(observedGradientSteps >= minimumExpectedGradient);
+}
+
+#ifdef Q_OS_DARWIN
+
+void tst_QImage::toCGImage_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<bool>("supported");
+
+ // Populate test data with supported status for all QImage formats.
+ QSet<QImage::Format> supported =
+ { QImage::Format_ARGB32, QImage::Format_RGB32, QImage::Format_RGBA8888_Premultiplied,
+ QImage::Format_RGBA8888, QImage::Format_RGBX8888, QImage::Format_ARGB32_Premultiplied };
+
+ for (int i = QImage::Format_Invalid; i < QImage::Format_Grayscale8; ++i) {
+ QTest::newRow(qPrintable(formatToString(QImage::Format(i))))
+ << QImage::Format(i) << supported.contains(QImage::Format(i));
+ }
+}
+
+// Verify that toCGImage() returns a valid CGImageRef for supported image formats.
+void tst_QImage::toCGImage()
+{
+ QFETCH(QImage::Format, format);
+ QFETCH(bool, supported);
+
+ QImage qimage(64, 64, format);
+ qimage.fill(Qt::red);
+
+ CGImageRef cgimage = qimage.toCGImage();
+ QCOMPARE(cgimage != nullptr, supported);
+
+ CGImageRelease(cgimage);
+}
+
+#endif
+
+
QTEST_GUILESS_MAIN(tst_QImage)
#include "tst_qimage.moc"
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index 7a94217641..191aabdf6a 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -239,7 +239,7 @@ void tst_QImageWriter::writeImage2_data()
foreach (const QString format, formats) {
const QString fileName = QLatin1String("solidcolor_")
+ QString::number(imgFormat) + QLatin1Char('.') + format;
- QTest::newRow(fileName.toLatin1()) << fileName
+ QTest::newRow(fileName.toLatin1()) << writePrefix + fileName
<< format.toLatin1()
<< image;
}
@@ -496,9 +496,6 @@ void tst_QImageWriter::saveToTemporaryFile()
QVERIFY(writer.write(image));
else
qWarning() << file.errorString();
-#if defined(Q_OS_WINCE)
- file.reset();
-#endif
QCOMPARE(QImage(writer.fileName()), image);
}
{
@@ -513,18 +510,15 @@ void tst_QImageWriter::saveToTemporaryFile()
}
{
// 3) Via QImageWriter's API, with a named temp file
- QTemporaryFile file("tempXXXXXX");
+ QTemporaryFile file(writePrefix + QLatin1String("tempXXXXXX"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
QImageWriter writer(&file, "PNG");
QVERIFY(writer.write(image));
-#if defined(Q_OS_WINCE)
- file.reset();
-#endif
QCOMPARE(QImage(writer.fileName()), image);
}
{
// 4) Via QImage's API, with a named temp file
- QTemporaryFile file("tempXXXXXX");
+ QTemporaryFile file(writePrefix + QLatin1String("tempXXXXXX"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(image.save(&file, "PNG"));
file.reset();
diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro
index a04ad73b80..1de428a685 100644
--- a/tests/auto/gui/image/qmovie/qmovie.pro
+++ b/tests/auto/gui/image/qmovie/qmovie.pro
@@ -1,12 +1,13 @@
CONFIG += testcase
TARGET = tst_qmovie
QT += testlib
+QT_FOR_CONFIG += gui-private
qtHaveModule(widgets): QT += widgets
SOURCES += tst_qmovie.cpp
MOC_DIR=tmp
-!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
+qtConfig(gif): DEFINES += QTEST_HAVE_GIF
+qtConfig(jpeg): DEFINES += QTEST_HAVE_JPEG
RESOURCES += resources.qrc
TESTDATA += animations/*
diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro
index 5a4656998a..e6a020af1a 100644
--- a/tests/auto/gui/image/qpixmap/qpixmap.pro
+++ b/tests/auto/gui/image/qpixmap/qpixmap.pro
@@ -5,9 +5,7 @@ QT += core-private gui-private testlib
qtHaveModule(widgets): QT += widgets widgets-private
SOURCES += tst_qpixmap.cpp
-!wince:!winrt {
- win32:LIBS += -lgdi32 -luser32
-}
+win32:!winrt:LIBS += -lgdi32 -luser32
RESOURCES += qpixmap.qrc
TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/*
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 6adfe05fb0..79d3a57d73 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -442,22 +442,16 @@ void tst_QPixmap::fill_data()
QTest::newRow(("syscolor_" + QByteArray::number(color)).constData())
<< uint(color) << true << false;
-#if defined (Q_OS_WINCE)
- QPixmap pixmap(1,1);
- if (QApplication::desktop()->grab().depth() >= 24) {
-#else
- QPixmap pixmap(1, 1); {
-#endif
- QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false;
- QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false;
- QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false;
- QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false;
- QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false;
- QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false;
- QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false;
- QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false;
- QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false;
- }
+ QPixmap pixmap(1, 1);
+ QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false;
+ QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false;
+ QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false;
+ QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false;
+ QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false;
+ QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false;
+ QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false;
+ QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false;
+ QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false;
QTest::newRow("bitmap_color0") << uint(Qt::color0) << true << true;
QTest::newRow("bitmap_color1") << uint(Qt::color1) << true << true;
@@ -891,9 +885,6 @@ void tst_QPixmap::fromWinHBITMAP()
HGDIOBJ old_brush = SelectObject(bitmap_dc, CreateSolidBrush(RGB(red, green, blue)));
Rectangle(bitmap_dc, 0, 0, 100, 100);
-#ifdef Q_OS_WINCE //the device context has to be deleted before QPixmap::fromWinHBITMAP()
- DeleteDC(bitmap_dc);
-#endif
QPixmap pixmap = qt_pixmapFromWinHBITMAP(bitmap);
QCOMPARE(pixmap.width(), 100);
QCOMPARE(pixmap.height(), 100);
@@ -906,9 +897,7 @@ void tst_QPixmap::fromWinHBITMAP()
DeleteObject(SelectObject(bitmap_dc, old_brush));
DeleteObject(SelectObject(bitmap_dc, bitmap));
-#ifndef Q_OS_WINCE
DeleteDC(bitmap_dc);
-#endif
ReleaseDC(0, display_dc);
}
@@ -1010,7 +999,6 @@ void tst_QPixmap::fromWinHICON_data()
void tst_QPixmap::fromWinHICON()
{
-#ifndef Q_OS_WINCE
QFETCH(int, width);
QFETCH(int, height);
QFETCH(QString, image);
@@ -1028,7 +1016,6 @@ void tst_QPixmap::fromWinHICON()
// between QImage::Format_ARGB32 and QImage::Format_ARGB32_Premultiplied, or elsewhere
QVERIFY(compareImages(imageFromHICON, imageFromFile));
-#endif // Q_OS_WINCE
}
#endif // Q_OS_WIN && !Q_OS_WINRT
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 5000e1a926..631962ad34 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -25,7 +25,7 @@ SUBDIRS=\
qopenglwindow \
qrasterwindow
-win32:!wince:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
+win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
@@ -34,4 +34,6 @@ win32:!wince:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(network): SUBDIRS -= \
qguieventloop
-!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopenglwindow
+!qtConfig(opengl(es2)?): SUBDIRS -= qopenglwindow
+
+uikit: SUBDIRS -= qclipboard
diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
index a42b359f29..7e98704aea 100644
--- a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
+++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
@@ -5,4 +5,4 @@ QT += core-private network gui-private testlib
SOURCES += tst_noqteventloop.cpp
-contains(QT_CONFIG,dynamicgl):win32:!wince*:!winrt: LIBS += -luser32
+qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/gui/kernel/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp
index 22f2aa3bb8..32e91a9939 100644
--- a/tests/auto/gui/kernel/qclipboard/copier/main.cpp
+++ b/tests/auto/gui/kernel/qclipboard/copier/main.cpp
@@ -33,11 +33,9 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QString paste = QStringLiteral("testString.!");
-#ifndef Q_OS_WINCE
const QStringList arguments = app.arguments();
if (arguments.size() > 1)
paste = arguments.at(1);
-#endif
#ifndef QT_NO_CLIPBOARD
QGuiApplication::clipboard()->setText(paste);
#endif
diff --git a/tests/auto/gui/kernel/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp
index c96d903fb7..7fca8af1cb 100644
--- a/tests/auto/gui/kernel/qclipboard/paster/main.cpp
+++ b/tests/auto/gui/kernel/qclipboard/paster/main.cpp
@@ -66,13 +66,9 @@ int main(int argc, char **argv)
return 0;
}
-#ifndef Q_OS_WINCE
QString expected;
if (parser.isSet(textOption))
expected = parser.value(textOption);
-#else // !Q_OS_WINCE
- const QString expected = QStringLiteral("testString.!");
-#endif // Q_OS_WINCE
if (!expected.isEmpty()) {
#ifndef QT_NO_CLIPBOARD
const QString actual = QGuiApplication::clipboard()->text();
diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro
index 40bf9c8d8e..59b77b11ba 100644
--- a/tests/auto/gui/kernel/qclipboard/test/test.pro
+++ b/tests/auto/gui/kernel/qclipboard/test/test.pro
@@ -13,10 +13,6 @@ win32 {
}
}
-wince* {
- DEPLOYMENT += rsc reg_resource
-}
-
!winrt: TEST_HELPER_INSTALLS = \
../copier/copier \
../paster/paster
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index 6bad45fefe..b1ec94403a 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -73,8 +73,10 @@ void tst_QClipboard::cleanupTestCase()
void tst_QClipboard::init()
{
+#ifndef QT_NO_PROCESS
const QString testdataDir = QFileInfo(QFINDTESTDATA("copier")).absolutePath();
QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir));
+#endif
}
Q_DECLARE_METATYPE(QClipboard::Mode)
@@ -313,10 +315,6 @@ void tst_QClipboard::setMimeData()
QMimeData *mimeData = new QMimeData;
const QString TestName(QLatin1String("tst_QClipboard::setMimeData() mimeData"));
mimeData->setObjectName(TestName);
-#if defined(Q_OS_WINCE)
- // need to set text on CE
- mimeData->setText(QLatin1String("Qt/CE foo"));
-#endif
QGuiApplication::clipboard()->setMimeData(mimeData);
QCOMPARE(QGuiApplication::clipboard()->mimeData(), (const QMimeData *)mimeData);
diff --git a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
index 9d42ae5850..43b2b79698 100644
--- a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
+++ b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
@@ -26,6 +26,7 @@
**
****************************************************************************/
+#include <QtCore/QTemporaryDir>
#include <QtTest/QtTest>
#include <QtGui/qevent.h>
@@ -38,6 +39,7 @@ public:
public slots:
void initTestCase();
+ void cleanupTestCase();
private slots:
void constructor();
@@ -54,6 +56,9 @@ private:
bool appendFileContent(QFileOpenEvent& event, const QByteArray& writeContent);
bool event(QEvent *);
+
+ QTemporaryDir m_temporaryDir;
+ QString m_originalCurrent;
};
tst_qfileopenevent::~tst_qfileopenevent()
@@ -62,6 +67,13 @@ tst_qfileopenevent::~tst_qfileopenevent()
void tst_qfileopenevent::initTestCase()
{
+ m_originalCurrent = QDir::currentPath();
+ QDir::setCurrent(m_temporaryDir.path());
+}
+
+void tst_qfileopenevent::cleanupTestCase()
+{
+ QDir::setCurrent(m_originalCurrent);
}
void tst_qfileopenevent::createFile(const QString &filename, const QByteArray &content)
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 32d0aa504c..f8bcb14ab3 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -106,11 +106,29 @@ void tst_QGuiApplication::displayName()
int argc = 1;
char *argv[] = { const_cast<char*>("tst_qguiapplication") };
QGuiApplication app(argc, argv);
+ QSignalSpy spy(&app, &QGuiApplication::applicationDisplayNameChanged);
+
QCOMPARE(::qAppName(), QString::fromLatin1("tst_qguiapplication"));
QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("tst_qguiapplication"));
QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("tst_qguiapplication"));
+
+ QGuiApplication::setApplicationName("The Core Application");
+ QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("The Core Application"));
+ QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The Core Application"));
+ QCOMPARE(spy.count(), 1);
+
QGuiApplication::setApplicationDisplayName("The GUI Application");
QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application"));
+ QCOMPARE(spy.count(), 2);
+
+ QGuiApplication::setApplicationName("The Core Application 2");
+ QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("The Core Application 2"));
+ QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application"));
+ QCOMPARE(spy.count(), 2);
+
+ QGuiApplication::setApplicationDisplayName("The GUI Application 2");
+ QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application 2"));
+ QCOMPARE(spy.count(), 3);
}
void tst_QGuiApplication::desktopFileName()
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 8002303723..cca0e95c29 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -31,8 +31,6 @@
#include <QtGui>
#include <QtTest/QtTest>
-#include "../../../qtest-config.h"
-
Q_DECLARE_METATYPE(QMetaType::Type)
class tst_QGuiMetaType: public QObject
@@ -75,14 +73,14 @@ private slots:
F(QVector4D, QVector4D) \
F(QQuaternion, QQuaternion)
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
# define FOR_EACH_GUI_METATYPE(F) \
FOR_EACH_GUI_METATYPE_BASE(F) \
F(QCursor, QCursor)
-#else // !QTEST_NO_CURSOR
+#else // !QT_NO_CURSOR
# define FOR_EACH_GUI_METATYPE(F) \
FOR_EACH_GUI_METATYPE_BASE(F)
-#endif // !QTEST_NO_CURSOR
+#endif // !QT_NO_CURSOR
namespace {
@@ -131,7 +129,7 @@ template<> struct TypeComparator<QMetaType::QBitmap>
{ return v1.size() == v2.size(); }
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
template<> struct TypeComparator<QMetaType::QCursor>
{
static bool equal(const QCursor &v1, const QCursor &v2)
@@ -176,7 +174,7 @@ template<> struct TestValueFactory<QMetaType::QRegion> {
template<> struct TestValueFactory<QMetaType::QBitmap> {
static QBitmap *create() { return new QBitmap(16, 32); }
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
template<> struct TestValueFactory<QMetaType::QCursor> {
static QCursor *create() { return new QCursor(Qt::WaitCursor); }
};
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index 8be7227c54..a057ec2207 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -52,8 +52,6 @@
#include "tst_qvariant_common.h"
-#include "../../../../qtest-config.h"
-
class tst_QGuiVariant : public QObject
{
Q_OBJECT
@@ -172,7 +170,7 @@ void tst_QGuiVariant::canConvert_data()
var = QVariant::fromValue(QColor());
QTest::newRow("Color")
<< var << N << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N;
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
var = QVariant::fromValue(QCursor());
QTest::newRow("Cursor")
<< var << N << N << N << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N;
@@ -508,7 +506,7 @@ void tst_QGuiVariant::writeToReadFromDataStream_data()
QTest::newRow( "bitmap_valid" ) << QVariant::fromValue( bitmap ) << false;
QTest::newRow( "brush_valid" ) << QVariant::fromValue( QBrush( Qt::red ) ) << false;
QTest::newRow( "color_valid" ) << QVariant::fromValue( QColor( Qt::red ) ) << false;
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QTest::newRow( "cursor_valid" ) << QVariant::fromValue( QCursor( Qt::PointingHandCursor ) ) << false;
#endif
QTest::newRow( "font_valid" ) << QVariant::fromValue( QFont( "times", 12 ) ) << false;
@@ -716,14 +714,14 @@ void tst_QGuiVariant::implicitConstruction()
F(Quaternion) \
F(PolygonF)
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
# define FOR_EACH_GUI_CLASS(F) \
FOR_EACH_GUI_CLASS_BASE(F) \
F(Cursor)
-#else // !QTEST_NO_CURSOR
+#else // !QT_NO_CURSOR
# define FOR_EACH_GUI_CLASS(F) \
FOR_EACH_GUI_CLASS_BASE(F)
-#endif // QTEST_NO_CURSOR
+#endif // QT_NO_CURSOR
#define CONSTRUCT(TYPE) \
{ \
@@ -741,14 +739,14 @@ void tst_QGuiVariant::implicitConstruction()
void tst_QGuiVariant::guiVariantAtExit()
{
// crash test, it should not crash at QGuiApplication exit
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
static QVariant cursor = QCursor();
#endif
static QVariant point = QPoint();
static QVariant icon = QIcon();
static QVariant image = QImage();
static QVariant palette = QPalette();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
Q_UNUSED(cursor);
#endif
Q_UNUSED(point);
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 0d0b6ae81e..6394a956bd 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -725,7 +725,7 @@ void tst_QKeySequence::listFromString()
void tst_QKeySequence::translated_data()
{
-#if defined (Q_OS_MAC) || defined (Q_OS_WINCE)
+#if defined (Q_OS_DARWIN)
QSKIP("Test not applicable");
#endif
@@ -756,7 +756,7 @@ void tst_QKeySequence::translated_data()
void tst_QKeySequence::translated()
{
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QFETCH(QString, transKey);
QFETCH(QString, compKey);
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index 6af6738bdb..a1de205571 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -75,6 +75,7 @@ public slots:
void cleanupTestCase();
void init();
private slots:
+ void mouseEventBasic();
void checkMousePressEvent_data();
void checkMousePressEvent();
void checkMouseReleaseEvent_data();
@@ -107,6 +108,26 @@ void tst_QMouseEvent::init()
testMouseWidget->mouseReleaseModifiers = 0;
}
+void tst_QMouseEvent::mouseEventBasic()
+{
+ QPointF local(100, 100);
+ QPointF scene(200, 200);
+ QPointF screen(300, 300);
+ QMouseEvent me(QEvent::MouseButtonPress, local, scene, screen, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QCOMPARE(me.isAccepted(), true);
+ QCOMPARE(me.button(), Qt::LeftButton);
+ QCOMPARE(me.buttons(), Qt::LeftButton);
+ QCOMPARE(me.localPos(), local);
+ QCOMPARE(me.windowPos(), scene);
+ QCOMPARE(me.screenPos(), screen);
+
+ QPointF changedLocal(33, 66);
+ me.setLocalPos(changedLocal);
+ QCOMPARE(me.localPos(), changedLocal);
+ QCOMPARE(me.windowPos(), scene);
+ QCOMPARE(me.screenPos(), screen);
+}
+
void tst_QMouseEvent::checkMousePressEvent_data()
{
QTest::addColumn<int>("buttonPressed");
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index 74fd64bf59..e6fd67e3a8 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -213,11 +213,10 @@ private:
QTouchDevice *touchPadDevice;
};
-tst_QTouchEvent::tst_QTouchEvent() : touchScreenDevice(new QTouchDevice), touchPadDevice(new QTouchDevice)
+tst_QTouchEvent::tst_QTouchEvent()
+ : touchScreenDevice(QTest::createTouchDevice())
+ , touchPadDevice(QTest::createTouchDevice(QTouchDevice::TouchPad))
{
- touchPadDevice->setType(QTouchDevice::TouchPad);
- QWindowSystemInterface::registerTouchDevice(touchScreenDevice);
- QWindowSystemInterface::registerTouchDevice(touchPadDevice);
}
void tst_QTouchEvent::cleanup()
@@ -1490,10 +1489,6 @@ bool WindowTouchEventFilter::eventFilter(QObject *, QEvent *event)
void tst_QTouchEvent::testQGuiAppDelivery()
{
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
QWindow w;
w.setGeometry(100, 100, 100, 100);
w.show();
@@ -1521,38 +1516,33 @@ void tst_QTouchEvent::testQGuiAppDelivery()
QCOMPARE(filter.d.isEmpty(), true);
// Now the real thing.
- QWindowSystemInterface::handleTouchEvent(&w, device, points); // TouchBegin
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchBegin
QCoreApplication::processEvents();
QCOMPARE(filter.d.count(), 1);
- QCOMPARE(filter.d.contains(device), true);
- QCOMPARE(filter.d.value(device).points.count(), 1);
- QCOMPARE(filter.d.value(device).lastSeenType, QEvent::TouchBegin);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchBegin);
points[0].state = Qt::TouchPointMoved;
- QWindowSystemInterface::handleTouchEvent(&w, device, points); // TouchUpdate
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchUpdate
QCoreApplication::processEvents();
QCOMPARE(filter.d.count(), 1);
- QCOMPARE(filter.d.contains(device), true);
- QCOMPARE(filter.d.value(device).points.count(), 2);
- QCOMPARE(filter.d.value(device).lastSeenType, QEvent::TouchUpdate);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 2);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchUpdate);
points[0].state = Qt::TouchPointReleased;
- QWindowSystemInterface::handleTouchEvent(&w, device, points); // TouchEnd
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchEnd
QCoreApplication::processEvents();
QCOMPARE(filter.d.count(), 1);
- QCOMPARE(filter.d.contains(device), true);
- QCOMPARE(filter.d.value(device).points.count(), 3);
- QCOMPARE(filter.d.value(device).lastSeenType, QEvent::TouchEnd);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 3);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchEnd);
}
void tst_QTouchEvent::testMultiDevice()
{
- QTouchDevice *deviceOne = new QTouchDevice;
- deviceOne->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(deviceOne);
- QTouchDevice *deviceTwo = new QTouchDevice;
- deviceTwo->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(deviceTwo);
+ QTouchDevice *deviceTwo = QTest::createTouchDevice();
QWindow w;
w.setGeometry(100, 100, 100, 100);
@@ -1564,7 +1554,7 @@ void tst_QTouchEvent::testMultiDevice()
QList<QWindowSystemInterface::TouchPoint> pointsOne, pointsTwo;
- // deviceOne reports a single point, deviceTwo reports the beginning of a multi-point sequence.
+ // touchScreenDevice reports a single point, deviceTwo reports the beginning of a multi-point sequence.
// Even though there is a point with id 0 for both devices, they should be delivered cleanly, independently.
QWindowSystemInterface::TouchPoint tp;
tp.id = 0;
@@ -1580,20 +1570,20 @@ void tst_QTouchEvent::testMultiDevice()
tp.area = QHighDpi::toNative(area1, QHighDpiScaling::factor(&w), screenOrigin);
pointsTwo.append(tp);
- QWindowSystemInterface::handleTouchEvent(&w, deviceOne, pointsOne);
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, pointsOne);
QWindowSystemInterface::handleTouchEvent(&w, deviceTwo, pointsTwo);
QCoreApplication::processEvents();
- QCOMPARE(filter.d.contains(deviceOne), true);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
QCOMPARE(filter.d.contains(deviceTwo), true);
- QCOMPARE(filter.d.value(deviceOne).lastSeenType, QEvent::TouchBegin);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchBegin);
QCOMPARE(filter.d.value(deviceTwo).lastSeenType, QEvent::TouchBegin);
- QCOMPARE(filter.d.value(deviceOne).points.count(), 1);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1);
QCOMPARE(filter.d.value(deviceTwo).points.count(), 2);
- QCOMPARE(filter.d.value(deviceOne).points.at(0).screenRect(), QRectF(area0));
- QCOMPARE(filter.d.value(deviceOne).points.at(0).state(), pointsOne[0].state);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).screenRect(), QRectF(area0));
+ QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).state(), pointsOne[0].state);
QCOMPARE(filter.d.value(deviceTwo).points.at(0).screenRect(), QRectF(area0));
QCOMPARE(filter.d.value(deviceTwo).points.at(0).state(), pointsTwo[0].state);
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index 93b7310d10..19d9262bca 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -1,13 +1,17 @@
[positioning:default]
ubuntu-14.04
+ubuntu-16.04
[modalWindowPosition]
ubuntu-14.04
+ubuntu-16.04
[modalWithChildWindow]
ubuntu-14.04
+ubuntu-16.04
[setVisible]
ubuntu-14.04
[modalWindowEnterEventOnHide_QTBUG35109]
ubuntu-14.04
+ubuntu-16.04
[modalDialogClosingOneOfTwoModal]
osx
[modalWindowModallity]
diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro
index 08e1b1d3a0..844b3e8507 100644
--- a/tests/auto/gui/kernel/qwindow/qwindow.pro
+++ b/tests/auto/gui/kernel/qwindow/qwindow.pro
@@ -5,4 +5,4 @@ QT += core-private gui-private testlib
SOURCES += tst_qwindow.cpp
-contains(QT_CONFIG,dynamicgl):win32:!wince:!winrt: LIBS += -luser32
+qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 70446e803a..a41c574454 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -40,7 +40,7 @@
#if defined(Q_OS_QNX)
#include <QOpenGLContext>
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
# include <QtCore/qt_windows.h>
#endif
@@ -106,7 +106,7 @@ private slots:
private:
QPoint m_availableTopLeft;
QSize m_testWindowSize;
- QTouchDevice *touchDevice;
+ QTouchDevice *touchDevice = QTest::createTouchDevice();
};
void tst_QWindow::initTestCase()
@@ -120,9 +120,6 @@ void tst_QWindow::initTestCase()
if (screenWidth > 2000)
width = 100 * ((screenWidth + 500) / 1000);
m_testWindowSize = QSize(width, width);
- touchDevice = new QTouchDevice;
- touchDevice->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(touchDevice);
}
void tst_QWindow::cleanup()
@@ -2098,7 +2095,7 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109()
static bool isNativeWindowVisible(const QWindow *window)
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
return IsWindowVisible(reinterpret_cast<HWND>(window->winId()));
#else
Q_UNIMPLEMENTED();
diff --git a/tests/auto/gui/painting/painting.pro b/tests/auto/gui/painting/painting.pro
index 0f7595c871..831fffab30 100644
--- a/tests/auto/gui/painting/painting.pro
+++ b/tests/auto/gui/painting/painting.pro
@@ -16,7 +16,7 @@ SUBDIRS=\
qwmatrix \
qpolygon \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qpathclipper \
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 00e7436c0f..ab893385e3 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -52,6 +52,7 @@ private slots:
void name();
void namehex_data();
void namehex();
+ void setNamedColor_data();
void setNamedColor();
void constructNamedColorWithSpace();
@@ -525,26 +526,49 @@ static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
#undef rgb
-void tst_QColor::setNamedColor()
+void tst_QColor::setNamedColor_data()
{
- for (int i = 0; i < rgbTblSize; ++i) {
- QColor expected;
- expected.setRgba(rgbTbl[i].value);
-
- QColor color;
- color.setNamedColor(QLatin1String(rgbTbl[i].name));
- QCOMPARE(color, expected);
+ QTest::addColumn<QColor>("byCtor");
+ QTest::addColumn<QColor>("bySetNamedColor");
+ QTest::addColumn<QColor>("expected");
+ for (const auto e : rgbTbl) {
+ QColor expected;
+ expected.setRgba(e.value);
+
+#define ROW(expr) \
+ do { \
+ QColor bySetNamedColor; \
+ bySetNamedColor.setNamedColor(expr); \
+ auto byCtor = QColor(expr); \
+ QTest::newRow(e.name + QByteArrayLiteral(#expr)) \
+ << byCtor << bySetNamedColor << expected; \
+ } while (0) \
+ /*end*/
+
+ ROW(QLatin1String(e.name));
+ ROW(QString(QLatin1String(e.name)));
// name should be case insensitive
- color.setNamedColor(QString(rgbTbl[i].name).toUpper());
- QCOMPARE(color, expected);
-
+ ROW(QLatin1String(QByteArray(e.name).toUpper()));
+ ROW(QString(e.name).toUpper());
// spaces should be ignored
- color.setNamedColor(QString(rgbTbl[i].name).insert(1, ' '));
- QCOMPARE(color, expected);
+ ROW(QLatin1String(QByteArray(e.name).insert(1, ' ')));
+ ROW(QString(e.name).insert(1, ' '));
+#undef ROW
}
}
+void tst_QColor::setNamedColor()
+{
+ QFETCH(QColor, byCtor);
+ QFETCH(QColor, bySetNamedColor);
+ QFETCH(QColor, expected);
+
+ QCOMPARE(byCtor, expected);
+ QCOMPARE(bySetNamedColor, expected);
+}
+
+
void tst_QColor::constructNamedColorWithSpace()
{
QColor whiteSmoke("white smoke");
@@ -556,7 +580,7 @@ void tst_QColor::colorNames()
QStringList all = QColor::colorNames();
QCOMPARE(all.size(), rgbTblSize);
for (int i = 0; i < all.size(); ++i)
- QCOMPARE(all.at(i), QString::fromLatin1(rgbTbl[i].name));
+ QCOMPARE(all.at(i), QLatin1String(rgbTbl[i].name));
}
void tst_QColor::spec()
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 8a97a9261f..1bd7f67810 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -39,9 +39,7 @@
#include <qimage.h>
#include <qthread.h>
#include <limits.h>
-#if !defined(Q_OS_WINCE)
#include <math.h>
-#endif
#include <qpaintengine.h>
#ifndef QT_NO_WIDGETS
#include <qdesktopwidget.h>
@@ -297,6 +295,9 @@ private slots:
void QTBUG50153_drawImage_assert();
+ void rotateImage_data();
+ void rotateImage();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5061,6 +5062,64 @@ void tst_QPainter::QTBUG50153_drawImage_assert()
}
}
+void tst_QPainter::rotateImage_data()
+{
+ QTest::addColumn<QImage>("image");
+ QTest::addColumn<bool>("smooth");
+
+ QImage image(128, 128, QImage::Format_RGB32);
+ for (int y = 0; y < 128; ++y) {
+ for (int x = 0; x < 128; ++x) {
+ image.setPixel(x, y, qRgb(x + y, x + y, x + y));
+ }
+ }
+
+ QTest::newRow("fast") << image << false;
+ QTest::newRow("smooth") << image << true;
+}
+
+void tst_QPainter::rotateImage()
+{
+ QFETCH(QImage, image);
+ QFETCH(bool, smooth);
+
+ QImage dest(184, 184, QImage::Format_ARGB32_Premultiplied);
+ dest.fill(Qt::transparent);
+
+ QPainter painter(&dest);
+ QTransform transform;
+ transform.translate(92, 0);
+ transform.rotate(45);
+ painter.setTransform(transform);
+ painter.setRenderHint(QPainter::SmoothPixmapTransform, smooth);
+ painter.drawImage(0, 0, image);
+ painter.end();
+
+ QRgb lastRow = qRgba(0, 0, 0, 0);
+ for (int y = 0; y < 184; ++y) {
+ QRgb row = qRgba(0, 0, 0, 0);
+ for (int x = 0; x < 184; ++x) {
+ QRgb pixel = dest.pixel(x, y);
+ if (qAlpha(pixel) < 255)
+ continue;
+ if (qAlpha(row) == 0) {
+ row = pixel;
+ } else {
+ QCOMPARE(qRed(pixel), qGreen(pixel));
+ QCOMPARE(qGreen(pixel), qBlue(pixel));
+ QVERIFY(qAbs(qRed(row) - qRed(pixel)) <= 2);
+ QVERIFY(qAbs(qGreen(row) - qGreen(pixel)) <= 2);
+ QVERIFY(qAbs(qBlue(row) - qBlue(pixel)) <= 2);
+ }
+
+ }
+ if (qAlpha(row) && qAlpha(lastRow))
+ QVERIFY(qGray(lastRow) <= qGray(row));
+ lastRow = row;
+ }
+
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index 0261f60479..98f63984b3 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -840,22 +840,23 @@ void tst_QPainterPath::testArcMoveTo_data()
QTest::addColumn<QRectF>("rect");
QTest::addColumn<qreal>("angle");
- QList<QRectF> rects;
- rects << QRectF(100, 100, 100, 100)
- << QRectF(100, 100, -100, 100)
- << QRectF(100, 100, 100, -100)
- << QRectF(100, 100, -100, -100);
-
- for (int domain=0; domain<rects.size(); ++domain) {
+ static Q_CONSTEXPR QRectF rects[] = {
+ QRectF(100, 100, 100, 100),
+ QRectF(100, 100, -100, 100),
+ QRectF(100, 100, 100, -100),
+ QRectF(100, 100, -100, -100),
+ };
+
+ for (uint domain = 0; domain < sizeof rects / sizeof *rects; ++domain) {
const QByteArray dB = QByteArray::number(domain);
for (int i=-360; i<=360; ++i) {
QTest::newRow(("test " + dB + ' ' + QByteArray::number(i)).constData())
- << rects.at(domain) << (qreal) i;
+ << rects[domain] << (qreal) i;
}
// test low angles
- QTest::newRow("low angles 1") << rects.at(domain) << (qreal) 1e-10;
- QTest::newRow("low angles 2") << rects.at(domain) << (qreal)-1e-10;
+ QTest::newRow("low angles 1") << rects[domain] << (qreal) 1e-10;
+ QTest::newRow("low angles 2") << rects[domain] << (qreal)-1e-10;
}
}
diff --git a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
index e153460bf2..671220f94b 100644
--- a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
+++ b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
@@ -5,6 +5,6 @@ HEADERS += paths.h
SOURCES += tst_qpathclipper.cpp paths.cpp
QT += gui-private testlib
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
index 4d6f52bf8a..13b6e28f5f 100644
--- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
+++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
@@ -43,6 +43,10 @@ public:
tst_QPolygon();
private slots:
+ void boundingRect_data();
+ void boundingRect();
+ void boundingRectF_data();
+ void boundingRectF();
void makeEllipse();
void swap();
};
@@ -51,6 +55,79 @@ tst_QPolygon::tst_QPolygon()
{
}
+void tst_QPolygon::boundingRect_data()
+{
+ QTest::addColumn<QPolygon>("poly");
+ QTest::addColumn<QRect>("brect");
+
+#define ROW(args, rect) \
+ do { \
+ QPolygon poly; \
+ poly.setPoints args; \
+ QTest::newRow(#args) << poly << QRect rect; \
+ } while (0)
+
+ QTest::newRow("empty") << QPolygon() << QRect(0, 0, 0, 0);
+ ROW((1, 0,1), ( 0, 1, 1, 1));
+ ROW((2, 0,1, 1,0), ( 0, 0, 2, 2));
+ ROW((3, -1,1, -1,-1, 1,0), (-1,-1, 3, 3));
+#undef ROW
+}
+
+void tst_QPolygon::boundingRect()
+{
+ QFETCH(QPolygon, poly);
+ QFETCH(QRect, brect);
+
+ QCOMPARE(poly.boundingRect(), brect);
+}
+
+namespace {
+struct MyPolygonF : QPolygonF
+{
+ // QPolygonF doesn't have setPoints...
+ void setPoints(int nPoints, int firstx, int firsty, ...) {
+ va_list ap;
+ reserve(nPoints);
+ *this << QPointF(firstx, firsty);
+ va_start(ap, firsty);
+ while (--nPoints) {
+ const int x = va_arg(ap, int);
+ const int y = va_arg(ap, int);
+ *this << QPointF(x, y);
+ }
+ va_end(ap);
+ }
+};
+}
+
+void tst_QPolygon::boundingRectF_data()
+{
+ QTest::addColumn<QPolygonF>("poly");
+ QTest::addColumn<QRectF>("brect");
+
+#define ROW(args, rect) \
+ do { \
+ MyPolygonF poly; \
+ poly.setPoints args; \
+ QTest::newRow(#args) << QPolygonF(poly) << QRectF rect; \
+ } while (0)
+
+ QTest::newRow("empty") << QPolygonF() << QRectF(0, 0, 0, 0);
+ ROW((1, 0,1), ( 0, 1, 0, 0));
+ ROW((2, 0,1, 1,0), ( 0, 0, 1, 1));
+ ROW((3, -1,1, -1,-1, 1,0), (-1,-1, 2, 2));
+#undef ROW
+}
+
+void tst_QPolygon::boundingRectF()
+{
+ QFETCH(QPolygonF, poly);
+ QFETCH(QRectF, brect);
+
+ QCOMPARE(poly.boundingRect(), brect);
+}
+
void tst_QPolygon::makeEllipse()
{
// create an ellipse with R1 = R2 = R, i.e. a circle
diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp
index d24435198e..6a297dbfc2 100644
--- a/tests/auto/gui/painting/qregion/tst_qregion.cpp
+++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp
@@ -47,6 +47,7 @@ public:
private slots:
void moveSemantics();
void boundingRect();
+ void rangeFor();
void rects();
void swap();
void setRects();
@@ -136,17 +137,34 @@ void tst_QRegion::boundingRect()
}
+void tst_QRegion::rangeFor()
+{
+ // compile-only test for range-for over QRegion, so really useless
+ // content otherwise:
+ QRect rect(10, -20, 30, 40);
+ QRegion region(rect);
+ int equal = 0;
+ for (const QRect &r : region) // check this compiles
+ equal += int(r == rect); // can't use QCOMPARE here b/c of the
+ // MSVC 201272013 parse bug re:
+ // do-while in range-for loops
+ QCOMPARE(equal, 1);
+}
+
void tst_QRegion::rects()
{
{
QRect rect;
QRegion region(rect);
QVERIFY(region.isEmpty());
+ QCOMPARE(region.begin(), region.end());
QVERIFY(region.rects().isEmpty());
}
{
QRect rect(10, -20, 30, 40);
QRegion region(rect);
+ QCOMPARE(region.end(), region.begin() + 1);
+ QCOMPARE(*region.begin(), rect);
QCOMPARE(region.rects().count(), 1);
QCOMPARE(region.rects()[0], rect);
}
@@ -192,6 +210,7 @@ void tst_QRegion::setRects()
region.setRects(&rect, 0);
QVERIFY(region.isEmpty());
QCOMPARE(region, QRegion());
+ QCOMPARE(region.begin(), region.end());
QVERIFY(!region.boundingRect().isValid());
QVERIFY(region.rects().isEmpty());
}
@@ -199,6 +218,7 @@ void tst_QRegion::setRects()
QRegion region;
QRect rect;
region.setRects(&rect, 1);
+ QCOMPARE(region.begin(), region.end());
QVERIFY(!region.boundingRect().isValid());
QVERIFY(region.rects().isEmpty());
}
@@ -206,8 +226,10 @@ void tst_QRegion::setRects()
QRegion region;
QRect rect(10, -20, 30, 40);
region.setRects(&rect, 1);
+ QCOMPARE(region.end(), region.begin() + 1);
QCOMPARE(region.rects().count(), 1);
QCOMPARE(region.rects()[0], rect);
+ QCOMPARE(*region.begin(), rect);
}
}
@@ -320,8 +342,12 @@ void tst_QRegion::emptyPolygonRegion()
QRegion r(pa);
QTEST(r.isEmpty(), "isEmpty");
+ QTEST(int(std::distance(r.begin(), r.end())), "numRects");
+ QVector<QRect> rects;
+ std::copy(r.begin(), r.end(), std::back_inserter(rects));
QTEST(r.rects().count(), "numRects");
QTEST(r.rects(), "rects");
+ QCOMPARE(r.rects(), rects);
}
@@ -860,6 +886,7 @@ void tst_QRegion::isEmpty()
QFETCH(QRegion, region);
QVERIFY(region.isEmpty());
+ QCOMPARE(region.begin(), region.end());
QCOMPARE(region, QRegion());
QCOMPARE(region.rectCount(), 0);
QCOMPARE(region.boundingRect(), QRect());
@@ -892,6 +919,11 @@ void tst_QRegion::regionFromPath()
path.addRect(0, 100, 100, 1000);
QRegion rgn(path.toFillPolygon().toPolygon());
+
+ QCOMPARE(rgn.end(), rgn.begin() + 2);
+ QCOMPARE(rgn.begin()[0], QRect(0, 0, 10, 10));
+ QCOMPARE(rgn.begin()[1], QRect(0, 100, 100, 1000));
+
QCOMPARE(rgn.rects().size(), 2);
QCOMPARE(rgn.rects().at(0), QRect(0, 0, 10, 10));
QCOMPARE(rgn.rects().at(1), QRect(0, 100, 100, 1000));
@@ -905,8 +937,14 @@ void tst_QRegion::regionFromPath()
path.addRect(10, 10, 80, 80);
QRegion rgn(path.toFillPolygon().toPolygon());
- QCOMPARE(rgn.rects().size(), 4);
+ QCOMPARE(rgn.end(), rgn.begin() + 4);
+ QCOMPARE(rgn.begin()[0], QRect(0, 0, 100, 10));
+ QCOMPARE(rgn.begin()[1], QRect(0, 10, 10, 80));
+ QCOMPARE(rgn.begin()[2], QRect(90, 10, 10, 80));
+ QCOMPARE(rgn.begin()[3], QRect(0, 90, 100, 10));
+
+ QCOMPARE(rgn.rects().size(), 4);
QCOMPARE(rgn.rects().at(0), QRect(0, 0, 100, 10));
QCOMPARE(rgn.rects().at(1), QRect(0, 10, 10, 80));
QCOMPARE(rgn.rects().at(2), QRect(90, 10, 10, 80));
diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
index e05d7dd022..a79526c434 100644
--- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
+++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
@@ -114,7 +114,7 @@ void tst_QWMatrix::mapping_data()
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -300, -400, 300, 400 ) );
-#if (defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(M_PI)
+#if defined(Q_OS_WIN) && !defined(M_PI)
#define M_PI 3.14159265897932384626433832795f
#endif
diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro
index a4ef016e39..aaef6e5125 100644
--- a/tests/auto/gui/qopengl/qopengl.pro
+++ b/tests/auto/gui/qopengl/qopengl.pro
@@ -8,4 +8,4 @@ QT += gui-private core-private testlib
SOURCES += tst_qopengl.cpp
-linux:contains(QT_CONFIG, xcb-glx):contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, egl): DEFINES += USE_GLX
+linux:qtConfig(xcb-glx):qtConfig(xcb-xlib):!qtConfig(egl): DEFINES += USE_GLX
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index 15244744bf..ed48a4978a 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -41,7 +41,7 @@
#include <QtGui/QOffscreenSurface>
#include <QtGui/QGenericMatrix>
#include <QtGui/QMatrix4x4>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/qopengltextureblitter.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qopenglextensions_p.h>
#include <qpa/qplatformintegration.h>
diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
index d3404e335a..be3ef968ef 100644
--- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
+++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
@@ -48,6 +48,8 @@ private slots:
void getSetCheck();
void maximumBlockCount();
void anchorAt();
+ void imageAt();
+ void formatAt();
};
tst_QAbstractTextDocumentLayout::tst_QAbstractTextDocumentLayout()
@@ -156,7 +158,7 @@ void tst_QAbstractTextDocumentLayout::anchorAt()
// anchorAt on start returns link
QRect linkBr = metrics.boundingRect("foo");
- QPointF linkPoint(linkBr.width() + blockStart.x(), (linkBr.height() / 2) + blockStart.y());
+ QPointF linkPoint((linkBr.width() / 2) + blockStart.x(), (linkBr.height() / 2) + blockStart.y());
QCOMPARE(documentLayout->anchorAt(linkPoint), QString("link"));
// anchorAt() on top of preedit at end should not assert
@@ -171,5 +173,61 @@ void tst_QAbstractTextDocumentLayout::anchorAt()
QCOMPARE(documentLayout->anchorAt(preeditPoint), QString());
}
+void tst_QAbstractTextDocumentLayout::imageAt()
+{
+ QTextDocument doc;
+ doc.setHtml("foo<a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a>");
+ QAbstractTextDocumentLayout *documentLayout = doc.documentLayout();
+ QTextBlock firstBlock = doc.begin();
+ QTextLayout *layout = firstBlock.layout();
+ layout->setPreeditArea(doc.toPlainText().length(), "xxx");
+
+ doc.setPageSize(QSizeF(1000, 1000));
+ QFontMetrics metrics(layout->font());
+ QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft();
+
+ QRect fooBr = metrics.boundingRect("foo");
+ QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25);
+ // imageAt on image returns source
+ QCOMPARE(documentLayout->imageAt(imagePoint), QString("image"));
+ // anchorAt on image returns link
+ QCOMPARE(documentLayout->anchorAt(imagePoint), QString("link"));
+
+ // imageAt on start returns nothing (there's the "foo" text)
+ QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y());
+ QCOMPARE(documentLayout->imageAt(fooPoint), QString());
+}
+
+void tst_QAbstractTextDocumentLayout::formatAt()
+{
+ QTextDocument doc;
+ doc.setHtml("foo<i><a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a></i>");
+ QAbstractTextDocumentLayout *documentLayout = doc.documentLayout();
+ QTextBlock firstBlock = doc.begin();
+ QTextLayout *layout = firstBlock.layout();
+ layout->setPreeditArea(doc.toPlainText().length(), "xxx");
+
+ doc.setPageSize(QSizeF(1000, 1000));
+ QFontMetrics metrics(layout->font());
+ QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft();
+
+ QRect fooBr = metrics.boundingRect("foo");
+ QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25);
+
+ QTextFormat format = documentLayout->formatAt(imagePoint);
+ QVERIFY(format.isCharFormat());
+ QVERIFY(format.toCharFormat().isAnchor());
+ QVERIFY(format.toCharFormat().fontItalic());
+ QVERIFY(format.isImageFormat());
+
+ // move over the unformatted "foo" text)
+ QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y());
+ format = documentLayout->formatAt(fooPoint);
+ QVERIFY(format.isCharFormat());
+ QVERIFY(!format.toCharFormat().isAnchor());
+ QVERIFY(!format.toCharFormat().fontItalic());
+ QVERIFY(!format.isImageFormat());
+}
+
QTEST_MAIN(tst_QAbstractTextDocumentLayout)
#include "tst_qabstracttextdocumentlayout.moc"
diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro
index 88d1fcfd2d..776b4b3de2 100644
--- a/tests/auto/gui/text/qcssparser/qcssparser.pro
+++ b/tests/auto/gui/text/qcssparser/qcssparser.pro
@@ -3,16 +3,10 @@ TARGET = tst_qcssparser
SOURCES += tst_qcssparser.cpp
QT += xml gui-private testlib
-requires(contains(QT_CONFIG,private_tests))
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+TESTDATA += testdata
-wince* {
- addFiles.files = testdata
- addFiles.path = .
- timesFont.files = C:/Windows/Fonts/times.ttf
- timesFont.path = .
- DEPLOYMENT += addFiles timesFont
-}
+requires(qtConfig(private_tests))
+DEFINES += SRCDIR=\\\"$$PWD\\\"
android {
RESOURCES += \
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 847d6e2e2f..45cfd6f43a 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -27,9 +27,6 @@
****************************************************************************/
#include <QtTest/QtTest>
#include <QtXml/QtXml>
-#if defined(Q_OS_WINCE)
-#include <QtGui/QFontDatabase>
-#endif
#include <QtGui/QFontInfo>
#include <QtGui/QFontMetrics>
@@ -39,10 +36,6 @@ class tst_QCssParser : public QObject
{
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
private slots:
void scanner_data();
void scanner();
@@ -85,41 +78,16 @@ private slots:
void extractBorder();
void noTextDecoration();
void quotedAndUnquotedIdentifiers();
-
-private:
-#if defined(Q_OS_WINCE)
- int m_timesFontId;
-#endif
};
-void tst_QCssParser::initTestCase()
-{
-#if defined(Q_OS_WINCE)
- QFontDatabase fontDB;
- m_timesFontId = -1;
- if (!fontDB.families().contains("Times New Roman")) {
- m_timesFontId = QFontDatabase::addApplicationFont("times.ttf");
- QVERIFY(m_timesFontId != -1);
- }
-#endif
-}
-
-void tst_QCssParser::cleanupTestCase()
-{
-#if defined(Q_OS_WINCE)
- if (m_timesFontId != -1)
- QFontDatabase::removeApplicationFont(m_timesFontId);
-#endif
-}
-
void tst_QCssParser::scanner_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) || defined(Q_OS_WINRT)
QDir d(":/");
-#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
+#elif !defined(Q_OS_IRIX)
QDir d(SRCDIR);
#else
QDir d(QDir::current());
@@ -145,10 +113,14 @@ static const char *tokenName(QCss::TokenType t)
case QCss::CDC: return "CDC";
case QCss::INCLUDES: return "INCLUDES";
case QCss::DASHMATCH: return "DASHMATCH";
+ case QCss::BEGINSWITH: return "BEGINSWITH";
+ case QCss::ENDSWITH: return "ENDSWITH";
+ case QCss::CONTAINS: return "CONTAINS";
case QCss::LBRACE: return "LBRACE";
case QCss::PLUS: return "PLUS";
case QCss::GREATER: return "GREATER";
case QCss::COMMA: return "COMMA";
+ case QCss::TILDE: return "TILDE";
case QCss::STRING: return "STRING";
case QCss::INVALID: return "INVALID";
case QCss::IDENT: return "IDENT";
@@ -509,7 +481,7 @@ void tst_QCssParser::selector_data()
QCss::BasicSelector basic;
basic.elementName = "p";
- basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfPreceeds;
+ basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfDirectAdjecent;
sel.basicSelectors << basic;
basic = QCss::BasicSelector();
@@ -601,14 +573,29 @@ void tst_QCssParser::selector_data()
QCss::BasicSelector basic;
basic.elementName = "e";
- basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfPreceeds;
+ basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfDirectAdjecent;
sel.basicSelectors << basic;
basic.elementName = "f";
basic.relationToNext = QCss::BasicSelector::NoRelation;
sel.basicSelectors << basic;
- QTest::newRow("precede") << QString("e + f") << sel;
+ QTest::newRow("lastsibling") << QString("e + f") << sel;
+ }
+
+ {
+ QCss::Selector sel;
+ QCss::BasicSelector basic;
+
+ basic.elementName = "e";
+ basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfIndirectAdjecent;
+ sel.basicSelectors << basic;
+
+ basic.elementName = "f";
+ basic.relationToNext = QCss::BasicSelector::NoRelation;
+ sel.basicSelectors << basic;
+
+ QTest::newRow("previoussibling") << QString("e ~ f") << sel;
}
{
@@ -647,11 +634,11 @@ void tst_QCssParser::selector_data()
QCss::AttributeSelector attrSel;
attrSel.name = "foo";
attrSel.value = "warning";
- attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchContains;
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchIncludes;
basic.attributeSelectors << attrSel;
sel.basicSelectors << basic;
- QTest::newRow("attr-contains") << QString("e[foo~=\"warning\"]") << sel;
+ QTest::newRow("attr-includes") << QString("e[foo~=\"warning\"]") << sel;
}
{
@@ -662,11 +649,26 @@ void tst_QCssParser::selector_data()
QCss::AttributeSelector attrSel;
attrSel.name = "lang";
attrSel.value = "en";
- attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchBeginsWith;
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchDashMatch;
+ basic.attributeSelectors << attrSel;
+ sel.basicSelectors << basic;
+
+ QTest::newRow("attr-dash") << QString("e[lang|=\"en\"]") << sel;
+ }
+
+ {
+ QCss::Selector sel;
+ QCss::BasicSelector basic;
+
+ basic.elementName = "e";
+ QCss::AttributeSelector attrSel;
+ attrSel.name = "foo";
+ attrSel.value = "warning";
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchContains;
basic.attributeSelectors << attrSel;
sel.basicSelectors << basic;
- QTest::newRow("attr-contains") << QString("e[lang|=\"en\"]") << sel;
+ QTest::newRow("attr-contains") << QString("e[foo*=\"warning\"]") << sel;
}
{
@@ -677,7 +679,7 @@ void tst_QCssParser::selector_data()
QCss::AttributeSelector attrSel;
attrSel.name = "class";
- attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchContains;
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchIncludes;
attrSel.value = "warning";
basic.attributeSelectors.append(attrSel);
@@ -999,11 +1001,20 @@ void tst_QCssParser::styleSelector_data()
QTest::newRow("attrmatch") << true << QString("[foo=bar]") << QString("<p foo=\"bar\" />") << QString();
QTest::newRow("noattrmatch") << false << QString("[foo=bar]") << QString("<p foo=\"xyz\" />") << QString();
- QTest::newRow("contains") << true << QString("[foo~=bar]") << QString("<p foo=\"baz bleh bar\" />") << QString();
- QTest::newRow("notcontains") << false << QString("[foo~=bar]") << QString("<p foo=\"test\" />") << QString();
+ QTest::newRow("includes") << true << QString("[foo~=bar]") << QString("<p foo=\"baz bleh bar\" />") << QString();
+ QTest::newRow("notincludes") << false << QString("[foo~=bar]") << QString("<p foo=\"bazblehbar\" />") << QString();
- QTest::newRow("beingswith") << true << QString("[foo|=bar]") << QString("<p foo=\"bar-bleh\" />") << QString();
- QTest::newRow("notbeingswith") << false << QString("[foo|=bar]") << QString("<p foo=\"bleh-bar\" />") << QString();
+ QTest::newRow("dashmatch") << true << QString("[foo|=bar]") << QString("<p foo=\"bar-bleh\" />") << QString();
+ QTest::newRow("nodashmatch") << false << QString("[foo|=bar]") << QString("<p foo=\"barbleh\" />") << QString();
+
+ QTest::newRow("beginswith") << true << QString("[foo^=bar]") << QString("<p foo=\"barbleh\" />") << QString();
+ QTest::newRow("nobeginswith") << false << QString("[foo^=bar]") << QString("<p foo=\"blehbleh\" />") << QString();
+
+ QTest::newRow("endswith") << true << QString("[foo$=bar]") << QString("<p foo=\"barbar\" />") << QString();
+ QTest::newRow("noendswith") << false << QString("[foo$=bar]") << QString("<p foo=\"blehbleh\" />") << QString();
+
+ QTest::newRow("contains") << true << QString("[foo*=bar]") << QString("<p foo=\"blehbarbleh\" />") << QString();
+ QTest::newRow("nocontains") << false << QString("[foo*=bar]") << QString("<p foo=\"blehbleh\" />") << QString();
QTest::newRow("attr2") << true << QString("[bar=foo]") << QString("<p bleh=\"bar\" bar=\"foo\" />") << QString();
@@ -1084,10 +1095,19 @@ void tst_QCssParser::styleSelector_data()
<< QString("<p1 /><p2 />")
<< QString("p2");
- QTest::newRow("noprevioussibling") << false << QString("p2 + p1")
+ QTest::newRow("notprevioussibling") << false << QString("p2 + p1")
<< QString("<p1 /><p2 />")
<< QString("p2");
+ QTest::newRow("anyprevioussibling") << true << QString("p1 ~ p3")
+ << QString("<p1 /><p2 /><p3 />")
+ << QString("p3");
+
+ QTest::newRow("noprevioussibling") << false << QString("p3 ~ p2")
+ << QString("<p1 /><p2 /><p3 />")
+ << QString("p3");
+
+
QTest::newRow("ancestry_firstmismatch") << false << QString("parent child[foo=bar]")
<< QString("<parent><child /></parent>")
<< QString("parent/child");
diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST
index d859dee03e..8890ec1ef3 100644
--- a/tests/auto/gui/text/qfont/BLACKLIST
+++ b/tests/auto/gui/text/qfont/BLACKLIST
@@ -1,2 +1,4 @@
[exactMatch]
+# QTBUG-46054
opensuse-13.1
+opensuse-42.1
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index d8a6afb804..ca984a26a5 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -62,6 +62,7 @@ private slots:
void styleName();
void defaultFamily_data();
void defaultFamily();
+ void toAndFromString();
void sharing();
};
@@ -508,11 +509,11 @@ void tst_QFont::defaultFamily_data()
QTest::addColumn<QFont::StyleHint>("styleHint");
QTest::addColumn<QStringList>("acceptableFamilies");
- QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif"));
- QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace"));
- QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive"));
- QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy"));
- QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif"));
+ QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif").split(","));
+ QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(","));
+ QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive").split(","));
+ QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy").split(","));
+ QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif").split(","));
}
void tst_QFont::defaultFamily()
@@ -539,6 +540,26 @@ void tst_QFont::defaultFamily()
QVERIFY2(isAcceptable, msgNotAcceptableFont(familyForHint, acceptableFamilies));
}
+void tst_QFont::toAndFromString()
+{
+ QFont defaultFont = QGuiApplication::font();
+ QString family = defaultFont.family();
+
+ QFontDatabase fdb;
+ const QStringList stylesList = fdb.styles(family);
+ if (stylesList.size() == 0)
+ QSKIP("Default font doesn't have any styles");
+
+ for (const QString &style : stylesList) {
+ QFont result;
+ QFont initial = fdb.font(family, style, defaultFont.pointSize());
+
+ result.fromString(initial.toString());
+
+ QCOMPARE(result, initial);
+ }
+}
+
void tst_QFont::sharing()
{
// QFontCache references the engineData
diff --git a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
index 54bc802cf0..fbca313ea3 100644
--- a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
+++ b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
@@ -101,8 +101,6 @@ void tst_QFontCache::engineData()
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
req.family = cacheKey;
diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
index 5dba2fc06a..8a08cdc182 100644
--- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
+++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
@@ -2,12 +2,7 @@ CONFIG += testcase
TARGET = tst_qfontdatabase
SOURCES += tst_qfontdatabase.cpp
QT += testlib core-private gui-private
-
-wince* {
- additionalFiles.files = FreeMono.ttf
- additionalFiles.path = .
- DEPLOYMENT += additionalFiles
-}
+TESTDATA += LED_REAL.TTF
android {
RESOURCES += testdata.qrc
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index adaf3b1f7a..f71d808390 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -64,6 +64,8 @@ private slots:
void aliases();
void fallbackFonts();
+ void liberationFont();
+
private:
const QString m_testFont;
};
@@ -275,5 +277,23 @@ void tst_QFontDatabase::fallbackFonts()
}
}
+void tst_QFontDatabase::liberationFont()
+{
+ QString libSans("Liberation Sans");
+ QString libSansNarrow("Liberation Sans Narrow");
+
+ QFontDatabase db;
+ if (!db.hasFamily(libSans) || !db.hasFamily(libSansNarrow))
+ QSKIP("Requires Liberation Sans installed");
+
+ QFont fontLS(libSans);
+ QFont fontLSN(libSansNarrow);
+
+ QFontMetrics fmLS(fontLS);
+ QFontMetrics fmLSN(fontLSN);
+
+ QVERIFY(fmLS.width(QStringLiteral("foo bar")) > fmLSN.width(QStringLiteral("foo bar")));
+}
+
QTEST_MAIN(tst_QFontDatabase)
#include "tst_qfontdatabase.moc"
diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
index 3abca8ce89..c08019a561 100644
--- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro
+++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
@@ -6,12 +6,5 @@ SOURCES += \
tst_qglyphrun.cpp
-wince* {
- additionalFiles.files = test.ttf
- additionalFiles.path = ../../../shared/resources/
- DEPLOYMENT += additionalFiles
-} else {
- RESOURCES += \
- testdata.qrc
-}
-
+RESOURCES += \
+ testdata.qrc
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc
index 8f8e32ed24..c7ac9641d1 100644
--- a/tests/auto/gui/text/qrawfont/testdata.qrc
+++ b/tests/auto/gui/text/qrawfont/testdata.qrc
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/">
<file>testfont_bold_italic.ttf</file>
+ <file>testfont_os2_v1.ttf</file>
<file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf
new file mode 100644
index 0000000000..ee8b67d892
--- /dev/null
+++ b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf
Binary files differ
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index 471b32dd50..3cf108ed62 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -93,6 +93,7 @@ private slots:
private:
QString testFont;
QString testFontBoldItalic;
+ QString testFontOs2V1;
#endif // QT_NO_RAWFONT
};
@@ -110,6 +111,7 @@ void tst_QRawFont::initTestCase()
{
testFont = QFINDTESTDATA("testfont.ttf");
testFontBoldItalic = QFINDTESTDATA("testfont_bold_italic.ttf");
+ testFontOs2V1 = QFINDTESTDATA("testfont_os2_v1.ttf");
if (testFont.isEmpty() || testFontBoldItalic.isEmpty())
QFAIL("qrawfont unittest font files not found!");
@@ -184,6 +186,7 @@ void tst_QRawFont::correctFontData_data()
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<qreal>("unitsPerEm");
QTest::addColumn<qreal>("pixelSize");
+ QTest::addColumn<int>("capHeight");
int hintingPreferences[] = {
int(QFont::PreferDefaultHinting),
@@ -207,7 +210,8 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Normal
<< QFont::HintingPreference(*hintingPreference)
<< qreal(1000.0)
- << qreal(10.0);
+ << qreal(10.0)
+ << 7;
fileName = testFontBoldItalic;
title = fileName
@@ -221,7 +225,23 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Bold
<< QFont::HintingPreference(*hintingPreference)
<< qreal(1000.0)
- << qreal(10.0);
+ << qreal(10.0)
+ << 7;
+
+ fileName = testFontOs2V1;
+ title = fileName
+ + QLatin1String(": hintingPreference=")
+ + QString::number(*hintingPreference);
+
+ QTest::newRow(qPrintable(title))
+ << fileName
+ << QString::fromLatin1("QtBidiTestFont")
+ << QFont::StyleNormal
+ << QFont::Normal
+ << QFont::HintingPreference(*hintingPreference)
+ << qreal(1000.0)
+ << qreal(10.0)
+ << 7;
++hintingPreference;
}
@@ -236,6 +256,7 @@ void tst_QRawFont::correctFontData()
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(qreal, unitsPerEm);
QFETCH(qreal, pixelSize);
+ QFETCH(int, capHeight);
QRawFont font(fileName, 10, hintingPreference);
QVERIFY(font.isValid());
@@ -246,6 +267,11 @@ void tst_QRawFont::correctFontData()
QCOMPARE(font.hintingPreference(), hintingPreference);
QCOMPARE(font.unitsPerEm(), unitsPerEm);
QCOMPARE(font.pixelSize(), pixelSize);
+
+ // Some platforms return the actual fractional height of the
+ // H character when the value is missing from the OS/2 table,
+ // so we ceil it off to match (any touched pixel counts).
+ QCOMPARE(qCeil(font.capHeight()), capHeight);
}
void tst_QRawFont::glyphIndices()
diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro
index 0f4906ce4d..09d0dd4126 100644
--- a/tests/auto/gui/text/qstatictext/qstatictext.pro
+++ b/tests/auto/gui/text/qstatictext/qstatictext.pro
@@ -4,4 +4,4 @@ QT += testlib
SOURCES += tst_qstatictext.cpp
-contains(QT_CONFIG, private_tests): QT += core-private gui-private
+qtConfig(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 ec30cc8b67..b3d1b75a42 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -96,6 +96,8 @@ private slots:
void textDocumentColor();
#endif
+ void multiLine();
+
private:
bool supportsTransformations() const;
@@ -854,5 +856,58 @@ void tst_QStaticText::textDocumentColor()
}
#endif
+class TestPaintEngine: public QPaintEngine
+{
+public:
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE
+ {
+ differentVerticalPositions.insert(qRound(p.y()));
+ }
+
+ void updateState(const QPaintEngineState &) Q_DECL_OVERRIDE {}
+
+ void drawPolygon(const QPointF *, int , PolygonDrawMode ) Q_DECL_OVERRIDE {}
+
+ bool begin(QPaintDevice *) Q_DECL_OVERRIDE { return true; }
+ bool end() Q_DECL_OVERRIDE { return true; }
+ void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) Q_DECL_OVERRIDE {}
+ Type type() const Q_DECL_OVERRIDE
+ {
+ return User;
+ }
+
+ QSet<int> differentVerticalPositions;
+};
+
+class TestPixmap: public QPixmap
+{
+public:
+ TestPixmap(int w, int h) : QPixmap(w, h), testPaintEngine(new TestPaintEngine) {}
+ ~TestPixmap() { delete testPaintEngine; }
+
+ QPaintEngine *paintEngine() const
+ {
+ return testPaintEngine;
+ }
+
+ TestPaintEngine *testPaintEngine;
+};
+
+void tst_QStaticText::multiLine()
+{
+ TestPixmap pixmap(100, 100);
+
+ TestPaintEngine *paintEngine = pixmap.testPaintEngine;
+
+ {
+ QPainter p(&pixmap);
+ QStaticText text;
+ text.setText(QLatin1String("line 1") + QChar(QChar::LineSeparator) + QLatin1String("line 2"));
+ p.drawStaticText(0, 0, text);
+ }
+
+ QCOMPARE(paintEngine->differentVerticalPositions.size(), 2);
+}
+
QTEST_MAIN(tst_QStaticText)
#include "tst_qstatictext.moc"
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index aba5b301be..de5b2a8676 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -2921,15 +2921,28 @@ void tst_QTextDocument::testUndoBlocks()
doc->undo();
QCOMPARE(doc->toPlainText(), QString(""));
+ cursor.insertText("town");
+ cursor.beginEditBlock(); // Edit block 1 - Deletion/Insertion
+ cursor.setPosition(0, QTextCursor::KeepAnchor);
+ cursor.insertText("r");
+ cursor.endEditBlock();
+ cursor.insertText("est"); // Merged into edit block 1
+ QCOMPARE(doc->toPlainText(), QString("rest"));
+ doc->undo();
+ QCOMPARE(doc->toPlainText(), QString("town"));
+ doc->undo();
+ QCOMPARE(doc->toPlainText(), QString(""));
+
+ // This case would not happen in practice. If the user typed out this text, it would all be part of one
+ // edit block. This would cause the undo to clear all text. But for the purpose of testing the beginEditBlock
+ // and endEditBlock calls with respect to qtextdocument this is tested.
cursor.insertText("quod");
- cursor.beginEditBlock();
+ cursor.beginEditBlock(); // Edit block 1 - Insertion
cursor.insertText(" erat");
cursor.endEditBlock();
- cursor.insertText(" demonstrandum");
+ cursor.insertText(" demonstrandum"); // Merged into edit block 1
QCOMPARE(doc->toPlainText(), QString("quod erat demonstrandum"));
doc->undo();
- QCOMPARE(doc->toPlainText(), QString("quod erat"));
- doc->undo();
QCOMPARE(doc->toPlainText(), QString("quod"));
doc->undo();
QCOMPARE(doc->toPlainText(), QString(""));
diff --git a/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro b/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro
index 1419e32012..0bbe0c8c4e 100644
--- a/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro
+++ b/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro
@@ -6,5 +6,5 @@ SOURCES += tst_qtextpiecetable.cpp
HEADERS += ../qtextdocument/common.h
requires(!win32)
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index 0beea6528b..36907b9258 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -150,7 +150,7 @@ static void doShapingTests()
}
} else {
// decomposed shaping
- if (string.at(0) == 0x1fc1 || string.at(0) == 0x1fed)
+ if (string.at(0) == QChar(0x1fc1) || string.at(0) == QChar(0x1fed))
return;
if (string.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != string)
return;
diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro
index ebcd6ec022..ee92855093 100644
--- a/tests/auto/gui/text/qzip/qzip.pro
+++ b/tests/auto/gui/text/qzip/qzip.pro
@@ -2,12 +2,7 @@ CONFIG += testcase
TARGET = tst_qzip
QT += gui-private testlib
SOURCES += tst_qzip.cpp
-
-wince* {
- addFiles.files = testdata
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
+TESTDATA += testdata
android {
RESOURCES += \
diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp
index 50e9a0f0ef..c0bf5fef8e 100644
--- a/tests/auto/gui/text/qzip/tst_qzip.cpp
+++ b/tests/auto/gui/text/qzip/tst_qzip.cpp
@@ -50,7 +50,7 @@ void tst_QZip::basicUnpack()
QZipReader::FileInfo fi = files.at(0);
QVERIFY(fi.isValid());
- QCOMPARE(fi.filePath, QString("test/"));
+ QCOMPARE(fi.filePath, QString("test"));
QCOMPARE(uint(fi.isDir), (uint) 1);
QCOMPARE(uint(fi.isFile), (uint) 0);
QCOMPARE(uint(fi.isSymLink), (uint) 0);
diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro
index dc67794a98..bb4984767f 100644
--- a/tests/auto/gui/text/text.pro
+++ b/tests/auto/gui/text/text.pro
@@ -22,13 +22,15 @@ SUBDIRS=\
qtextpiecetable \
qtextscriptengine \
qtexttable \
-
-contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
+ qzip \
+ qtextodfwriter
win32:SUBDIRS -= qtextpiecetable
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qfontcache \
qcssparser \
qtextlayout \
qtextpiecetable \
+ qzip \
+ qtextodfwriter
diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
index 58164f1fa1..add23d46cf 100644
--- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
@@ -46,7 +46,7 @@ void tst_qdesktopservices::openUrl()
{
// At the bare minimum check that they return false for invalid url's
QCOMPARE(QDesktopServices::openUrl(QUrl()), false);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// this test is only valid on windows on other systems it might mean open a new document in the application handling .file
const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\.");
QVERIFY(messagePattern.isValid());