[poppler] qt5/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 22 21:55:12 UTC 2020


 qt5/tests/check_search.cpp         |   68 ++++++++++++++++++-------------------
 qt5/tests/check_utf_conversion.cpp |    2 -
 2 files changed, 35 insertions(+), 35 deletions(-)

New commits:
commit e10b0a88bc8182710fd98a919740e349426386f4
Author: Albert Astals Cid <tsdgeos at yahoo.es>
Date:   Sat Aug 22 21:55:10 2020 +0000

    qt: MSVC test fixes

diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp
index 17aab930..506588d2 100644
--- a/qt5/tests/check_search.cpp
+++ b/qt5/tests/check_search.cpp
@@ -26,12 +26,12 @@ void TestSearch::bug7063()
 
     double rectLeft = 0.0, rectTop = 0.0, rectRight = page->pageSizeF().width(), rectBottom = page->pageSizeF().height();
 
-    QCOMPARE(page->search(QStringLiteral("non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
+    QCOMPARE(page->search(QStringLiteral(u"non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
 
-    QCOMPARE(page->search(QStringLiteral("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
-    QCOMPARE(page->search(QStringLiteral("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::IgnoreCase), true);
+    QCOMPARE(page->search(QStringLiteral(u"Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
+    QCOMPARE(page->search(QStringLiteral(u"Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::IgnoreCase), true);
 
-    QCOMPARE(page->search(QStringLiteral("latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
+    QCOMPARE(page->search(QStringLiteral(u"latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
 
     QCOMPARE(page->search(QString::fromUtf8("é"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true); // clazy:exclude=qstring-allocations
     QCOMPARE(page->search(QString::fromUtf8("à"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true); // clazy:exclude=qstring-allocations
@@ -40,12 +40,12 @@ void TestSearch::bug7063()
     QCOMPARE(page->search(QString::fromUtf8("¥µ©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true); // clazy:exclude=qstring-allocations
     QCOMPARE(page->search(QString::fromUtf8("¥©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false); // clazy:exclude=qstring-allocations
 
-    QCOMPARE(page->search(QStringLiteral("non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
+    QCOMPARE(page->search(QStringLiteral(u"non-ascii:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
 
-    QCOMPARE(page->search(QStringLiteral("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
-    QCOMPARE(page->search(QStringLiteral("Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::IgnoreCase), true);
+    QCOMPARE(page->search(QStringLiteral(u"Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
+    QCOMPARE(page->search(QStringLiteral(u"Ascii"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop, Poppler::Page::IgnoreCase), true);
 
-    QCOMPARE(page->search(QStringLiteral("latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
+    QCOMPARE(page->search(QStringLiteral(u"latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false);
 
     QCOMPARE(page->search(QString::fromUtf8("é"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true); // clazy:exclude=qstring-allocations
     QCOMPARE(page->search(QString::fromUtf8("à"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true); // clazy:exclude=qstring-allocations
@@ -65,83 +65,83 @@ void TestSearch::testNextAndPrevious()
 
     double rectLeft = 0.0, rectTop = 0.0, rectRight = page->pageSizeF().width(), rectBottom = page->pageSizeF().height();
 
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
     QVERIFY(qAbs(rectLeft - 171.46) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 139.81) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
     QVERIFY(qAbs(rectLeft - 171.46) < 0.01);
     QVERIFY(qAbs(rectTop - 139.81) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), false);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), false);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 139.81) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
     QVERIFY(qAbs(rectLeft - 171.46) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), false);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), false);
 
     rectLeft = 0.0, rectTop = 0.0, rectRight = page->pageSizeF().width(), rectBottom = page->pageSizeF().height();
 
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
     QVERIFY(qAbs(rectLeft - 171.46) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 139.81) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), true);
     QVERIFY(qAbs(rectLeft - 171.46) < 0.01);
     QVERIFY(qAbs(rectTop - 139.81) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), false);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::NextResult), false);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 139.81) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
     QVERIFY(qAbs(rectLeft - 171.46) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), true);
     QVERIFY(qAbs(rectLeft - 161.44) < 0.01);
     QVERIFY(qAbs(rectTop - 127.85) < 0.01);
     QVERIFY(qAbs(rectRight - rectLeft - 6.70) < 0.01);
     QVERIFY(qAbs(rectBottom - rectTop - 8.85) < 0.01);
-    QCOMPARE(page->search(QStringLiteral("is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), false);
+    QCOMPARE(page->search(QStringLiteral(u"is"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::PreviousResult), false);
 }
 
 void TestSearch::testWholeWordsOnly()
@@ -161,17 +161,17 @@ void TestSearch::testWholeWordsOnly()
 
     double left, top, right, bottom;
 
-    QCOMPARE(page->search(QStringLiteral("brown"), left, top, right, bottom, direction, mode0), true);
-    QCOMPARE(page->search(QStringLiteral("brOwn"), left, top, right, bottom, direction, mode0), false);
+    QCOMPARE(page->search(QStringLiteral(u"brown"), left, top, right, bottom, direction, mode0), true);
+    QCOMPARE(page->search(QStringLiteral(u"brOwn"), left, top, right, bottom, direction, mode0), false);
 
-    QCOMPARE(page->search(QStringLiteral("brOwn"), left, top, right, bottom, direction, mode1), true);
-    QCOMPARE(page->search(QStringLiteral("brawn"), left, top, right, bottom, direction, mode1), false);
+    QCOMPARE(page->search(QStringLiteral(u"brOwn"), left, top, right, bottom, direction, mode1), true);
+    QCOMPARE(page->search(QStringLiteral(u"brawn"), left, top, right, bottom, direction, mode1), false);
 
-    QCOMPARE(page->search(QStringLiteral("brown"), left, top, right, bottom, direction, mode2), true);
-    QCOMPARE(page->search(QStringLiteral("own"), left, top, right, bottom, direction, mode2), false);
+    QCOMPARE(page->search(QStringLiteral(u"brown"), left, top, right, bottom, direction, mode2), true);
+    QCOMPARE(page->search(QStringLiteral(u"own"), left, top, right, bottom, direction, mode2), false);
 
-    QCOMPARE(page->search(QStringLiteral("brOwn"), left, top, right, bottom, direction, mode3), true);
-    QCOMPARE(page->search(QStringLiteral("Own"), left, top, right, bottom, direction, mode3), false);
+    QCOMPARE(page->search(QStringLiteral(u"brOwn"), left, top, right, bottom, direction, mode3), true);
+    QCOMPARE(page->search(QStringLiteral(u"Own"), left, top, right, bottom, direction, mode3), false);
 }
 
 void TestSearch::testIgnoreDiacritics()
diff --git a/qt5/tests/check_utf_conversion.cpp b/qt5/tests/check_utf_conversion.cpp
index b153ae5b..8d479b70 100644
--- a/qt5/tests/check_utf_conversion.cpp
+++ b/qt5/tests/check_utf_conversion.cpp
@@ -179,7 +179,7 @@ void TestUTFConversion::testUnicodeLittleEndian()
         QCOMPARE(UCS4fromLE[i], UCS4fromBE[i]);
     }
 
-    const QString expected = QStringLiteral("HI!☑");
+    const QString expected = QString::fromUtf8("HI!☑"); // clazy:exclude=qstring-allocations
 
     // Do some final verifications, checking the strings to be "HI!"
     QVERIFY(*UCS4fromLE == *UCS4fromBE);


More information about the poppler mailing list