summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/gui.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/tst_qimage.cpp84
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp6
-rw-r--r--tests/auto/gui/image/qmovie/qmovie.pro4
-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.pro2
-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.cpp4
-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/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/qpainter/tst_qpainter.cpp2
-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/text/qabstracttextdocumentlayout/BLACKLIST7
-rw-r--r--tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp60
-rw-r--r--tests/auto/gui/text/qcssparser/qcssparser.pro8
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp34
-rw-r--r--tests/auto/gui/text/qfont/BLACKLIST2
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp10
-rw-r--r--tests/auto/gui/text/qfontdatabase/qfontdatabase.pro6
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro11
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp21
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp2
-rw-r--r--tests/auto/gui/text/qzip/qzip.pro6
-rw-r--r--tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp2
37 files changed, 290 insertions, 212 deletions
diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro
index d3393663ed..d6aa5e01ae 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 \
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/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 9e4a1abbb1..1bc4ec2ae7 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -195,6 +195,9 @@ private slots:
void pixelColor();
void pixel();
+ void ditherGradient_data();
+ void ditherGradient();
+
private:
const QString m_prefix;
};
@@ -290,17 +293,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 );
}
@@ -1785,11 +1784,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);
@@ -3188,5 +3183,78 @@ 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);
+}
+
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 4bf79cab05..9e747f8b11 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -509,9 +509,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);
}
{
@@ -530,9 +527,6 @@ void tst_QImageWriter::saveToTemporaryFile()
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);
}
{
diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro
index a04ad73b80..4a741ec154 100644
--- a/tests/auto/gui/image/qmovie/qmovie.pro
+++ b/tests/auto/gui/image/qmovie/qmovie.pro
@@ -5,8 +5,8 @@ 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
+contains(QT_CONFIG, gif):DEFINES += QTEST_HAVE_GIF
+contains(QT_CONFIG, 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..317d8c1ff9 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 \
diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
index a42b359f29..5e4875d1e7 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
+contains(QT_CONFIG,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..bfa15744c2 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -313,10 +313,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/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/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 0fe40e8db3..81ab693ee7 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -1,12 +1,16 @@
[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
diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro
index 08e1b1d3a0..f975e00ffa 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
+contains(QT_CONFIG,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/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 8a97a9261f..d2cc7ce072 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>
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/text/qabstracttextdocumentlayout/BLACKLIST b/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST
new file mode 100644
index 0000000000..fa033cee09
--- /dev/null
+++ b/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST
@@ -0,0 +1,7 @@
+#QTBUG-53648
+[imageAt]
+opensuse-42.1
+rhel-7.2
+#QTBUG-52991
+[formatAt]
+opensuse-42.1
diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
index d3404e335a..9542d306ba 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(fooBr.width() + blockStart.x(), (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(fooBr.width() + blockStart.x(), (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..b92859d4fb 100644
--- a/tests/auto/gui/text/qcssparser/qcssparser.pro
+++ b/tests/auto/gui/text/qcssparser/qcssparser.pro
@@ -6,14 +6,6 @@ QT += xml gui-private testlib
requires(contains(QT_CONFIG,private_tests))
DEFINES += SRCDIR=\\\"$$PWD\\\"
-wince* {
- addFiles.files = testdata
- addFiles.path = .
- timesFont.files = C:/Windows/Fonts/times.ttf
- timesFont.path = .
- DEPLOYMENT += addFiles timesFont
-}
-
android {
RESOURCES += \
testdata.qrc
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 847d6e2e2f..51e9bf646a 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,33 +78,8 @@ 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");
@@ -119,7 +87,7 @@ void tst_QCssParser::scanner_data()
#if defined(Q_OS_ANDROID)
QDir d(":/");
-#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
+#elif !defined(Q_OS_IRIX)
QDir d(SRCDIR);
#else
QDir d(QDir::current());
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..894b197968 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -508,11 +508,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()
diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
index 5dba2fc06a..0aff8a3ac8 100644
--- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
+++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
@@ -3,12 +3,6 @@ TARGET = tst_qfontdatabase
SOURCES += tst_qfontdatabase.cpp
QT += testlib core-private gui-private
-wince* {
- additionalFiles.files = FreeMono.ttf
- additionalFiles.path = .
- DEPLOYMENT += additionalFiles
-}
-
android {
RESOURCES += testdata.qrc
}
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/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 1869139a98..b0f70d1a59 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -2901,15 +2901,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/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..eb3de04da6 100644
--- a/tests/auto/gui/text/qzip/qzip.pro
+++ b/tests/auto/gui/text/qzip/qzip.pro
@@ -3,12 +3,6 @@ TARGET = tst_qzip
QT += gui-private testlib
SOURCES += tst_qzip.cpp
-wince* {
- addFiles.files = testdata
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
-
android {
RESOURCES += \
testdata.qrc
diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
index 58164f1fa1..f57ed12ed3 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)
// 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());