summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp24
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp9
-rw-r--r--tests/auto/gui/image/qpicture/tst_qpicture.cpp31
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp13
-rw-r--r--tests/auto/gui/kernel/kernel.pro3
-rw-r--r--tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp36
-rw-r--r--tests/auto/gui/kernel/qguitimer/BLACKLIST8
-rw-r--r--tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro6
-rw-r--r--tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp95
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST15
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp249
-rw-r--r--tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp23
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp6
-rw-r--r--tests/auto/gui/painting/qpainterpath/BLACKLIST2
-rw-r--r--tests/auto/gui/painting/qregion/tst_qregion.cpp24
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp29
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp41
-rw-r--r--tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp148
-rw-r--r--tests/auto/gui/text/qtexttable/tst_qtexttable.cpp108
19 files changed, 714 insertions, 156 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 441ec17412..b84aa52465 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -303,6 +303,8 @@ static QLatin1String formatToString(QImage::Format format)
return QLatin1String("RGBA64pm");
case QImage::Format_Grayscale16:
return QLatin1String("Grayscale16");
+ case QImage::Format_BGR888:
+ return QLatin1String("BGR888");
default:
break;
};
@@ -844,6 +846,13 @@ void tst_QImage::convertToFormat_data()
QTest::newRow("blue rgb32 -> rgb888") << int(QImage::Format_RGB32) << 0xff0000ff
<< int(QImage::Format_RGB888) << 0xff0000ff;
+ QTest::newRow("red rgb32 -> bgr888") << int(QImage::Format_RGB32) << 0xffff0000
+ << int(QImage::Format_BGR888) << 0xffff0000;
+ QTest::newRow("green rgb32 -> bgr888") << int(QImage::Format_RGB32) << 0xff00ff00
+ << int(QImage::Format_BGR888) << 0xff00ff00;
+ QTest::newRow("blue rgb32 -> bgr888") << int(QImage::Format_RGB32) << 0xff0000ff
+ << int(QImage::Format_BGR888) << 0xff0000ff;
+
QTest::newRow("red rgb16 -> rgb888") << int(QImage::Format_RGB16) << 0xffff0000
<< int(QImage::Format_RGB888) << 0xffff0000;
QTest::newRow("green rgb16 -> rgb888") << int(QImage::Format_RGB16) << 0xff00ff00
@@ -858,6 +867,13 @@ void tst_QImage::convertToFormat_data()
QTest::newRow("blue rgb888 -> argb32") << int(QImage::Format_RGB888) << 0xff0000ff
<< int(QImage::Format_ARGB32) << 0xff0000ff;
+ QTest::newRow("red bgr888 -> argb32") << int(QImage::Format_RGB888) << 0xffff0000
+ << int(QImage::Format_ARGB32) << 0xffff0000;
+ QTest::newRow("green bgr888 -> argb32") << int(QImage::Format_RGB888) << 0xff00ff00
+ << int(QImage::Format_ARGB32) << 0xff00ff00;
+ QTest::newRow("blue bgr888 -> argb32") << int(QImage::Format_RGB888) << 0xff0000ff
+ << int(QImage::Format_ARGB32) << 0xff0000ff;
+
QTest::newRow("red rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xffff0000
<< int(QImage::Format_RGBX8888) << 0xffff0000;
QTest::newRow("green rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff00ff00
@@ -1338,6 +1354,12 @@ void tst_QImage::setPixel_data()
<< 0xff00ff00 << 0x00ff00u;
QTest::newRow("RGB888 blue") << int(QImage::Format_RGB888)
<< 0xff0000ff << 0x0000ffu;
+ QTest::newRow("BGR888 red") << int(QImage::Format_BGR888)
+ << 0xffff0000 << 0x0000ffu;
+ QTest::newRow("BGR888 green") << int(QImage::Format_BGR888)
+ << 0xff00ff00 << 0x00ff00u;
+ QTest::newRow("BGR888 blue") << int(QImage::Format_BGR888)
+ << 0xff0000ff << 0xff0000u;
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
QTest::newRow("RGBA8888 red") << int(QImage::Format_RGBA8888)
<< 0xffff0000u << 0xff0000ffu;
@@ -1425,6 +1447,7 @@ void tst_QImage::setPixel()
case int(QImage::Format_ARGB8565_Premultiplied):
case int(QImage::Format_ARGB8555_Premultiplied):
case int(QImage::Format_RGB888):
+ case int(QImage::Format_BGR888):
{
for (int y = 0; y < h; ++y) {
const quint24 *row = (const quint24*)(img.scanLine(y));
@@ -2445,6 +2468,7 @@ void tst_QImage::mirrored_data()
QTest::newRow("Format_RGB555, vertical") << QImage::Format_RGB555 << true << false << 16 << 16;
QTest::newRow("Format_ARGB8555_Premultiplied, vertical") << QImage::Format_ARGB8555_Premultiplied << true << false << 16 << 16;
QTest::newRow("Format_RGB888, vertical") << QImage::Format_RGB888 << true << false << 16 << 16;
+ QTest::newRow("Format_BGR888, vertical") << QImage::Format_BGR888 << true << false << 16 << 16;
QTest::newRow("Format_RGB444, vertical") << QImage::Format_RGB444 << true << false << 16 << 16;
QTest::newRow("Format_RGBX8888, vertical") << QImage::Format_RGBX8888 << true << false << 16 << 16;
QTest::newRow("Format_RGBA8888_Premultiplied, vertical") << QImage::Format_RGBA8888_Premultiplied << true << false << 16 << 16;
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 8b42b139a3..f6ffd7b7c5 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -1863,6 +1863,7 @@ void tst_QImageReader::saveFormat_data()
QTest::newRow("Format_RGB555") << QImage::Format_RGB555;
QTest::newRow("Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
QTest::newRow("Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Format_BGR888") << QImage::Format_BGR888;
QTest::newRow("Format_RGB444") << QImage::Format_RGB444;
QTest::newRow("Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied;
QTest::newRow("Format_RGBA64") << QImage::Format_RGBA64;
@@ -1913,6 +1914,14 @@ void tst_QImageReader::saveColorSpace()
QImage stored = QImage::fromData(buf.buffer(), "png");
QCOMPARE(stored, orig);
+ QCOMPARE(stored.colorSpace(), orig.colorSpace());
+
+ buf.open(QIODevice::WriteOnly);
+ QVERIFY(orig.save(&buf, "jpeg"));
+ buf.close();
+ stored = QImage::fromData(buf.buffer(), "jpeg");
+
+ QCOMPARE(stored.colorSpace(), orig.colorSpace());
}
void tst_QImageReader::readText_data()
diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
index ec6bb8dcee..6287960457 100644
--- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp
+++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
@@ -37,6 +37,8 @@
#include <qscreen.h>
#include <limits.h>
+#ifndef QT_NO_PICTURE
+
class tst_QPicture : public QObject
{
Q_OBJECT
@@ -45,7 +47,6 @@ public:
tst_QPicture();
private slots:
- void getSetCheck();
void devType();
void paintingActive();
void boundingRect();
@@ -56,31 +57,6 @@ private slots:
void boundaryValues();
};
-// Testing get/set functions
-void tst_QPicture::getSetCheck()
-{
- QPictureIO obj1;
- // const QPicture & QPictureIO::picture()
- // void QPictureIO::setPicture(const QPicture &)
- // const char * QPictureIO::format()
- // void QPictureIO::setFormat(const char *)
- const char var2[] = "PNG";
- obj1.setFormat(var2);
- QCOMPARE(var2, obj1.format());
- obj1.setFormat((char *)0);
- // The format is stored internally in a QString, so return is always a valid char *
- QVERIFY(QString(obj1.format()).isEmpty());
-
- // const char * QPictureIO::parameters()
- // void QPictureIO::setParameters(const char *)
- const char var3[] = "Bogus data";
- obj1.setParameters(var3);
- QCOMPARE(var3, obj1.parameters());
- obj1.setParameters((char *)0);
- // The format is stored internally in a QString, so return is always a valid char *
- QVERIFY(QString(obj1.parameters()).isEmpty());
-}
-
tst_QPicture::tst_QPicture()
{
}
@@ -316,6 +292,7 @@ void tst_QPicture::boundaryValues()
painter.end();
}
-
QTEST_MAIN(tst_QPicture)
#include "tst_qpicture.moc"
+
+#endif // QT_NO_PICTURE
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 4d31d80246..ba5df809f2 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -267,10 +267,6 @@ void tst_QPixmap::fromImage()
image.fill(0x7f7f7f7f);
const QPixmap pixmap = QPixmap::fromImage(image);
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- if (pixmap.handle()->classId() == QPlatformPixmap::X11Class && !pixmap.x11PictureHandle())
- QSKIP("Requires XRender support");
-#endif
const QImage result = pixmap.toImage();
image = image.convertToFormat(result.format());
QCOMPARE(result, image);
@@ -491,11 +487,6 @@ void tst_QPixmap::fill()
else
pm = QPixmap(400, 400);
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- if (!bitmap && pm.handle()->classId() == QPlatformPixmap::X11Class && !pm.x11PictureHandle())
- QSKIP("Requires XRender support");
-#endif
-
pm.fill(color);
if (syscolor && !bitmap && pm.depth() < 24) {
QSKIP("Test does not work on displays without true color");
@@ -521,10 +512,6 @@ void tst_QPixmap::fill()
void tst_QPixmap::fill_transparent()
{
QPixmap pixmap(10, 10);
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- if (pixmap.handle()->classId() == QPlatformPixmap::X11Class && !pixmap.x11PictureHandle())
- QSKIP("Requires XRender support");
-#endif
pixmap.fill(Qt::transparent);
QVERIFY(pixmap.hasAlphaChannel());
}
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index fbd3b1b371..42135dae24 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -11,6 +11,7 @@ SUBDIRS=\
qguimetatype \
qguitimer \
qguivariant \
+ qhighdpiscaling \
qinputmethod \
qkeyevent \
qkeysequence \
@@ -35,6 +36,8 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(network): SUBDIRS -= \
qguieventloop
+!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling
+
!qtConfig(opengl): SUBDIRS -= qopenglwindow
android|uikit: SUBDIRS -= qclipboard
diff --git a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
index 4fca9a07fc..3d1876f00f 100644
--- a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
+++ b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
@@ -36,6 +36,7 @@
#include <QtNetwork/qtcpserver.h>
#include <QtNetwork/qtcpsocket.h>
#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qtimer.h>
#include <QtCore/qt_windows.h>
@@ -49,7 +50,7 @@ class tst_NoQtEventLoop : public QObject
private slots:
void consumeMouseEvents();
void consumeSocketEvents();
-
+ void deliverEventsInLivelock();
};
class Window : public QRasterWindow
@@ -258,8 +259,8 @@ void tst_NoQtEventLoop::consumeMouseEvents()
::SetWindowPos(mainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- Window *childWindow = new Window;
- childWindow->setParent(QWindow::fromWinId((WId)mainWnd));
+ QWindow *mainWindow = QWindow::fromWinId(reinterpret_cast<WId>(mainWnd));
+ Window *childWindow = new Window(mainWindow);
childWindow->setGeometry(margin, topVerticalMargin,
width - 2 * margin, height - margin - topVerticalMargin);
childWindow->show();
@@ -276,6 +277,7 @@ void tst_NoQtEventLoop::consumeMouseEvents()
if (g_exit)
break;
}
+ delete mainWindow;
QCOMPARE(testThread->passed(), true);
@@ -311,6 +313,34 @@ void tst_NoQtEventLoop::consumeSocketEvents()
QVERIFY(server.hasPendingConnections());
}
+void tst_NoQtEventLoop::deliverEventsInLivelock()
+{
+ int argc = 1;
+ char *argv[] = { const_cast<char *>("test"), 0 };
+ QGuiApplication app(argc, argv);
+
+ QTimer livelockTimer;
+ livelockTimer.start(0);
+ QTimer::singleShot(100, Qt::CoarseTimer, &livelockTimer, &QTimer::stop);
+
+ QElapsedTimer elapsedTimer;
+ elapsedTimer.start();
+
+ // Exec own message loop
+ MSG msg;
+ forever {
+ if (elapsedTimer.hasExpired(3000) || !livelockTimer.isActive())
+ break;
+
+ if (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ ::TranslateMessage(&msg);
+ ::DispatchMessage(&msg);
+ }
+ }
+
+ QVERIFY(!livelockTimer.isActive());
+}
+
#include <tst_noqteventloop.moc>
QTEST_APPLESS_MAIN(tst_NoQtEventLoop)
diff --git a/tests/auto/gui/kernel/qguitimer/BLACKLIST b/tests/auto/gui/kernel/qguitimer/BLACKLIST
deleted file mode 100644
index 6ab715b922..0000000000
--- a/tests/auto/gui/kernel/qguitimer/BLACKLIST
+++ /dev/null
@@ -1,8 +0,0 @@
-[basic_chrono]
-osx-10.13
-[remainingTime]
-osx-10.12
-windows-10 msvc-2015
-osx-10.14
-osx-10.13
-
diff --git a/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro
new file mode 100644
index 0000000000..6cd7bb01f5
--- /dev/null
+++ b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = tst_qhighdpiscaling
+
+QT += core-private gui-private testlib
+
+SOURCES += tst_qhighdpiscaling.cpp
diff --git a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp
new file mode 100644
index 0000000000..ec80c2d02c
--- /dev/null
+++ b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qhighdpiscaling_p.h>
+#include <qpa/qplatformscreen.h>
+
+#include <QtTest/QtTest>
+
+class tst_QHighDpiScaling: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void factor();
+ void scale();
+};
+
+// Emulate the case of a High DPI secondary screen
+class MyPlatformScreen : public QPlatformScreen
+{
+public:
+ QRect geometry() const override { return QRect(3840, 0, 3840, 1920); }
+ QRect availableGeometry() const override { return geometry(); }
+
+ int depth() const override { return 32; }
+ QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; }
+};
+
+void tst_QHighDpiScaling::factor()
+{
+ QHighDpiScaling::setGlobalFactor(2);
+
+ // Verfy that QHighDpiScaling::factor() does not crash on nullptr contexts.
+ QPoint fakeNativePosition = QPoint(5, 5);
+ QPlatformScreen *screenContext = nullptr;
+ QVERIFY(QHighDpiScaling::factor(screenContext) >= 0);
+ QVERIFY(QHighDpiScaling::factor(screenContext, &fakeNativePosition) >= 0);
+ QPlatformScreen *platformScreenContext = nullptr;
+ QVERIFY(QHighDpiScaling::factor(platformScreenContext) >= 0);
+ QVERIFY(QHighDpiScaling::factor(platformScreenContext, &fakeNativePosition) >= 0);
+ QWindow *windowContext = nullptr;
+ QVERIFY(QHighDpiScaling::factor(windowContext) >= 0);
+ QVERIFY(QHighDpiScaling::factor(windowContext, &fakeNativePosition) >= 0);
+}
+
+// QTBUG-77255: Test some scaling overloads
+void tst_QHighDpiScaling::scale()
+{
+ QHighDpiScaling::setGlobalFactor(2);
+ QScopedPointer<QPlatformScreen> screen(new MyPlatformScreen);
+
+ qreal nativeValue = 10;
+ const qreal value = QHighDpi::fromNativePixels(nativeValue, screen.data());
+ QCOMPARE(value, qreal(5));
+ QCOMPARE(QHighDpi::toNativePixels(value, screen.data()), nativeValue);
+
+ // 10, 10 within screen should translate to 5,5 with origin preserved
+ const QPoint nativePoint = screen->geometry().topLeft() + QPoint(10, 10);
+ const QPoint point = QHighDpi::fromNativePixels(nativePoint, screen.data());
+ QCOMPARE(point, QPoint(3845, 5));
+ QCOMPARE(QHighDpi::toNativePixels(point, screen.data()), nativePoint);
+
+ const QPointF nativePointF(nativePoint);
+ const QPointF pointF = QHighDpi::fromNativePixels(nativePointF, screen.data());
+ QCOMPARE(pointF, QPointF(3845, 5));
+ QCOMPARE(QHighDpi::toNativePixels(pointF, screen.data()), nativePointF);
+}
+
+#include "tst_qhighdpiscaling.moc"
+QTEST_MAIN(tst_QHighDpiScaling);
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index 1bb3917948..27463adf99 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -1,7 +1,5 @@
[positioning]
opensuse-leap
-ubuntu-16.04
-opensuse-42.3
[positioning:default]
linux
osx-10.12 ci
@@ -9,24 +7,17 @@ winrt
[positioning:fake]
osx-10.12 ci
[modalWithChildWindow]
-ubuntu-16.04
-opensuse-leap
# QTBUG-66851
# QTBUG-69160
-opensuse-42.3
+opensuse-leap
[setVisible]
# QTBUG-69154
android
[modalWindowEnterEventOnHide_QTBUG35109]
-ubuntu-16.04
-osx-10.11
-osx-10.13
-osx-10.14
-osx-10.12
+osx
[spuriousMouseMove]
# QTBUG-69162
-windows-10 msvc-2015
-windows-10 msvc-2017
+windows-10
[testInputEvents]
rhel-7.4
[exposeEventOnShrink_QTBUG54040]
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 90a216e14a..07c820dc86 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -64,6 +64,10 @@ private slots:
void globalColors_data();
void globalColors();
+#if defined(Q_COMPILER_CONSTEXPR) & defined(Q_COMPILER_UNIFORM_INIT)
+ void colorConstants_data();
+ void colorConstants();
+#endif
void setRed();
void setGreen();
@@ -111,10 +115,6 @@ private slots:
void qcolorprofile_data();
void qcolorprofile();
-
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- void setallowX11ColorNames();
-#endif
};
// Testing get/set functions
@@ -368,6 +368,191 @@ void tst_QColor::globalColors()
QCOMPARE(color.rgba(), argb);
}
+#if defined(Q_COMPILER_CONSTEXPR) & defined(Q_COMPILER_UNIFORM_INIT)
+void tst_QColor::colorConstants_data()
+{
+ QTest::addColumn<QColor>("color");
+ QTest::addColumn<QRgb>("argb");
+
+ QTest::newRow("invalid") << QColor() << 0xff000000;
+ QTest::newRow("global color color0") << QColorConstants::Color0 << 0xff000000u;
+ QTest::newRow("global color color1") << QColorConstants::Color1 << 0xffffffffu;
+ QTest::newRow("global color black") << QColorConstants::Black << 0xff000000u;
+ QTest::newRow("global color white") << QColorConstants::White << 0xffffffffu;
+ QTest::newRow("global color darkGray") << QColorConstants::DarkGray << 0xff808080u;
+ QTest::newRow("global color gray") << QColorConstants::Gray << 0xffa0a0a4u;
+ QTest::newRow("global color lightGray") << QColorConstants::LightGray << 0xffc0c0c0u;
+ QTest::newRow("global color red") << QColorConstants::Red << 0xffff0000u;
+ QTest::newRow("global color green") << QColorConstants::Green << 0xff00ff00u;
+ QTest::newRow("global color blue") << QColorConstants::Blue << 0xff0000ffu;
+ QTest::newRow("global color cyan") << QColorConstants::Cyan << 0xff00ffffu;
+ QTest::newRow("global color magenta") << QColorConstants::Magenta << 0xffff00ffu;
+ QTest::newRow("global color yellow") << QColorConstants::Yellow << 0xffffff00u;
+ QTest::newRow("global color darkRed") << QColorConstants::DarkRed << 0xff800000u;
+ QTest::newRow("global color darkGreen") << QColorConstants::DarkGreen << 0xff008000u;
+ QTest::newRow("global color darkBlue") << QColorConstants::DarkBlue << 0xff000080u;
+ QTest::newRow("global color darkCyan") << QColorConstants::DarkCyan << 0xff008080u;
+ QTest::newRow("global color darkMagenta") << QColorConstants::DarkMagenta << 0xff800080u;
+ QTest::newRow("global color darkYellow") << QColorConstants::DarkYellow << 0xff808000u;
+ QTest::newRow("global color transparent") << QColorConstants::Transparent << 0x00000000u;
+
+ QTest::newRow("SVG aliceblue") << QColorConstants::Svg::aliceblue << 0xfff0f8ffu;
+ QTest::newRow("SVG antiquewhite") << QColorConstants::Svg::antiquewhite << 0xfffaebd7u;
+ QTest::newRow("SVG aqua") << QColorConstants::Svg::aqua << 0xff00ffffu;
+ QTest::newRow("SVG aquamarine") << QColorConstants::Svg::aquamarine << 0xff7fffd4u;
+ QTest::newRow("SVG azure") << QColorConstants::Svg::azure << 0xfff0ffffu;
+ QTest::newRow("SVG beige") << QColorConstants::Svg::beige << 0xfff5f5dcu;
+ QTest::newRow("SVG bisque") << QColorConstants::Svg::bisque << 0xffffe4c4u;
+ QTest::newRow("SVG black") << QColorConstants::Svg::black << 0xff000000u;
+ QTest::newRow("SVG blanchedalmond") << QColorConstants::Svg::blanchedalmond << 0xffffebcdu;
+ QTest::newRow("SVG blue") << QColorConstants::Svg::blue << 0xff0000ffu;
+ QTest::newRow("SVG blueviolet") << QColorConstants::Svg::blueviolet << 0xff8a2be2u;
+ QTest::newRow("SVG brown") << QColorConstants::Svg::brown << 0xffa52a2au;
+ QTest::newRow("SVG burlywood") << QColorConstants::Svg::burlywood << 0xffdeb887u;
+ QTest::newRow("SVG cadetblue") << QColorConstants::Svg::cadetblue << 0xff5f9ea0u;
+ QTest::newRow("SVG chartreuse") << QColorConstants::Svg::chartreuse << 0xff7fff00u;
+ QTest::newRow("SVG chocolate") << QColorConstants::Svg::chocolate << 0xffd2691eu;
+ QTest::newRow("SVG coral") << QColorConstants::Svg::coral << 0xffff7f50u;
+ QTest::newRow("SVG cornflowerblue") << QColorConstants::Svg::cornflowerblue << 0xff6495edu;
+ QTest::newRow("SVG cornsilk") << QColorConstants::Svg::cornsilk << 0xfffff8dcu;
+ QTest::newRow("SVG crimson") << QColorConstants::Svg::crimson << 0xffdc143cu;
+ QTest::newRow("SVG cyan") << QColorConstants::Svg::cyan << 0xff00ffffu;
+ QTest::newRow("SVG darkblue") << QColorConstants::Svg::darkblue << 0xff00008bu;
+ QTest::newRow("SVG darkcyan") << QColorConstants::Svg::darkcyan << 0xff008b8bu;
+ QTest::newRow("SVG darkgoldenrod") << QColorConstants::Svg::darkgoldenrod << 0xffb8860bu;
+ QTest::newRow("SVG darkgray") << QColorConstants::Svg::darkgray << 0xffa9a9a9u;
+ QTest::newRow("SVG darkgreen") << QColorConstants::Svg::darkgreen << 0xff006400u;
+ QTest::newRow("SVG darkgrey") << QColorConstants::Svg::darkgrey << 0xffa9a9a9u;
+ QTest::newRow("SVG darkkhaki") << QColorConstants::Svg::darkkhaki << 0xffbdb76bu;
+ QTest::newRow("SVG darkmagenta") << QColorConstants::Svg::darkmagenta << 0xff8b008bu;
+ QTest::newRow("SVG darkolivegreen") << QColorConstants::Svg::darkolivegreen << 0xff556b2fu;
+ QTest::newRow("SVG darkorange") << QColorConstants::Svg::darkorange << 0xffff8c00u;
+ QTest::newRow("SVG darkorchid") << QColorConstants::Svg::darkorchid << 0xff9932ccu;
+ QTest::newRow("SVG darkred") << QColorConstants::Svg::darkred << 0xff8b0000u;
+ QTest::newRow("SVG darksalmon") << QColorConstants::Svg::darksalmon << 0xffe9967au;
+ QTest::newRow("SVG darkseagreen") << QColorConstants::Svg::darkseagreen << 0xff8fbc8fu;
+ QTest::newRow("SVG darkslateblue") << QColorConstants::Svg::darkslateblue << 0xff483d8bu;
+ QTest::newRow("SVG darkslategray") << QColorConstants::Svg::darkslategray << 0xff2f4f4fu;
+ QTest::newRow("SVG darkslategrey") << QColorConstants::Svg::darkslategrey << 0xff2f4f4fu;
+ QTest::newRow("SVG darkturquoise") << QColorConstants::Svg::darkturquoise << 0xff00ced1u;
+ QTest::newRow("SVG darkviolet") << QColorConstants::Svg::darkviolet << 0xff9400d3u;
+ QTest::newRow("SVG deeppink") << QColorConstants::Svg::deeppink << 0xffff1493u;
+ QTest::newRow("SVG deepskyblue") << QColorConstants::Svg::deepskyblue << 0xff00bfffu;
+ QTest::newRow("SVG dimgray") << QColorConstants::Svg::dimgray << 0xff696969u;
+ QTest::newRow("SVG dimgrey") << QColorConstants::Svg::dimgrey << 0xff696969u;
+ QTest::newRow("SVG dodgerblue") << QColorConstants::Svg::dodgerblue << 0xff1e90ffu;
+ QTest::newRow("SVG firebrick") << QColorConstants::Svg::firebrick << 0xffb22222u;
+ QTest::newRow("SVG floralwhite") << QColorConstants::Svg::floralwhite << 0xfffffaf0u;
+ QTest::newRow("SVG forestgreen") << QColorConstants::Svg::forestgreen << 0xff228b22u;
+ QTest::newRow("SVG fuchsia") << QColorConstants::Svg::fuchsia << 0xffff00ffu;
+ QTest::newRow("SVG gainsboro") << QColorConstants::Svg::gainsboro << 0xffdcdcdcu;
+ QTest::newRow("SVG ghostwhite") << QColorConstants::Svg::ghostwhite << 0xfff8f8ffu;
+ QTest::newRow("SVG gold") << QColorConstants::Svg::gold << 0xffffd700u;
+ QTest::newRow("SVG goldenrod") << QColorConstants::Svg::goldenrod << 0xffdaa520u;
+ QTest::newRow("SVG gray") << QColorConstants::Svg::gray << 0xff808080u;
+ QTest::newRow("SVG green") << QColorConstants::Svg::green << 0xff008000u;
+ QTest::newRow("SVG greenyellow") << QColorConstants::Svg::greenyellow << 0xffadff2fu;
+ QTest::newRow("SVG grey") << QColorConstants::Svg::grey << 0xff808080u;
+ QTest::newRow("SVG honeydew") << QColorConstants::Svg::honeydew << 0xfff0fff0u;
+ QTest::newRow("SVG hotpink") << QColorConstants::Svg::hotpink << 0xffff69b4u;
+ QTest::newRow("SVG indianred") << QColorConstants::Svg::indianred << 0xffcd5c5cu;
+ QTest::newRow("SVG indigo") << QColorConstants::Svg::indigo << 0xff4b0082u;
+ QTest::newRow("SVG ivory") << QColorConstants::Svg::ivory << 0xfffffff0u;
+ QTest::newRow("SVG khaki") << QColorConstants::Svg::khaki << 0xfff0e68cu;
+ QTest::newRow("SVG lavender") << QColorConstants::Svg::lavender << 0xffe6e6fau;
+ QTest::newRow("SVG lavenderblush") << QColorConstants::Svg::lavenderblush << 0xfffff0f5u;
+ QTest::newRow("SVG lawngreen") << QColorConstants::Svg::lawngreen << 0xff7cfc00u;
+ QTest::newRow("SVG lemonchiffon") << QColorConstants::Svg::lemonchiffon << 0xfffffacdu;
+ QTest::newRow("SVG lightblue") << QColorConstants::Svg::lightblue << 0xffadd8e6u;
+ QTest::newRow("SVG lightcoral") << QColorConstants::Svg::lightcoral << 0xfff08080u;
+ QTest::newRow("SVG lightcyan") << QColorConstants::Svg::lightcyan << 0xffe0ffffu;
+ QTest::newRow("SVG lightgoldenrodyellow") << QColorConstants::Svg::lightgoldenrodyellow << 0xfffafad2u;
+ QTest::newRow("SVG lightgray") << QColorConstants::Svg::lightgray << 0xffd3d3d3u;
+ QTest::newRow("SVG lightgreen") << QColorConstants::Svg::lightgreen << 0xff90ee90u;
+ QTest::newRow("SVG lightgrey") << QColorConstants::Svg::lightgrey << 0xffd3d3d3u;
+ QTest::newRow("SVG lightpink") << QColorConstants::Svg::lightpink << 0xffffb6c1u;
+ QTest::newRow("SVG lightsalmon") << QColorConstants::Svg::lightsalmon << 0xffffa07au;
+ QTest::newRow("SVG lightseagreen") << QColorConstants::Svg::lightseagreen << 0xff20b2aau;
+ QTest::newRow("SVG lightskyblue") << QColorConstants::Svg::lightskyblue << 0xff87cefau;
+ QTest::newRow("SVG lightslategray") << QColorConstants::Svg::lightslategray << 0xff778899u;
+ QTest::newRow("SVG lightslategrey") << QColorConstants::Svg::lightslategrey << 0xff778899u;
+ QTest::newRow("SVG lightsteelblue") << QColorConstants::Svg::lightsteelblue << 0xffb0c4deu;
+ QTest::newRow("SVG lightyellow") << QColorConstants::Svg::lightyellow << 0xffffffe0u;
+ QTest::newRow("SVG lime") << QColorConstants::Svg::lime << 0xff00ff00u;
+ QTest::newRow("SVG limegreen") << QColorConstants::Svg::limegreen << 0xff32cd32u;
+ QTest::newRow("SVG linen") << QColorConstants::Svg::linen << 0xfffaf0e6u;
+ QTest::newRow("SVG magenta") << QColorConstants::Svg::magenta << 0xffff00ffu;
+ QTest::newRow("SVG maroon") << QColorConstants::Svg::maroon << 0xff800000u;
+ QTest::newRow("SVG mediumaquamarine") << QColorConstants::Svg::mediumaquamarine << 0xff66cdaau;
+ QTest::newRow("SVG mediumblue") << QColorConstants::Svg::mediumblue << 0xff0000cdu;
+ QTest::newRow("SVG mediumorchid") << QColorConstants::Svg::mediumorchid << 0xffba55d3u;
+ QTest::newRow("SVG mediumpurple") << QColorConstants::Svg::mediumpurple << 0xff9370dbu;
+ QTest::newRow("SVG mediumseagreen") << QColorConstants::Svg::mediumseagreen << 0xff3cb371u;
+ QTest::newRow("SVG mediumslateblue") << QColorConstants::Svg::mediumslateblue << 0xff7b68eeu;
+ QTest::newRow("SVG mediumspringgreen") << QColorConstants::Svg::mediumspringgreen << 0xff00fa9au;
+ QTest::newRow("SVG mediumturquoise") << QColorConstants::Svg::mediumturquoise << 0xff48d1ccu;
+ QTest::newRow("SVG mediumvioletred") << QColorConstants::Svg::mediumvioletred << 0xffc71585u;
+ QTest::newRow("SVG midnightblue") << QColorConstants::Svg::midnightblue << 0xff191970u;
+ QTest::newRow("SVG mintcream") << QColorConstants::Svg::mintcream << 0xfff5fffau;
+ QTest::newRow("SVG mistyrose") << QColorConstants::Svg::mistyrose << 0xffffe4e1u;
+ QTest::newRow("SVG moccasin") << QColorConstants::Svg::moccasin << 0xffffe4b5u;
+ QTest::newRow("SVG navajowhite") << QColorConstants::Svg::navajowhite << 0xffffdeadu;
+ QTest::newRow("SVG navy") << QColorConstants::Svg::navy << 0xff000080u;
+ QTest::newRow("SVG oldlace") << QColorConstants::Svg::oldlace << 0xfffdf5e6u;
+ QTest::newRow("SVG olive") << QColorConstants::Svg::olive << 0xff808000u;
+ QTest::newRow("SVG olivedrab") << QColorConstants::Svg::olivedrab << 0xff6b8e23u;
+ QTest::newRow("SVG orange") << QColorConstants::Svg::orange << 0xffffa500u;
+ QTest::newRow("SVG orangered") << QColorConstants::Svg::orangered << 0xffff4500u;
+ QTest::newRow("SVG orchid") << QColorConstants::Svg::orchid << 0xffda70d6u;
+ QTest::newRow("SVG palegoldenrod") << QColorConstants::Svg::palegoldenrod << 0xffeee8aau;
+ QTest::newRow("SVG palegreen") << QColorConstants::Svg::palegreen << 0xff98fb98u;
+ QTest::newRow("SVG paleturquoise") << QColorConstants::Svg::paleturquoise << 0xffafeeeeu;
+ QTest::newRow("SVG palevioletred") << QColorConstants::Svg::palevioletred << 0xffdb7093u;
+ QTest::newRow("SVG papayawhip") << QColorConstants::Svg::papayawhip << 0xffffefd5u;
+ QTest::newRow("SVG peachpuff") << QColorConstants::Svg::peachpuff << 0xffffdab9u;
+ QTest::newRow("SVG peru") << QColorConstants::Svg::peru << 0xffcd853fu;
+ QTest::newRow("SVG pink") << QColorConstants::Svg::pink << 0xffffc0cbu;
+ QTest::newRow("SVG plum") << QColorConstants::Svg::plum << 0xffdda0ddu;
+ QTest::newRow("SVG powderblue") << QColorConstants::Svg::powderblue << 0xffb0e0e6u;
+ QTest::newRow("SVG purple") << QColorConstants::Svg::purple << 0xff800080u;
+ QTest::newRow("SVG red") << QColorConstants::Svg::red << 0xffff0000u;
+ QTest::newRow("SVG rosybrown") << QColorConstants::Svg::rosybrown << 0xffbc8f8fu;
+ QTest::newRow("SVG royalblue") << QColorConstants::Svg::royalblue << 0xff4169e1u;
+ QTest::newRow("SVG saddlebrown") << QColorConstants::Svg::saddlebrown << 0xff8b4513u;
+ QTest::newRow("SVG salmon") << QColorConstants::Svg::salmon << 0xfffa8072u;
+ QTest::newRow("SVG sandybrown") << QColorConstants::Svg::sandybrown << 0xfff4a460u;
+ QTest::newRow("SVG seagreen") << QColorConstants::Svg::seagreen << 0xff2e8b57u;
+ QTest::newRow("SVG seashell") << QColorConstants::Svg::seashell << 0xfffff5eeu;
+ QTest::newRow("SVG sienna") << QColorConstants::Svg::sienna << 0xffa0522du;
+ QTest::newRow("SVG silver") << QColorConstants::Svg::silver << 0xffc0c0c0u;
+ QTest::newRow("SVG skyblue") << QColorConstants::Svg::skyblue << 0xff87ceebu;
+ QTest::newRow("SVG slateblue") << QColorConstants::Svg::slateblue << 0xff6a5acdu;
+ QTest::newRow("SVG slategray") << QColorConstants::Svg::slategray << 0xff708090u;
+ QTest::newRow("SVG slategrey") << QColorConstants::Svg::slategrey << 0xff708090u;
+ QTest::newRow("SVG snow") << QColorConstants::Svg::snow << 0xfffffafau;
+ QTest::newRow("SVG springgreen") << QColorConstants::Svg::springgreen << 0xff00ff7fu;
+ QTest::newRow("SVG steelblue") << QColorConstants::Svg::steelblue << 0xff4682b4u;
+ QTest::newRow("SVG tan") << QColorConstants::Svg::tan << 0xffd2b48cu;
+ QTest::newRow("SVG teal") << QColorConstants::Svg::teal << 0xff008080u;
+ QTest::newRow("SVG thistle") << QColorConstants::Svg::thistle << 0xffd8bfd8u;
+ QTest::newRow("SVG tomato") << QColorConstants::Svg::tomato << 0xffff6347u;
+ QTest::newRow("SVG turquoise") << QColorConstants::Svg::turquoise << 0xff40e0d0u;
+ QTest::newRow("SVG violet") << QColorConstants::Svg::violet << 0xffee82eeu;
+ QTest::newRow("SVG wheat") << QColorConstants::Svg::wheat << 0xfff5deb3u;
+ QTest::newRow("SVG white") << QColorConstants::Svg::white << 0xffffffffu;
+ QTest::newRow("SVG whitesmoke") << QColorConstants::Svg::whitesmoke << 0xfff5f5f5u;
+ QTest::newRow("SVG yellow") << QColorConstants::Svg::yellow << 0xffffff00u;
+ QTest::newRow("SVG yellowgreen") << QColorConstants::Svg::yellowgreen << 0xff9acd32u;
+}
+
+void tst_QColor::colorConstants()
+{
+ QFETCH(QColor, color);
+ QFETCH(QRgb, argb);
+ QCOMPARE(color.rgba(), argb);
+}
+#endif // defined(Q_COMPILER_CONSTEXPR) & defined(Q_COMPILER_UNIFORM_INIT)
+
/*
CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
*/
@@ -1460,62 +1645,6 @@ void tst_QColor::achromaticHslHue()
QCOMPARE(hsl.hslHue(), -1);
}
-#if 0 // Used to be included in Qt4 for Q_WS_X11
-void tst_QColor::setallowX11ColorNames()
-{
- RGBData x11RgbTbl[] = {
- // a few standard X11 color names
- { "DodgerBlue1", qRgb(30, 144, 255) },
- { "DodgerBlue2", qRgb(28, 134, 238) },
- { "DodgerBlue3", qRgb(24, 116, 205) },
- { "DodgerBlue4", qRgb(16, 78, 139) },
- { "SteelBlue1", qRgb(99, 184, 255) },
- { "SteelBlue2", qRgb(92, 172, 238) },
- { "SteelBlue3", qRgb(79, 148, 205) },
- { "SteelBlue4", qRgb(54, 100, 139) },
- { "DeepSkyBlue1", qRgb(0, 191, 255) },
- { "DeepSkyBlue2", qRgb(0, 178, 238) },
- { "DeepSkyBlue3", qRgb(0, 154, 205) },
- { "DeepSkyBlue4", qRgb(0, 104, 139) },
- { "SkyBlue1", qRgb(135, 206, 255) },
- { "SkyBlue2", qRgb(126, 192, 238) },
- { "SkyBlue3", qRgb(108, 166, 205) },
- { "SkyBlue4", qRgb(74, 112, 139) }
- };
- static const int x11RgbTblSize = sizeof(x11RgbTbl) / sizeof(RGBData);
-
- // X11 color names should not work by default
- QVERIFY(!QColor::allowX11ColorNames());
- for (int i = 0; i < x11RgbTblSize; ++i) {
- QString colorName = QLatin1String(x11RgbTbl[i].name);
- QColor color;
- color.setNamedColor(colorName);
- QVERIFY(!color.isValid());
- }
-
- // enable X11 color names
- QColor::setAllowX11ColorNames(true);
- QVERIFY(QColor::allowX11ColorNames());
- for (int i = 0; i < x11RgbTblSize; ++i) {
- QString colorName = QLatin1String(x11RgbTbl[i].name);
- QColor color;
- color.setNamedColor(colorName);
- QColor expected(x11RgbTbl[i].value);
- QCOMPARE(color, expected);
- }
-
- // should be able to turn off X11 color names
- QColor::setAllowX11ColorNames(false);
- QVERIFY(!QColor::allowX11ColorNames());
- for (int i = 0; i < x11RgbTblSize; ++i) {
- QString colorName = QLatin1String(x11RgbTbl[i].name);
- QColor color;
- color.setNamedColor(colorName);
- QVERIFY(!color.isValid());
- }
-}
-#endif
-
void tst_QColor::premultiply()
{
// Tests that qPremultiply(qUnpremultiply(x)) returns x.
diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp
index bc1a45013c..9e13dc80b4 100644
--- a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp
+++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp
@@ -47,6 +47,7 @@ public:
tst_QColorSpace();
private slots:
+ void movable();
void namedColorSpaces_data();
void namedColorSpaces();
@@ -75,6 +76,28 @@ tst_QColorSpace::tst_QColorSpace()
{ }
+void tst_QColorSpace::movable()
+{
+ QColorSpace cs1 = QColorSpace::SRgb;
+ QColorSpace cs2 = QColorSpace::SRgbLinear;
+ QVERIFY(cs1.isValid());
+ QVERIFY(cs2.isValid());
+ QCOMPARE(cs1.colorSpaceId(), QColorSpace::SRgb);
+
+ cs2 = std::move(cs1);
+ QVERIFY(!cs1.isValid());
+ QVERIFY(cs2.isValid());
+ QCOMPARE(cs2.colorSpaceId(), QColorSpace::SRgb);
+ QCOMPARE(cs1.colorSpaceId(), QColorSpace::Undefined);
+ QCOMPARE(cs1, QColorSpace());
+
+ QColorSpace cs3(std::move(cs2));
+ QVERIFY(!cs2.isValid());
+ QVERIFY(cs3.isValid());
+ QCOMPARE(cs3.colorSpaceId(), QColorSpace::SRgb);
+ QCOMPARE(cs2.colorSpaceId(), QColorSpace::Undefined);
+}
+
void tst_QColorSpace::namedColorSpaces_data()
{
QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId");
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 0efeb9b356..d2a4dfc3e9 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -461,11 +461,6 @@ void tst_QPainter::drawPixmap_comp()
destPm.fill(c1);
srcPm.fill(c2);
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- if (!destPm.x11PictureHandle())
- QSKIP("Requires XRender support");
-#endif
-
QPainter p(&destPm);
p.drawPixmap(0, 0, srcPm);
p.end();
@@ -1637,6 +1632,7 @@ void tst_QPainter::qimageFormats_data()
QTest::newRow("Qimage::Format_RGB555") << QImage::Format_RGB555;
QTest::newRow("Qimage::Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
QTest::newRow("Qimage::Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Qimage::Format_BGR888") << QImage::Format_BGR888;
QTest::newRow("Qimage::Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied;
QTest::newRow("Qimage::Format_RGB30") << QImage::Format_RGB30;
}
diff --git a/tests/auto/gui/painting/qpainterpath/BLACKLIST b/tests/auto/gui/painting/qpainterpath/BLACKLIST
new file mode 100644
index 0000000000..b3e6d3bfe4
--- /dev/null
+++ b/tests/auto/gui/painting/qpainterpath/BLACKLIST
@@ -0,0 +1,2 @@
+[contains_QPointF]
+msvc-2019
diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp
index 24c4583819..d1ea7706b9 100644
--- a/tests/auto/gui/painting/qregion/tst_qregion.cpp
+++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp
@@ -33,9 +33,6 @@
#include <qbitmap.h>
#include <qpainter.h>
#include <qpolygon.h>
-#if 0 // Used to be included in Qt4 for Q_WS_X11
-#include <private/qt_x11_p.h>
-#endif
class tst_QRegion : public QObject
{
@@ -79,9 +76,6 @@ private slots:
void isEmpty_data();
void isEmpty();
-#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && defined(QT_BUILD_INTERNAL)
- void clipRectangles();
-#endif
void regionFromPath();
void scaleRegions_data();
@@ -910,24 +904,6 @@ void tst_QRegion::isEmpty()
#endif
}
-#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && defined(QT_BUILD_INTERNAL)
-void tst_QRegion::clipRectangles()
-{
- QRegion region(30, 30, 30, 30);
- int num = 0;
- qt_getClipRects(region, num);
- QCOMPARE(num, 1);
-
- region += QRegion(10, 10, 10, 10);
- XRectangle *rects2 = static_cast<XRectangle *>(qt_getClipRects(region, num));
- QCOMPARE(num, 2);
-
- // Here's the important part (Y-sorted):
- QCOMPARE(int(rects2[0].y), 10);
- QCOMPARE(int(rects2[1].y), 30);
-}
-#endif
-
void tst_QRegion::regionFromPath()
{
{
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 7dbeb13aa7..7764a716ca 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -78,6 +78,8 @@ private slots:
void extractBorder();
void noTextDecoration();
void quotedAndUnquotedIdentifiers();
+ void whitespaceValues_data();
+ void whitespaceValues();
};
void tst_QCssParser::scanner_data()
@@ -1746,6 +1748,33 @@ void tst_QCssParser::quotedAndUnquotedIdentifiers()
QCOMPARE(decls.at(1).d->values.first().toString(), QLatin1String("bold"));
}
+void tst_QCssParser::whitespaceValues_data()
+{
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("normal") << "normal";
+ QTest::newRow("inherit") << "inherit";
+ QTest::newRow("nowrap") << "nowrap";
+ QTest::newRow("pre") << "pre";
+ QTest::newRow("pre-wrap") << "pre-wrap";
+ QTest::newRow("pre-line") << "pre-line";
+}
+
+void tst_QCssParser::whitespaceValues()
+{
+ QFETCH(QString, value);
+ QCss::Parser parser(QString("foo { white-space: %1 }").arg(value));
+ QCss::StyleSheet sheet;
+ QVERIFY(parser.parse(&sheet));
+
+ QCss::StyleRule rule = (!sheet.styleRules.isEmpty()) ?
+ sheet.styleRules.at(0) : *sheet.nameIndex.begin();
+ QCOMPARE(rule.declarations.size(), 1);
+
+ QCOMPARE(rule.declarations.at(0).d->property, QLatin1String("white-space"));
+ QCOMPARE(rule.declarations.at(0).d->values.first().toString(), value);
+}
+
QTEST_MAIN(tst_QCssParser)
#include "tst_qcssparser.moc"
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 591fafc7fb..52e56feb5a 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -50,6 +50,7 @@
#include <QDomDocument>
#include "common.h"
+// #define DEBUG_WRITE_OUTPUT
QT_FORWARD_DECLARE_CLASS(QTextDocument)
@@ -191,10 +192,12 @@ private slots:
void fontTagFace();
+ void clearUndoRedoStacks();
private:
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
void buildRegExpData();
static QString cssFontSizeString(const QFont &font);
+ void writeActualAndExpected(const char* testTag, const QString &actual, const QString &expected);
QTextDocument *doc;
QTextCursor cursor;
@@ -223,6 +226,27 @@ QString tst_QTextDocument::cssFontSizeString(const QFont &font)
: QString::number(font.pixelSize()) + QStringLiteral("px");
}
+void tst_QTextDocument::writeActualAndExpected(const char *testTag, const QString &actual, const QString &expected)
+{
+#ifdef DEBUG_WRITE_OUTPUT
+ {
+ QFile out(QDir::temp().absoluteFilePath(QLatin1String(testTag) + QLatin1String("-actual.html")));
+ out.open(QFile::WriteOnly);
+ out.write(actual.toUtf8());
+ out.close();
+ } {
+ QFile out(QDir::temp().absoluteFilePath(QLatin1String(testTag) + QLatin1String("-expected.html")));
+ out.open(QFile::WriteOnly);
+ out.write(expected.toUtf8());
+ out.close();
+ }
+#else
+ Q_UNUSED(testTag)
+ Q_UNUSED(actual)
+ Q_UNUSED(expected)
+#endif
+}
+
// Testing get/set functions
void tst_QTextDocument::getSetCheck()
{
@@ -1764,6 +1788,8 @@ void tst_QTextDocument::toHtml()
QString output = doc->toHtml();
+ writeActualAndExpected(QTest::currentDataTag(), output, expectedOutput);
+
QCOMPARE(output, expectedOutput);
QDomDocument document;
@@ -1961,6 +1987,8 @@ void tst_QTextDocument::toHtmlRootFrameProperties()
expectedOutput.replace("DEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"");
expectedOutput.append(htmlTail);
+ writeActualAndExpected(QTest::currentTestFunction(), doc.toHtml(), expectedOutput);
+
QCOMPARE(doc.toHtml(), expectedOutput);
}
@@ -2733,6 +2761,8 @@ void tst_QTextDocument::backgroundImage_checkExpectedHtml(const QTextDocument &d
.arg(defaultFont.weight() * 8)
.arg((defaultFont.italic() ? "italic" : "normal"));
+ writeActualAndExpected(QTest::currentTestFunction(), doc.toHtml(), expectedHtml);
+
QCOMPARE(doc.toHtml(), expectedHtml);
}
@@ -3522,5 +3552,16 @@ void tst_QTextDocument::fontTagFace()
}
}
+void tst_QTextDocument::clearUndoRedoStacks()
+{
+ QTextDocument doc;
+ QTextCursor c(&doc);
+ c.insertText(QStringLiteral("lorem ipsum"));
+ QVERIFY(doc.isUndoAvailable());
+ doc.clearUndoRedoStacks(QTextDocument::UndoStack); // Don't crash
+ QVERIFY(!doc.isUndoAvailable());
+}
+
+
QTEST_MAIN(tst_QTextDocument)
#include "tst_qtextdocument.moc"
diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
index 664ca98a3f..b6917f1208 100644
--- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
+++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
@@ -181,6 +181,11 @@ private slots:
void html_tableCellBackground();
void css_bodyBackground();
void css_tableCellBackground();
+ void css_tableCellBorder();
+ void css_tableCellBorderShorthand();
+ void css_tableCellAllBordersShorthand();
+ void css_tableCellOverrideOneBorder();
+ void css_tableBorderCollapse();
void css_fontWeight();
void css_float();
void css_textIndent();
@@ -1272,11 +1277,11 @@ void tst_QTextDocumentFragment::html_whitespace_data()
QTest::newRow("2") << QString("<span> </span><span>nowhitespacehereplease</span>")
<< QString::fromLatin1("nowhitespacehereplease");
- QTest::newRow("3") << QString("<span style=\"white-space: pre;\"> white space here </span>")
- << QString::fromLatin1(" white space here ");
+ QTest::newRow("3") << QString("<span style=\"white-space: pre;\"> white space \n\n here </span>")
+ << QString::fromLatin1(" white space \n\n here ");
- QTest::newRow("4") << QString("<span style=\"white-space: pre-wrap;\"> white space here </span>")
- << QString::fromLatin1(" white space here ");
+ QTest::newRow("4") << QString("<span style=\"white-space: pre-wrap;\"> white space \n\n here </span>")
+ << QString::fromLatin1(" white space \n\n here ");
QTest::newRow("5") << QString("<a href=\"One.html\">One</a> <a href=\"Two.html\">Two</a> <b>Three</b>\n"
"<b>Four</b>")
@@ -1291,6 +1296,12 @@ void tst_QTextDocumentFragment::html_whitespace_data()
QTest::newRow("8") << QString("<table><tr><td><i>Blah</i></td></tr></table> <i>Blub</i>")
<< QString("\nBlah\nBlub");
+ QTest::newRow("9") << QString("<span style=\"white-space: nowrap;\"> white space \n\n here </span>")
+ << QString::fromLatin1("white space here ");
+
+ QTest::newRow("10") << QString("<span style=\"white-space: pre-line;\"> white space \n\n here </span>")
+ << QString::fromLatin1("white space\n\nhere ");
+
QTest::newRow("task116492") << QString("<p>a<font=\"Times\"> b </font>c</p>")
<< QString("a b c");
@@ -1747,6 +1758,135 @@ void tst_QTextDocumentFragment::css_tableCellBackground()
QCOMPARE(cell.format().background().style(), Qt::TexturePattern);
}
+void tst_QTextDocumentFragment::css_tableCellBorder()
+{
+ const char html[] = "<body><table><tr><td style=\"border-width:8px;border-color:green;border-style:groove;border-left-style:dashed;border-left-color:red;border-left-width:4px\">Foo</td></tr></table></body>";
+ doc->setHtml(html);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::NextBlock);
+ QTextTable *table = cursor.currentTable();
+ QVERIFY(table);
+
+ QTextTableCell cell = table->cellAt(0, 0);
+ QTextTableCellFormat cellFormat = cell.format().toTableCellFormat();
+ QCOMPARE(cellFormat.leftBorder(), qreal(4));
+ QCOMPARE(cellFormat.leftBorderBrush(), QBrush(QColor("red")));
+ QCOMPARE(cellFormat.leftBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.rightBorder(), qreal(8));
+ QCOMPARE(cellFormat.rightBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.rightBorderStyle(), QTextFrameFormat::BorderStyle_Groove);
+
+ QCOMPARE(cellFormat.bottomBorder(), qreal(8));
+ QCOMPARE(cellFormat.bottomBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.bottomBorderStyle(), QTextFrameFormat::BorderStyle_Groove);
+
+ QCOMPARE(cellFormat.topBorder(), qreal(8));
+ QCOMPARE(cellFormat.topBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.topBorderStyle(), QTextFrameFormat::BorderStyle_Groove);
+}
+
+void tst_QTextDocumentFragment::css_tableCellBorderShorthand()
+{
+ const char html[] = "<body><table><tr><td style=\"border-left:1px solid green;border-right:2px dashed red;border-bottom:3px dotted yellow;border-top:4px dot-dash blue\">Foo</td></tr></table></body>";
+ doc->setHtml(html);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::NextBlock);
+ QTextTable *table = cursor.currentTable();
+ QVERIFY(table);
+
+ QTextTableCell cell = table->cellAt(0, 0);
+ QTextTableCellFormat cellFormat = cell.format().toTableCellFormat();
+ QCOMPARE(cellFormat.leftBorder(), qreal(1));
+ QCOMPARE(cellFormat.leftBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.leftBorderStyle(), QTextFrameFormat::BorderStyle_Solid);
+
+ QCOMPARE(cellFormat.rightBorder(), qreal(2));
+ QCOMPARE(cellFormat.rightBorderBrush(), QBrush(QColor("red")));
+ QCOMPARE(cellFormat.rightBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.bottomBorder(), qreal(3));
+ QCOMPARE(cellFormat.bottomBorderBrush(), QBrush(QColor("yellow")));
+ QCOMPARE(cellFormat.bottomBorderStyle(), QTextFrameFormat::BorderStyle_Dotted);
+
+ QCOMPARE(cellFormat.topBorder(), qreal(4));
+ QCOMPARE(cellFormat.topBorderBrush(), QBrush(QColor("blue")));
+ QCOMPARE(cellFormat.topBorderStyle(), QTextFrameFormat::BorderStyle_DotDash);
+}
+
+void tst_QTextDocumentFragment::css_tableCellAllBordersShorthand()
+{
+ const char html[] = "<body><table><tr><td style=\"border:2px dashed green\">Foo</td></tr></table></body>";
+ doc->setHtml(html);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::NextBlock);
+ QTextTable *table = cursor.currentTable();
+ QVERIFY(table);
+
+ QTextTableCell cell = table->cellAt(0, 0);
+ QTextTableCellFormat cellFormat = cell.format().toTableCellFormat();
+ QCOMPARE(cellFormat.leftBorder(), qreal(2));
+ QCOMPARE(cellFormat.leftBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.leftBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.rightBorder(), qreal(2));
+ QCOMPARE(cellFormat.rightBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.rightBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.bottomBorder(), qreal(2));
+ QCOMPARE(cellFormat.bottomBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.bottomBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.topBorder(), qreal(2));
+ QCOMPARE(cellFormat.topBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.topBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+}
+
+void tst_QTextDocumentFragment::css_tableCellOverrideOneBorder()
+{
+ const char html[] = "<body><table><tr><td style=\"border:2px dashed green;border-left:4px solid red\">Foo</td></tr></table></body>";
+ doc->setHtml(html);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::NextBlock);
+ QTextTable *table = cursor.currentTable();
+ QVERIFY(table);
+
+ QTextTableCell cell = table->cellAt(0, 0);
+ QTextTableCellFormat cellFormat = cell.format().toTableCellFormat();
+ QCOMPARE(cellFormat.leftBorder(), qreal(4));
+ QCOMPARE(cellFormat.leftBorderBrush(), QBrush(QColor("red")));
+ QCOMPARE(cellFormat.leftBorderStyle(), QTextFrameFormat::BorderStyle_Solid);
+
+ QCOMPARE(cellFormat.rightBorder(), qreal(2));
+ QCOMPARE(cellFormat.rightBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.rightBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.bottomBorder(), qreal(2));
+ QCOMPARE(cellFormat.bottomBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.bottomBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+
+ QCOMPARE(cellFormat.topBorder(), qreal(2));
+ QCOMPARE(cellFormat.topBorderBrush(), QBrush(QColor("green")));
+ QCOMPARE(cellFormat.topBorderStyle(), QTextFrameFormat::BorderStyle_Dashed);
+}
+
+void tst_QTextDocumentFragment::css_tableBorderCollapse()
+{
+ const char html[] = "<body><table style=\"border-collapse:collapse\"><tr><td>Foo</td></tr></table></body>";
+ doc->setHtml(html);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::NextBlock);
+ QTextTable *table = cursor.currentTable();
+ QVERIFY(table);
+
+ QCOMPARE(table->format().borderCollapse(), true);
+}
+
void tst_QTextDocumentFragment::css_cellPaddings()
{
const char html[] = "<body><table><tr><td style=\"padding-left:1\">Foo</td>"
diff --git a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp
index f21b969aa7..7b2ff4cc10 100644
--- a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp
+++ b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp
@@ -50,6 +50,8 @@ typedef QList<int> IntList;
QT_FORWARD_DECLARE_CLASS(QTextDocument)
+Q_DECLARE_METATYPE(QTextFrameFormat::BorderStyle);
+
class tst_QTextTable : public QObject
{
Q_OBJECT
@@ -95,6 +97,8 @@ private slots:
#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL)
void QTBUG31330_renderBackground();
#endif
+ void checkBorderAttributes_data();
+ void checkBorderAttributes();
private:
QTextTable *create2x2Table();
@@ -1170,5 +1174,109 @@ void tst_QTextTable::QTBUG31330_renderBackground()
}
#endif
+void tst_QTextTable::checkBorderAttributes_data()
+{
+ QTest::addColumn<QString>("html");
+ QTest::addColumn<qreal>("topBorderWidth");
+ QTest::addColumn<qreal>("bottomBorderWidth");
+ QTest::addColumn<qreal>("leftBorderWidth");
+ QTest::addColumn<qreal>("rightBorderWidth");
+ QTest::addColumn<QTextFrameFormat::BorderStyle>("topBorderStyle");
+ QTest::addColumn<QTextFrameFormat::BorderStyle>("bottomBorderStyle");
+ QTest::addColumn<QTextFrameFormat::BorderStyle>("leftBorderStyle");
+ QTest::addColumn<QTextFrameFormat::BorderStyle>("rightBorderStyle");
+ QTest::addColumn<QBrush>("topBorderBrush");
+ QTest::addColumn<QBrush>("bottomBorderBrush");
+ QTest::addColumn<QBrush>("leftBorderBrush");
+ QTest::addColumn<QBrush>("rightBorderBrush");
+
+ const QString tableHtmlStart = QStringLiteral("<html><head><style>");
+ const QString tableHtmlEnd = QStringLiteral("</style></head><body>"
+ "<table border=\"1\"><tr><td>One</td><td>Two</td></tr>"
+ "<tr><td>Three</td><td>Four</td></tr></table></body></html>");
+ QTest::newRow("1px-solid-colors")
+ << QString("%1"
+ "td {"
+ "border-top: 1px solid red;"
+ "border-bottom: 1px solid blue;"
+ "border-left: 1px solid green;"
+ "border-right: 1px solid yellow;"
+ "}"
+ "%2").arg(tableHtmlStart).arg(tableHtmlEnd)
+ << 1.0 << 1.0 << 1.0 << 1.0
+ << QTextFrameFormat::BorderStyle_Solid << QTextFrameFormat::BorderStyle_Solid
+ << QTextFrameFormat::BorderStyle_Solid << QTextFrameFormat::BorderStyle_Solid
+ << QBrush(Qt::red) << QBrush(Qt::blue) << QBrush(Qt::darkGreen) << QBrush(Qt::yellow);
+ QTest::newRow("MixedWidth-solid-colors")
+ << QString("%1"
+ "td {"
+ "border-top: 1px solid red;"
+ "border-bottom: 2px solid blue;"
+ "border-left: 3px solid green;"
+ "border-right: 4px solid yellow;"
+ "}"
+ "%2").arg(tableHtmlStart).arg(tableHtmlEnd)
+ << 1.0 << 2.0 << 3.0 << 4.0
+ << QTextFrameFormat::BorderStyle_Solid << QTextFrameFormat::BorderStyle_Solid
+ << QTextFrameFormat::BorderStyle_Solid << QTextFrameFormat::BorderStyle_Solid
+ << QBrush(Qt::red) << QBrush(Qt::blue) << QBrush(Qt::darkGreen) << QBrush(Qt::yellow);
+ QTest::newRow("MixedWidth-MixedStyle-colors")
+ << QString("%1"
+ "td {"
+ "border-top: 1px solid red;"
+ "border-bottom: 2px dotted blue;"
+ "border-left: 3px dashed green;"
+ "border-right: 4px inset yellow;"
+ "}"
+ "%2").arg(tableHtmlStart).arg(tableHtmlEnd)
+ << 1.0 << 2.0 << 3.0 << 4.0
+ << QTextFrameFormat::BorderStyle_Solid << QTextFrameFormat::BorderStyle_Dotted
+ << QTextFrameFormat::BorderStyle_Dashed << QTextFrameFormat::BorderStyle_Inset
+ << QBrush(Qt::red) << QBrush(Qt::blue) << QBrush(Qt::darkGreen) << QBrush(Qt::yellow);
+}
+
+void tst_QTextTable::checkBorderAttributes()
+{
+ QFETCH(QString, html);
+ QFETCH(qreal, topBorderWidth);
+ QFETCH(qreal, bottomBorderWidth);
+ QFETCH(qreal, leftBorderWidth);
+ QFETCH(qreal, rightBorderWidth);
+ QFETCH(QTextFrameFormat::BorderStyle, topBorderStyle);
+ QFETCH(QTextFrameFormat::BorderStyle, bottomBorderStyle);
+ QFETCH(QTextFrameFormat::BorderStyle, leftBorderStyle);
+ QFETCH(QTextFrameFormat::BorderStyle, rightBorderStyle);
+ QFETCH(QBrush, topBorderBrush);
+ QFETCH(QBrush, bottomBorderBrush);
+ QFETCH(QBrush, leftBorderBrush);
+ QFETCH(QBrush, rightBorderBrush);
+
+ QTextDocument doc;
+ doc.setHtml(html);
+ QTextCursor cursor(doc.firstBlock());
+ cursor.movePosition(QTextCursor::Right);
+
+ QTextTable *currentTable = cursor.currentTable();
+ QVERIFY(currentTable);
+ for (int row = 0; row < 2; row++) {
+ for (int column = 0; column < 2; column++) {
+ QTextTableCell cell = currentTable->cellAt(row, column);
+ QTextCharFormat cellFormat = cell.format();
+ QCOMPARE(cellFormat.doubleProperty(QTextFormat::TableCellTopBorder), topBorderWidth);
+ QCOMPARE(cellFormat.doubleProperty(QTextFormat::TableCellBottomBorder), bottomBorderWidth);
+ QCOMPARE(cellFormat.doubleProperty(QTextFormat::TableCellLeftBorder), leftBorderWidth);
+ QCOMPARE(cellFormat.doubleProperty(QTextFormat::TableCellRightBorder), rightBorderWidth);
+ QCOMPARE(cellFormat.property(QTextFormat::TableCellTopBorderStyle), topBorderStyle);
+ QCOMPARE(cellFormat.property(QTextFormat::TableCellBottomBorderStyle), bottomBorderStyle);
+ QCOMPARE(cellFormat.property(QTextFormat::TableCellLeftBorderStyle), leftBorderStyle);
+ QCOMPARE(cellFormat.property(QTextFormat::TableCellRightBorderStyle), rightBorderStyle);
+ QCOMPARE(cellFormat.brushProperty(QTextFormat::TableCellTopBorderBrush), topBorderBrush);
+ QCOMPARE(cellFormat.brushProperty(QTextFormat::TableCellBottomBorderBrush), bottomBorderBrush);
+ QCOMPARE(cellFormat.brushProperty(QTextFormat::TableCellLeftBorderBrush), leftBorderBrush);
+ QCOMPARE(cellFormat.brushProperty(QTextFormat::TableCellRightBorderBrush), rightBorderBrush);
+ }
+ }
+}
+
QTEST_MAIN(tst_QTextTable)
#include "tst_qtexttable.moc"