From 9e97d64ccd27adcb2053c90cfbcafaef68e53893 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 12 Mar 2019 11:59:58 +0100 Subject: Fix installation of .pdb files for applications that have VERSION set For applications that set VERSION the installation targets of pdb files were wrong in qmake's nmake Makefile generator. Replace code that tries to reconstruct that target's versioned extension with TARGET_EXT which already contains the fully resolved target extension. Fixes: QTBUG-74265 Change-Id: I9553a5f70170e077a59c866079ae51647ae80bef Reviewed-by: Oliver Wolff --- tests/auto/tools/qmake/tst_qmake.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 1eaf66311c..cacee30c86 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -244,7 +244,6 @@ void tst_qmake::simple_app_versioned() QVERIFY2(QFile::exists(pdbFilePath), qPrintable(pdbFilePath)); QVERIFY(test_compiler.make(buildDir, "install")); QString installedPdbFilePath = installDir + '/' + targetBase + ".pdb"; - QEXPECT_FAIL("", "QTBUG-74265", Continue); QVERIFY2(QFile::exists(installedPdbFilePath), qPrintable(installedPdbFilePath)); } @@ -252,10 +251,8 @@ void tst_qmake::simple_app_versioned() QVERIFY(test_compiler.exists(destDir, "simple app", Exe, version)); QVERIFY(test_compiler.makeDistClean(buildDir)); QVERIFY(!test_compiler.exists(destDir, "simple app", Exe, version)); - if (checkPdb) { - QEXPECT_FAIL("", "QTBUG-74265", Continue); + if (checkPdb) QVERIFY(!QFile::exists(pdbFilePath)); - } QVERIFY(test_compiler.removeMakefile(buildDir)); } -- cgit v1.2.3 From 3b7db8ac90ba36949cb4168f07cc8dace47758a7 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 29 Mar 2019 10:36:21 +0100 Subject: Fix assert/crash when creating QBrush with null QGradient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QBrush constructor taking a QGradient would assert or crash if passed a null (NoGradient) gradient. But it is not necessary for the API to be as brittle as that: instead the result can simply be a null QBrush object, i.e. the same as the default QBrush() constructor creates (style == NoBrush). This issue comes up now since with the recent introduction of QGradient presets, the API opens for using QGradient directly, whereas earlier, only the subclasses QLinearGradient etc. were to be used. Fixes: QTBUG-74648 Change-Id: I1a9b1c4654e4375aa6684700a262cc0946851448 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/painting/qbrush/tst_qbrush.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp index cd3eaa1478..ce6ce15767 100644 --- a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp +++ b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp @@ -345,6 +345,8 @@ void tst_QBrush::gradientPresets() QGradient invalidPreset(QGradient::Preset(-1)); QCOMPARE(invalidPreset.type(), QGradient::NoGradient); + QBrush brush(invalidPreset); + QCOMPARE(brush.style(), Qt::NoBrush); } void fill(QPaintDevice *pd) { -- cgit v1.2.3 From 954b73445cfbfef01207d51d1b986c6dd796c6d0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 1 Apr 2019 15:22:15 +0200 Subject: Refine underflow check in QLocaleData::convertDoubleToFloat() A string can parse as a non-zero double that's smaller than the smallest float yet be a faithful representation of the smallest float. So rather than testing for non-zero doubles less than the smallest float, test for non-zero doubles that cast to float zero; these underflow. This means small values close below the smallest float shall round up to it, rather than down to zero, requiring a tweak to an existing test. Added a test for the boundary case (and tidied the test data). Fixes: QTBUG-74833 Change-Id: I4cb30b3c0e54683574b98253505607caaf88fbfb Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 5d344834e6..279ee2e8a0 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -952,29 +952,42 @@ void tst_QLocale::stringToDouble() void tst_QLocale::stringToFloat_data() { + using Bounds = std::numeric_limits; toReal_data(); - if (std::numeric_limits::has_infinity) { - double huge = std::numeric_limits::infinity(); - QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge; - QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge; - QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge; + const QString C(QStringLiteral("C")); + if (Bounds::has_infinity) { + double huge = Bounds::infinity(); + QTest::newRow("C inf") << C << QString("inf") << true << huge; + QTest::newRow("C +inf") << C << QString("+inf") << true << +huge; + QTest::newRow("C -inf") << C << QString("-inf") << true << -huge; // Overflow float, but not double: - QTest::newRow("C big") << QString("C") << QString("3.5e38") << false << huge; - QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << false << -huge; + QTest::newRow("C big") << C << QString("3.5e38") << false << huge; + QTest::newRow("C -big") << C << QString("-3.5e38") << false << -huge; // Overflow double, too: - QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge; - QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge; + QTest::newRow("C huge") << C << QString("2e308") << false << huge; + QTest::newRow("C -huge") << C << QString("-2e308") << false << -huge; } - if (std::numeric_limits::has_quiet_NaN) - QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << double(std::numeric_limits::quiet_NaN()); + if (Bounds::has_quiet_NaN) + QTest::newRow("C qnan") << C << QString("NaN") << true << double(Bounds::quiet_NaN()); + + // Minimal float: shouldn't underflow + QTest::newRow("C float min") + << C << QLocale::c().toString(Bounds::denorm_min()) << true << double(Bounds::denorm_min()); + QTest::newRow("C float -min") + << C << QLocale::c().toString(-Bounds::denorm_min()) << true << -double(Bounds::denorm_min()); // Underflow float, but not double: - QTest::newRow("C small") << QString("C") << QString("1e-45") << false << 0.; - QTest::newRow("C -small") << QString("C") << QString("-1e-45") << false << 0.; + QTest::newRow("C small") << C << QString("7e-46") << false << 0.; + QTest::newRow("C -small") << C << QString("-7e-46") << false << 0.; + using Double = std::numeric_limits; + QTest::newRow("C double min") + << C << QLocale::c().toString(Double::denorm_min()) << false << 0.0; + QTest::newRow("C double -min") + << C << QLocale::c().toString(-Double::denorm_min()) << false << 0.0; // Underflow double, too: - QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.; - QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.; + QTest::newRow("C tiny") << C << QString("2e-324") << false << 0.; + QTest::newRow("C -tiny") << C << QString("-2e-324") << false << 0.; } void tst_QLocale::stringToFloat() -- cgit v1.2.3 From 685b8db13aa19e734f239678bae23607fcededbd Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 28 Mar 2019 16:49:57 +0300 Subject: Forward devicePixelRatio in QPixmap::mask() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add a test checking that devicePixelRatio is forwarded to derivatives of QPixmap. Change-Id: Idb2b3f033ccc0fd49bf54b11f5dffbce5a19b006 Reviewed-by: Morten Johan Sørvig --- tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 9a338ad55a..4d31d80246 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -121,6 +121,7 @@ private slots: void copy(); void deepCopyPreservesDpr(); + void dprPassthrough(); void depthOfNullObjects(); void transformed(); @@ -1169,6 +1170,39 @@ void tst_QPixmap::deepCopyPreservesDpr() QCOMPARE(dest.devicePixelRatio(), dpr); } +void tst_QPixmap::dprPassthrough() +{ + const qreal dpr = 2; + QPixmap src(32, 32); + src.setDevicePixelRatio(dpr); + src.fill(Qt::transparent); + QCOMPARE(src.devicePixelRatio(), dpr); + + QImage img = src.toImage(); + QCOMPARE(img.devicePixelRatio(), dpr); + + QPixmap pm(1, 1); + pm.convertFromImage(img); + QCOMPARE(pm.devicePixelRatio(), dpr); + + QBitmap heuristicMask = src.createHeuristicMask(); + QCOMPARE(heuristicMask.devicePixelRatio(), dpr); + + QBitmap maskFromColor = src.createMaskFromColor(Qt::white); + QCOMPARE(maskFromColor.devicePixelRatio(), dpr); + + QBitmap mask = src.mask(); + QCOMPARE(mask.devicePixelRatio(), dpr); + + QPixmap scaled = src.scaled(16, 16); + QCOMPARE(scaled.devicePixelRatio(), dpr); + + QTransform t; + t.rotate(90); + QPixmap transformed = src.transformed(t); + QCOMPARE(transformed.devicePixelRatio(), dpr); +} + void tst_QPixmap::depthOfNullObjects() { QBitmap b1; -- cgit v1.2.3 From 011794130c8e4bb64dbc3c8c9b50849b278cdda3 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 28 Mar 2019 13:59:35 +0300 Subject: Forward physical parameters for derived QImages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit More specifically, for masks and rotated images. Add tests for it, also add tests that image metadata is forwarded for converted and copied images. Fixes: QTBUG-49259 Change-Id: I05d4a468b17f53a2625500b871c01b2c53b981a1 Reviewed-by: Morten Johan Sørvig --- tests/auto/gui/image/qimage/tst_qimage.cpp | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 6bc27a6e16..bb81b9f61f 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -3260,11 +3260,46 @@ void tst_QImage::metadataPassthrough() QCOMPARE(mirrored.dotsPerMeterY(), a.dotsPerMeterY()); QCOMPARE(mirrored.devicePixelRatio(), a.devicePixelRatio()); + QTransform t; + t.rotate(90); + QImage rotated = a.transformed(t); + QCOMPARE(rotated.text(QStringLiteral("Test")), a.text(QStringLiteral("Test"))); + QCOMPARE(rotated.dotsPerMeterX(), a.dotsPerMeterX()); + QCOMPARE(rotated.dotsPerMeterY(), a.dotsPerMeterY()); + QCOMPARE(rotated.devicePixelRatio(), a.devicePixelRatio()); + QImage swapped = a.rgbSwapped(); QCOMPARE(swapped.text(QStringLiteral("Test")), a.text(QStringLiteral("Test"))); QCOMPARE(swapped.dotsPerMeterX(), a.dotsPerMeterX()); QCOMPARE(swapped.dotsPerMeterY(), a.dotsPerMeterY()); QCOMPARE(swapped.devicePixelRatio(), a.devicePixelRatio()); + + QImage converted = a.convertToFormat(QImage::Format_RGB32); + QCOMPARE(converted.text(QStringLiteral("Test")), a.text(QStringLiteral("Test"))); + QCOMPARE(converted.dotsPerMeterX(), a.dotsPerMeterX()); + QCOMPARE(converted.dotsPerMeterY(), a.dotsPerMeterY()); + QCOMPARE(converted.devicePixelRatio(), a.devicePixelRatio()); + + QImage copied = a.copy(0, 0, a.width() / 2, a.height() / 2); + QCOMPARE(copied.text(QStringLiteral("Test")), a.text(QStringLiteral("Test"))); + QCOMPARE(copied.dotsPerMeterX(), a.dotsPerMeterX()); + QCOMPARE(copied.dotsPerMeterY(), a.dotsPerMeterY()); + QCOMPARE(copied.devicePixelRatio(), a.devicePixelRatio()); + + QImage alphaMask = a.createAlphaMask(); + QCOMPARE(alphaMask.dotsPerMeterX(), a.dotsPerMeterX()); + QCOMPARE(alphaMask.dotsPerMeterY(), a.dotsPerMeterY()); + QCOMPARE(alphaMask.devicePixelRatio(), a.devicePixelRatio()); + + QImage heuristicMask = a.createHeuristicMask(); + QCOMPARE(heuristicMask.dotsPerMeterX(), a.dotsPerMeterX()); + QCOMPARE(heuristicMask.dotsPerMeterY(), a.dotsPerMeterY()); + QCOMPARE(heuristicMask.devicePixelRatio(), a.devicePixelRatio()); + + QImage maskFromColor = a.createMaskFromColor(qRgb(0, 0, 0)); + QCOMPARE(maskFromColor.dotsPerMeterX(), a.dotsPerMeterX()); + QCOMPARE(maskFromColor.dotsPerMeterY(), a.dotsPerMeterY()); + QCOMPARE(maskFromColor.devicePixelRatio(), a.devicePixelRatio()); } void tst_QImage::pixelColor() -- cgit v1.2.3