From c76b86aec64c4098434340ec17a26d7b2a32338e Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Sun, 4 Aug 2019 08:42:26 +0300 Subject: BLACKLIST contains_QPointF for msvc-2019 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-77312 Change-Id: I5197d160d9b3c70b538c2e5a43c31120e1bed5f0 Reviewed-by: Tony Sarajärvi --- tests/auto/gui/painting/qpainterpath/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/gui/painting/qpainterpath/BLACKLIST (limited to 'tests/auto/gui/painting') 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 -- cgit v1.2.3 From ce73b4db62574fc966192e6a4f65b7e2b2280e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 20 Aug 2019 14:26:05 +0200 Subject: Remove dead code from Qt 4 times MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The benefit of keeping this code around was to inspire or inform changes in the areas to take into account possibly missing features in Qt 5, but at this point that benefit is questionable. We can always use the history to learn about missing pieces if needed. Change-Id: I87a02dc451e9027be9b97554427bf8a1c6b2c025 Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 60 ----------------------- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 5 -- tests/auto/gui/painting/qregion/tst_qregion.cpp | 24 --------- 3 files changed, 89 deletions(-) (limited to 'tests/auto/gui/painting') diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 90a216e14a..c1c231089a 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -111,10 +111,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 @@ -1460,62 +1456,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/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 0efeb9b356..4cf23455e1 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(); 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 #include #include -#if 0 // Used to be included in Qt4 for Q_WS_X11 -#include -#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(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() { { -- cgit v1.2.3 From 5d94aac2bae8bdbf8de7cebeb6a1a17a81685f0a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 4 Jul 2019 15:17:29 +0200 Subject: Introduce QImage::Format_BGR888 Is pretty common on some architectures so we can avoid swizzling by supporting it. Fixes: QTBUG-45671 Change-Id: Ic7a21b5bfb374bf7496fd2b2b1252c2f1ed47705 Reviewed-by: Eirik Aavitsland --- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/gui/painting') diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 0efeb9b356..61867ec65a 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -1637,6 +1637,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; } -- cgit v1.2.3 From 77de5a329c98c3787725cb3c0a50d8f369b9479c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 28 Aug 2014 22:37:13 +0200 Subject: Long live QColorConstants! QColorConstant is a C++11 version of Qt::GlobalColor, except that instead of Qt::red being an enum, QColorConstants::red is an actual QColor instance, a bit like in the Qt 3 days. In addition, the SVG names that QColor understands are also available, with the same values. Technically, when building a QColor from a color name, QColor ignores casing and whitespaces; we stick to the SVG/CSS official color names (which are lowercase), and prefix them with Svg to clarify where they come from. For instance, note how SVG's gray is not Qt::gray. [ChangeLog][QtGui][[QColor] Added QColorConstants, a namespace containing constexpr QColor instances. Change-Id: Ic9fab26a9a537fcc43cc230da28f4c6314a32438 Reviewed-by: Marc Mutz --- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 189 ++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) (limited to 'tests/auto/gui/painting') diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 90a216e14a..6c66519dce 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(); @@ -368,6 +372,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("color"); + QTest::addColumn("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)) */ -- cgit v1.2.3 From c8d3eb35e73e650e73fcc47c78af6d86ff58bfd9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 12 Jul 2019 15:02:09 +0200 Subject: Fixup move semantics of QColorSpace Stop using QExplicitlySharedDataPointer, makes it possible to inline the move constructor and assign operator. Also protect other methods from nullptr d_ptr, and change the default constructed value to also have a null d_ptr, to match the result after a move. Change-Id: I40928feef90cc956ef84d0516a77b0ee0f8986c7 Reviewed-by: Allan Sandfeld Jensen --- .../gui/painting/qcolorspace/tst_qcolorspace.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto/gui/painting') 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("colorSpaceId"); -- cgit v1.2.3