[poppler] qt5/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 12 00:15:47 UTC 2018


 qt5/tests/check_password.cpp |   12 ++++++------
 qt5/tests/check_search.cpp   |   24 ++++++++++++------------
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit f1575bb7352eeaf26e6e1784c9bdff708c93280d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Nov 11 23:17:46 2018 +0100

    qt5: tests, go back to fromUt8, some tests failed on MSVC
    
    And don't feel like investigating why

diff --git a/qt5/tests/check_password.cpp b/qt5/tests/check_password.cpp
index 14dc44d3..c297d856 100644
--- a/qt5/tests/check_password.cpp
+++ b/qt5/tests/check_password.cpp
@@ -21,7 +21,7 @@ private slots:
 void TestPassword::password1()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QStringLiteral(TESTDATADIR "/unittestcases/Gday garçon - open.pdf"), "", QStringLiteral("garçon").toLatin1() );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - open.pdf"), "", QString::fromUtf8("garçon").toLatin1() ); //clazy:exclude=qstring-allocations
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
 
@@ -32,10 +32,10 @@ void TestPassword::password1()
 void TestPassword::password1a()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - open.pdf") );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - open.pdf") ); //clazy:exclude=qstring-allocations
     QVERIFY( doc );
     QVERIFY( doc->isLocked() );
-    QVERIFY( !doc->unlock( "", QStringLiteral("garçon").toLatin1() ) );
+    QVERIFY( !doc->unlock( "", QString::fromUtf8("garçon").toLatin1() ) ); //clazy:exclude=qstring-allocations
     QVERIFY( !doc->isLocked() );
 
     delete doc;
@@ -44,7 +44,7 @@ void TestPassword::password1a()
 void TestPassword::password2()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QStringLiteral("garçon").toLatin1(), "" );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1(), "" ); //clazy:exclude=qstring-allocations
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
 
@@ -54,7 +54,7 @@ void TestPassword::password2()
 void TestPassword::password2a()
 {
     Poppler::Document *doc;
-    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QStringLiteral("garçon").toLatin1() );
+    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1() ); //clazy:exclude=qstring-allocations
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
 
@@ -67,7 +67,7 @@ void TestPassword::password2b()
     doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf") );
     QVERIFY( doc );
     QVERIFY( !doc->isLocked() );
-    QVERIFY( !doc->unlock( QStringLiteral("garçon").toLatin1(), "" ) );
+    QVERIFY( !doc->unlock( QString::fromUtf8("garçon").toLatin1(), "" ) ); //clazy:exclude=qstring-allocations
     QVERIFY( !doc->isLocked() );
 
     delete doc;
diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp
index b5182c96..42c81d29 100644
--- a/qt5/tests/check_search.cpp
+++ b/qt5/tests/check_search.cpp
@@ -30,12 +30,12 @@ void TestSearch::bug7063()
 
     QCOMPARE( page->search(QStringLiteral("latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false );
 
-    QCOMPARE( page->search(QStringLiteral("é"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("à"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("ç"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("search \"é\", \"à\" or \"ç\""), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("¥µ©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("¥©"), 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
+    QCOMPARE( page->search(QString::fromUtf8("ç"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); //clazy:exclude=qstring-allocations
+    QCOMPARE( page->search(QString::fromUtf8("search \"é\", \"à\" or \"ç\""), 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
+    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 );
 
@@ -44,12 +44,12 @@ void TestSearch::bug7063()
 
     QCOMPARE( page->search(QStringLiteral("latin1:"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false );
 
-    QCOMPARE( page->search(QStringLiteral("é"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("à"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("ç"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("search \"é\", \"à\" or \"ç\""), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("¥µ©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true );
-    QCOMPARE( page->search(QStringLiteral("¥©"), 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
+    QCOMPARE( page->search(QString::fromUtf8("ç"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), true ); //clazy:exclude=qstring-allocations
+    QCOMPARE( page->search(QString::fromUtf8("search \"é\", \"à\" or \"ç\""), 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
+    QCOMPARE( page->search(QString::fromUtf8("¥©"), rectLeft, rectTop, rectRight, rectBottom, Poppler::Page::FromTop), false ); //clazy:exclude=qstring-allocations
 }
 
 void TestSearch::testNextAndPrevious()


More information about the poppler mailing list