summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-11 20:01:10 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-11 20:01:10 (GMT)
commit3fcd69889622b21ca828536c05d9e79516ae0698 (patch)
treeafa6a7102b79ea0104998321f2ce58067bcb3e9e
parent2b473fedbdcb04d8cfb8d07a465456cfa2c9089c (diff)
autotests: Fix build without implicit cast to/from ascii
See previous commits for details.
-rw-r--r--autotests/addremoveannotationtest.cpp2
-rw-r--r--autotests/annotationstest.cpp2
-rw-r--r--autotests/documenttest.cpp2
-rw-r--r--autotests/editannotationcontentstest.cpp208
-rw-r--r--autotests/editformstest.cpp10
-rw-r--r--autotests/generatorstest.cpp4
-rw-r--r--autotests/mainshelltest.cpp42
-rw-r--r--autotests/modifyannotationpropertiestest.cpp2
-rw-r--r--autotests/parttest.cpp22
-rw-r--r--autotests/searchtest.cpp66
-rw-r--r--autotests/shelltest.cpp2
-rw-r--r--autotests/translateannotationtest.cpp2
12 files changed, 182 insertions, 182 deletions
diff --git a/autotests/addremoveannotationtest.cpp b/autotests/addremoveannotationtest.cpp
index 76d6f13..dc4e8eb 100644
--- a/autotests/addremoveannotationtest.cpp
+++ b/autotests/addremoveannotationtest.cpp
@@ -39,7 +39,7 @@ void AddRemoveAnnotationTest::initTestCase()
void AddRemoveAnnotationTest::init()
{
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
diff --git a/autotests/annotationstest.cpp b/autotests/annotationstest.cpp
index 1c21d6c..e5f0383 100644
--- a/autotests/annotationstest.cpp
+++ b/autotests/annotationstest.cpp
@@ -40,7 +40,7 @@ void AnnotationTest::initTestCase()
{
Okular::SettingsCore::instance( QStringLiteral("annotationtest") );
m_document = new Okular::Document( 0 );
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
diff --git a/autotests/documenttest.cpp b/autotests/documenttest.cpp
index 6cd8ca8..9c12b56 100644
--- a/autotests/documenttest.cpp
+++ b/autotests/documenttest.cpp
@@ -32,7 +32,7 @@ void DocumentTest::testCloseDuringRotationJob()
{
Okular::SettingsCore::instance( QStringLiteral("documenttest") );
Okular::Document *m_document = new Okular::Document( 0 );
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
diff --git a/autotests/editannotationcontentstest.cpp b/autotests/editannotationcontentstest.cpp
index f2399ec..d220d70 100644
--- a/autotests/editannotationcontentstest.cpp
+++ b/autotests/editannotationcontentstest.cpp
@@ -105,7 +105,7 @@ void EditAnnotationContentsTest::cleanupTestCase()
void EditAnnotationContentsTest::init()
{
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
@@ -142,47 +142,47 @@ void EditAnnotationContentsTest::testConsecutiveCharBackspacesMerged()
{
// Hello, World| -> Hello, Worl|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
- QCOMPARE( QString( "Hello, Worl" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Worl" ), m_annot1->contents() );
// Hello, Worl| -> Hello, Wor|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
- QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot1->contents() );
// undo and verify that consecutive backspace operations are merged together
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 12, m_editor1->cursorPos() );
QCOMPARE( 12, m_editor1->anchorPos() );
m_document->redo();
- QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, Wor" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_editor1->contents() );
QCOMPARE( 10, m_editor1->cursorPos() );
QCOMPARE( 10, m_editor1->anchorPos() );
// Hello, Wor| -> Hello, Wo|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wo" ), 9, 10, 10 );
- QCOMPARE( QString( "Hello, Wo" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wo" ), m_annot1->contents() );
// Hello, Wo| -> Hello, W|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, W" ), 8, 9, 9 );
- QCOMPARE( QString( "Hello, W" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, W" ), m_annot1->contents() );
// Hello, W| -> Hello, |
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, " ), 7, 8, 8 );
- QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_annot1->contents() );
// undo and verify that consecutive backspace operations are merged together
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 12, m_editor1->cursorPos() );
QCOMPARE( 12, m_editor1->anchorPos() );
m_document->redo();
- QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, " ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_editor1->contents() );
QCOMPARE( 7, m_editor1->cursorPos() );
QCOMPARE( 7, m_editor1->anchorPos() );
}
@@ -191,41 +191,41 @@ void EditAnnotationContentsTest::testConsecutiveNewlineBackspacesNotMerged()
{
// Set contents to Hello, \n\n|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \n\nWorld" ), 0, 0, 0 );
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_annot1->contents() );
// Hello, \n\n|World -> Hello, \n|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \nWorld" ), 8, 9, 9 );
- QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_annot1->contents() );
// Hello, \n|World -> Hello, |World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, World" ), 7, 8, 8 );
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
// Hello, |World -> Hello,|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello,World" ), 6, 7, 7 );
- QCOMPARE( QString( "Hello,World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello,World" ), m_annot1->contents() );
// Hello,|World -> Hello|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "HelloWorld" ), 5, 6, 6 );
- QCOMPARE( QString( "HelloWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "HelloWorld" ), m_annot1->contents() );
// Backspace operations of non-newline characters should be merged
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 7, m_editor1->cursorPos() );
QCOMPARE( 7, m_editor1->anchorPos() );
// Backspace operations on newline characters should not be merged
m_document->undo();
- QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, \nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_editor1->contents() );
QCOMPARE( 8, m_editor1->cursorPos() );
QCOMPARE( 8, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_editor1->contents() );
QCOMPARE( 9, m_editor1->cursorPos() );
QCOMPARE( 9, m_editor1->anchorPos() );
}
@@ -234,30 +234,30 @@ void EditAnnotationContentsTest::testConsecutiveCharInsertionsMerged()
{
// Hello, |World -> Hello, B|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, BWorld" ), 8, 7, 7 );
- QCOMPARE( QString( "Hello, BWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, BWorld" ), m_annot1->contents() );
// Hello, l| -> Hello, li|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, BiWorld" ), 9, 8, 8 );
- QCOMPARE( QString( "Hello, BiWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, BiWorld" ), m_annot1->contents() );
// Hello, li| -> Hello, lin|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, BigWorld" ), 10, 9, 9 );
- QCOMPARE( QString( "Hello, BigWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, BigWorld" ), m_annot1->contents() );
// Hello, lin| -> Hello, line|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Big World" ), 11, 10, 10 );
- QCOMPARE( QString( "Hello, Big World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Big World" ), m_annot1->contents() );
// Verify undo/redo operations merged
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 7, m_editor1->cursorPos() );
QCOMPARE( 7, m_editor1->anchorPos() );
m_document->redo();
- QCOMPARE( QString( "Hello, Big World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, Big World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Big World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Big World" ), m_editor1->contents() );
QCOMPARE( 11, m_editor1->cursorPos() );
QCOMPARE( 11, m_editor1->anchorPos() );
}
@@ -266,33 +266,33 @@ void EditAnnotationContentsTest::testConsecutiveNewlineInsertionsNotMerged()
{
// Hello, |World -> Hello, \n|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \nWorld" ), 8, 7, 7 );
- QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_annot1->contents() );
// Hello, |World -> Hello, \n|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \n\nWorld" ), 9, 8, 8 );
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_annot1->contents() );
m_document->undo();
- QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, \nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_editor1->contents() );
QCOMPARE( 8, m_editor1->cursorPos() );
QCOMPARE( 8, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 7, m_editor1->cursorPos() );
QCOMPARE( 7, m_editor1->anchorPos() );
m_document->redo();
- QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, \nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \nWorld" ), m_editor1->contents() );
QCOMPARE( 8, m_editor1->cursorPos() );
QCOMPARE( 8, m_editor1->anchorPos() );
m_document->redo();
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_editor1->contents() );
QCOMPARE( 9, m_editor1->cursorPos() );
QCOMPARE( 9, m_editor1->anchorPos() );
}
@@ -301,34 +301,34 @@ void EditAnnotationContentsTest::testConsecutiveCharDeletesMerged()
{
// Hello, |World -> Hello, |orld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, orld" ), 7, 7, 7 );
- QCOMPARE( QString( "Hello, orld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, orld" ), m_annot1->contents() );
// Hello, |orld -> Hello, |rld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, rld" ), 7, 7, 7 );
- QCOMPARE( QString( "Hello, rld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, rld" ), m_annot1->contents() );
// Hello, |rld -> Hello, |ld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, ld" ), 7, 7, 7 );
- QCOMPARE( QString( "Hello, ld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, ld" ), m_annot1->contents() );
// Hello, |ld -> Hello, |d
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, d" ), 7, 7, 7 );
- QCOMPARE( QString( "Hello, d" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, d" ), m_annot1->contents() );
// Hello, | -> Hello, |
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, " ), 7, 7, 7 );
- QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_annot1->contents() );
// Verify undo/redo operations merged
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 7, m_editor1->cursorPos() );
QCOMPARE( 7, m_editor1->anchorPos() );
m_document->redo();
- QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, " ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_editor1->contents() );
QCOMPARE( 7, m_editor1->cursorPos() );
QCOMPARE( 7, m_editor1->anchorPos() );
}
@@ -337,52 +337,52 @@ void EditAnnotationContentsTest::testConsecutiveNewlineDeletesNotMerged()
{
// Set contents to Hello, \n\n|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \n\nWorld" ), 0, 0, 0 );
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_annot1->contents() );
// He|llo, \n\nWorld -> He|lo, \n\nWorld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Helo, \n\nWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "Helo, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Helo, \n\nWorld" ), m_annot1->contents() );
// He|lo, \n\nWorld -> He|o, \n\nWorld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Heo, \n\nWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "Heo, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Heo, \n\nWorld" ), m_annot1->contents() );
// He|o, \n\nWorld -> He|, \n\nWorld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He, \n\nWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "He, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "He, \n\nWorld" ), m_annot1->contents() );
// He|, \n\nWorld -> He| \n\nWorld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He \n\nWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "He \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "He \n\nWorld" ), m_annot1->contents() );
// He| \n\nWorld -> He|\n\nWorld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He\n\nWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "He\n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "He\n\nWorld" ), m_annot1->contents() );
// He|\n\nWorld -> He|\nWorld
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He\nWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "He\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "He\nWorld" ), m_annot1->contents() );
// He|\nWorld -> He|World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "HeWorld" ), 2, 2, 2 );
- QCOMPARE( QString( "HeWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "HeWorld" ), m_annot1->contents() );
// Verify that deletions of newlines are not merged, but deletions of other characters are
m_document->undo();
- QCOMPARE( QString( "He\nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "He\nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "He\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "He\nWorld" ), m_editor1->contents() );
QCOMPARE( 2, m_editor1->cursorPos() );
QCOMPARE( 2, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "He\n\nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "He\n\nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "He\n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "He\n\nWorld" ), m_editor1->contents() );
QCOMPARE( 2, m_editor1->cursorPos() );
QCOMPARE( 2, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, \n\nWorld" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, \n\nWorld" ), m_editor1->contents() );
QCOMPARE( 2, m_editor1->cursorPos() );
QCOMPARE( 2, m_editor1->anchorPos() );
}
@@ -391,69 +391,69 @@ void EditAnnotationContentsTest::testConsecutiveEditsNotMergedAcrossDifferentAnn
{
// Annot1: Hello, World| -> Hello, Worl|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
- QCOMPARE( QString( "Hello, Worl" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Worl" ), m_annot1->contents() );
// Annot1: Hello, Worl| -> Hello, Wor|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
- QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot1->contents() );
// Annot2: Hello, World| -> Hello, Worl|
m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
- QCOMPARE( QString( "Hello, Worl" ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Worl" ), m_annot2->contents() );
// Annot2: Hello, Worl| -> Hello, Wor|
m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
- QCOMPARE( QString( "Hello, Wor" ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot2->contents() );
// Annot1: Hello, Wor| -> Hello, Wo|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wo" ), 9, 10, 10 );
- QCOMPARE( QString( "Hello, Wo" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wo" ), m_annot1->contents() );
// Annot1: Hello, Wo| -> Hello, W|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, W" ), 8, 9, 9 );
- QCOMPARE( QString( "Hello, W" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, W" ), m_annot1->contents() );
// Annot1: Hello, W| -> Hello, |
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, " ), 7, 8, 8 );
- QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_annot1->contents() );
// Annot2: Hello, Wor| -> Hello, Wo|
m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, Wo" ), 9, 10, 10 );
- QCOMPARE( QString( "Hello, Wo" ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wo" ), m_annot2->contents() );
// Annot2: Hello, Wo| -> Hello, W|
m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, W" ), 8, 9, 9 );
- QCOMPARE( QString( "Hello, W" ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, W" ), m_annot2->contents() );
// Annot2: Hello, W| -> Hello, |
m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, " ), 7, 8, 8 );
- QCOMPARE( QString( "Hello, " ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_annot2->contents() );
// undo and verify that consecutive backspace operations are merged together
// m_annot2 -> "Hello, Wor|"
m_document->undo();
- QCOMPARE( QString( "Hello, Wor" ), m_annot2->contents() );
- QCOMPARE( QString( "Hello, " ), m_editor1->contents() );
- QCOMPARE( QString( "Hello, Wor" ), m_editor2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, " ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_editor2->contents() );
QCOMPARE( 10, m_editor2->cursorPos() );
QCOMPARE( 10, m_editor2->anchorPos() );
// m_annot1 -> "Hello, Wor|"
m_document->undo();
- QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, Wor" ), m_editor1->contents() );
- QCOMPARE( QString( "Hello, Wor" ), m_editor2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_editor2->contents() );
QCOMPARE( 10, m_editor1->cursorPos() );
QCOMPARE( 10, m_editor1->anchorPos() );
// m_annot2 -> "Hello, World|"
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot2->contents() );
- QCOMPARE( QString( "Hello, Wor" ), m_editor1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor2->contents() );
QCOMPARE( 12, m_editor2->cursorPos() );
QCOMPARE( 12, m_editor2->anchorPos() );
// m_annot1 -> "Hello, World|"
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor2->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor2->contents() );
QCOMPARE( 12, m_editor1->cursorPos() );
QCOMPARE( 12, m_editor1->anchorPos() );
}
@@ -462,21 +462,21 @@ void EditAnnotationContentsTest::testInsertWithSelection()
{
// Annot1: |Hello|, World -> H|, World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "H, World" ), 1, 0, 5 );
- QCOMPARE( QString( "H, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "H, World" ), m_annot1->contents() );
// Annot1: H|, World -> Hi|, World
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hi, World" ), 2, 1, 1 );
- QCOMPARE( QString( "Hi, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hi, World" ), m_annot1->contents() );
m_document->undo();
- QCOMPARE( QString( "H, World" ), m_annot1->contents() );
- QCOMPARE( QString( "H, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "H, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "H, World" ), m_editor1->contents() );
QCOMPARE( 1, m_editor1->cursorPos() );
QCOMPARE( 1, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 0, m_editor1->cursorPos() );
QCOMPARE( 5, m_editor1->anchorPos() );
}
@@ -485,35 +485,35 @@ void EditAnnotationContentsTest::testCombinations()
{
// Annot1: Hello, World| -> Hello, Worl|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
- QCOMPARE( QString( "Hello, Worl" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Worl" ), m_annot1->contents() );
// Annot1: Hello, Worl| -> Hello, Wor|
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
- QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot1->contents() );
// Annot1: |He|llo, Wor -> |llo, Wor
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "llo, Wor" ), 0, 2, 0 );
- QCOMPARE( QString( "llo, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "llo, Wor" ), m_annot1->contents() );
// Annot1: |llo, Wor -> |lo, Wor
m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "lo, Wor" ), 0, 0, 0 );
- QCOMPARE( QString( "lo, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "lo, Wor" ), m_annot1->contents() );
m_document->undo();
- QCOMPARE( QString( "llo, Wor" ), m_annot1->contents() );
- QCOMPARE( QString( "llo, Wor" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "llo, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "llo, Wor" ), m_editor1->contents() );
QCOMPARE( 0, m_editor1->cursorPos() );
QCOMPARE( 0, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, Wor" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, Wor" ), m_editor1->contents() );
QCOMPARE( 2, m_editor1->cursorPos() );
QCOMPARE( 0, m_editor1->anchorPos() );
m_document->undo();
- QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
- QCOMPARE( QString( "Hello, World" ), m_editor1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_annot1->contents() );
+ QCOMPARE( QStringLiteral( "Hello, World" ), m_editor1->contents() );
QCOMPARE( 12, m_editor1->cursorPos() );
QCOMPARE( 12, m_editor1->anchorPos() );
}
diff --git a/autotests/editformstest.cpp b/autotests/editformstest.cpp
index 314b6e8..12a7fd6 100644
--- a/autotests/editformstest.cpp
+++ b/autotests/editformstest.cpp
@@ -65,7 +65,7 @@ void EditFormsTest::cleanupTestCase()
void EditFormsTest::init()
{
- const QString testFile = KDESRCDIR "data/formSamples.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/formSamples.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
@@ -279,7 +279,7 @@ void EditFormsTest::testComboEditForm()
// Select a custom choice and verify that no predefined choices are selected
m_document->editFormCombo( 0, m_comboEdit, QStringLiteral("comboEdit"), 0, 0, 0);
QCOMPARE( m_comboEdit->currentChoices().length(), 0 );
- QCOMPARE( m_comboEdit->editChoice(), QString( "comboEdit" ) );
+ QCOMPARE( m_comboEdit->editChoice(), QStringLiteral( "comboEdit" ) );
QVERIFY( m_document->canUndo() );
QVERIFY( !m_document->canRedo() );
@@ -393,7 +393,7 @@ void EditFormsTest::verifyTextForm( Okular::FormFieldText* form )
// Insert the string "Hello" into the form
m_document->editFormText(0, form, QStringLiteral("Hello"), 5, 0, 0);
- QCOMPARE( form->text(), QString("Hello") );
+ QCOMPARE( form->text(), QStringLiteral("Hello") );
QVERIFY( m_document->canUndo() );
QVERIFY( !m_document->canRedo() );
@@ -405,7 +405,7 @@ void EditFormsTest::verifyTextForm( Okular::FormFieldText* form )
// Redo the insertion of "Hello"
m_document->redo();
- QCOMPARE( form->text(), QString("Hello") );
+ QCOMPARE( form->text(), QStringLiteral("Hello") );
QVERIFY( m_document->canUndo() );
QVERIFY( !m_document->canRedo() );
@@ -419,7 +419,7 @@ void EditFormsTest::verifyTextForm( Okular::FormFieldText* form )
// Verify that character insertion operations were merged together into a single undo command
m_document->undo();
- QCOMPARE( form->text(), QString("Hello") );
+ QCOMPARE( form->text(), QStringLiteral("Hello") );
QVERIFY( m_document->canUndo() );
QVERIFY( m_document->canRedo() );
diff --git a/autotests/generatorstest.cpp b/autotests/generatorstest.cpp
index d954e71..9d63c91 100644
--- a/autotests/generatorstest.cpp
+++ b/autotests/generatorstest.cpp
@@ -26,12 +26,12 @@ private slots:
void GeneratorsTest::testLoadsCorrectly()
{
QCoreApplication::setLibraryPaths(QStringList());
- QVERIFY2(QDir(GENERATORS_BUILD_DIR).exists(), GENERATORS_BUILD_DIR);
+ QVERIFY2(QDir(QStringLiteral(GENERATORS_BUILD_DIR)).exists(), GENERATORS_BUILD_DIR);
// find all possible generators in $CMAKE_BINARY_DIR/generators
// We can't simply hardcore the list of generators since some might not be built
// depending on which dependencies were found by CMake
QStringList generatorLibs;
- QDirIterator it(GENERATORS_BUILD_DIR, QDir::Files | QDir::Executable, QDirIterator::Subdirectories);
+ QDirIterator it(QStringLiteral(GENERATORS_BUILD_DIR), QDir::Files | QDir::Executable, QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
if (QLibrary::isLibrary(it.fileName())) {
diff --git a/autotests/mainshelltest.cpp b/autotests/mainshelltest.cpp
index 90b5ec5..abb9b14 100644
--- a/autotests/mainshelltest.cpp
+++ b/autotests/mainshelltest.cpp
@@ -116,7 +116,7 @@ void MainShellTest::initTestCase()
// Register in bus as okular
QDBusConnectionInterface *bus = QDBusConnection::sessionBus().interface();
const QString myPid = QString::number( getpid() );
- const QString serviceName = "org.kde.okular-"+ myPid;
+ const QString serviceName = QStringLiteral("org.kde.okular-")+ myPid;
QVERIFY( bus->registerService(serviceName) == QDBusConnectionInterface::ServiceRegistered );
// Tell the presentationWidget to not be annoying
@@ -171,12 +171,12 @@ void MainShellTest::testShell_data()
QTest::addColumn<bool>("externalProcessExpectPresentation");
QTest::addColumn<bool>("externalProcessExpectPrintDialog");
- const QStringList contentsEpub = QStringList(KDESRCDIR "data/contents.epub");
- const QStringList file1 = QStringList(KDESRCDIR "data/file1.pdf");
+ const QStringList contentsEpub = QStringList(QStringLiteral(KDESRCDIR "data/contents.epub"));
+ const QStringList file1 = QStringList(QStringLiteral(KDESRCDIR "data/file1.pdf"));
QStringList file1AndToc;
- file1AndToc << KDESRCDIR "data/file1.pdf";
- file1AndToc << KDESRCDIR "data/tocreload.pdf";
- const QString tocReload = KDESRCDIR "data/tocreload.pdf";
+ file1AndToc << QStringLiteral(KDESRCDIR "data/file1.pdf");
+ file1AndToc << QStringLiteral(KDESRCDIR "data/tocreload.pdf");
+ const QString tocReload = QStringLiteral(KDESRCDIR "data/tocreload.pdf");
const QString optionsPage2 = ShellUtils::serializeOptions(false, false, false, false, QStringLiteral("2"));
const QString optionsPage2Presentation = ShellUtils::serializeOptions(true, false, false, false, QStringLiteral("2"));
@@ -239,7 +239,7 @@ void MainShellTest::testShell()
QCOMPARE(s->m_tabs.count(), 1);
Okular::Part *part = s->findChild<Okular::Part*>();
QVERIFY(part);
- QCOMPARE(part->url().url(), QString("file://%1").arg(paths[0]));
+ QCOMPARE(part->url().url(), QStringLiteral("file://%1").arg(paths[0]));
QCOMPARE(partDocument(part)->currentPage(), expectedPage);
}
else if (paths.count() == 2)
@@ -252,8 +252,8 @@ void MainShellTest::testShell()
Okular::Part *part = dynamic_cast<Okular::Part*>(s->m_tabs[0].part);
Okular::Part *part2 = dynamic_cast<Okular::Part*>(s->m_tabs[1].part);
QCOMPARE(s->m_tabs.count(), 2);
- QCOMPARE(part->url().url(), QString("file://%1").arg(paths[0]));
- QCOMPARE(part2->url().url(), QString("file://%1").arg(paths[1]));
+ QCOMPARE(part->url().url(), QStringLiteral("file://%1").arg(paths[0]));
+ QCOMPARE(part2->url().url(), QStringLiteral("file://%1").arg(paths[1]));
QCOMPARE(partDocument(part)->currentPage(), expectedPage);
QCOMPARE(partDocument(part2)->currentPage(), expectedPage);
}
@@ -278,7 +278,7 @@ void MainShellTest::testShell()
foreach(const QString &path, paths)
{
- QVERIFY(openUrls.contains(QString("file://%1").arg(path)));
+ QVERIFY(openUrls.contains(QStringLiteral("file://%1").arg(path)));
}
}
}
@@ -298,7 +298,7 @@ void MainShellTest::testShell()
args << QStringLiteral("-presentation");
if (externalProcessExpectPrintDialog)
args << QStringLiteral("-print");
- p.start(OKULAR_BINARY, args);
+ p.start(QStringLiteral(OKULAR_BINARY), args);
p.waitForStarted();
QCOMPARE(p.state(), QProcess::Running);
@@ -313,7 +313,7 @@ void MainShellTest::testShell()
{
// It is unique so part got "overriten"
QCOMPARE(s->m_tabs.count(), 1);
- QCOMPARE(part->url().url(), QString("file://%1").arg(externalProcessPath));
+ QCOMPARE(part->url().url(), QStringLiteral("file://%1").arg(externalProcessPath));
QCOMPARE(partDocument(part)->currentPage(), externalProcessExpectedPage);
}
else
@@ -321,7 +321,7 @@ void MainShellTest::testShell()
// It is attaching to us so a second tab is there
QCOMPARE(s->m_tabs.count(), 2);
Okular::Part *part2 = dynamic_cast<Okular::Part*>(s->m_tabs[1].part);
- QCOMPARE(part2->url().url(), QString("file://%1").arg(externalProcessPath));
+ QCOMPARE(part2->url().url(), QStringLiteral("file://%1").arg(externalProcessPath));
QCOMPARE(partDocument(part2)->currentPage(), externalProcessExpectedPage);
}
}
@@ -336,7 +336,7 @@ void MainShellTest::testShell()
QVERIFY(p.state() != QProcess::Running);
// It opened on a new process, so no change for us
QCOMPARE(s->m_tabs.count(), 1);
- QCOMPARE(part->url().url(), QString("file://%1").arg(paths[0]));
+ QCOMPARE(part->url().url(), QStringLiteral("file://%1").arg(paths[0]));
QCOMPARE(partDocument(part)->currentPage(), externalProcessExpectedPage);
}
}
@@ -398,7 +398,7 @@ void MainShellTest::testFileRemembersPagePosition()
{
QFETCH(int, mode);
- const QStringList paths = QStringList(KDESRCDIR "data/contents.epub");
+ const QStringList paths = QStringList(QStringLiteral(KDESRCDIR "data/contents.epub"));
QString serializedOptions;
if (mode == 1 || mode == 3)
serializedOptions = ShellUtils::serializeOptions(false, false, false, false, QString());
@@ -413,7 +413,7 @@ void MainShellTest::testFileRemembersPagePosition()
QVERIFY(s);
Okular::Part *part = s->findChild<Okular::Part*>();
QVERIFY(part);
- QCOMPARE(part->url().url(), QString("file://%1").arg(paths[0]));
+ QCOMPARE(part->url().url(), QStringLiteral("file://%1").arg(paths[0]));
QCOMPARE(partDocument(part)->currentPage(), 0u);
partDocument(part)->setViewportPage(3);
QCOMPARE(partDocument(part)->currentPage(), 3u);
@@ -433,7 +433,7 @@ void MainShellTest::testFileRemembersPagePosition()
args << paths[0];
if (mode == 2)
args << QStringLiteral("-unique");
- p.start(OKULAR_BINARY, args);
+ p.start(QStringLiteral(OKULAR_BINARY), args);
p.waitForStarted();
QCOMPARE(p.state(), QProcess::Running);
@@ -446,7 +446,7 @@ void MainShellTest::testFileRemembersPagePosition()
QVERIFY(s);
part = s->findChild<Okular::Part*>();
QVERIFY(part);
- QCOMPARE(part->url().url(), QString("file://%1").arg(paths[0]));
+ QCOMPARE(part->url().url(), QStringLiteral("file://%1").arg(paths[0]));
QCOMPARE(partDocument(part)->currentPage(), 3u);
}
@@ -465,7 +465,7 @@ void MainShellTest::test2FilesError()
QFETCH(QString, serializedOptions);
QStringList paths;
- paths << KDESRCDIR "data/file1.pdf" << KDESRCDIR "data/tocreload.pdf";
+ paths << QStringLiteral(KDESRCDIR "data/file1.pdf") << QStringLiteral(KDESRCDIR "data/tocreload.pdf");
Okular::Status status = Okular::main(paths, serializedOptions);
QCOMPARE(status, Okular::Error);
@@ -481,9 +481,9 @@ void MainShellTest::testSessionRestore_data()
QTest::addColumn<bool>("useTabsOpen");
QTest::addColumn<bool>("useTabsRestore");
- QStringList oneDocPaths( KDESRCDIR "data/file1.pdf" );
+ QStringList oneDocPaths(QStringLiteral( KDESRCDIR "data/file1.pdf" ) );
QStringList twoDocPaths( oneDocPaths );
- twoDocPaths << KDESRCDIR "data/formSamples.pdf";
+ twoDocPaths << QStringLiteral(KDESRCDIR "data/formSamples.pdf");
const QString options = ShellUtils::serializeOptions(false, false, false, false, QString());
diff --git a/autotests/modifyannotationpropertiestest.cpp b/autotests/modifyannotationpropertiestest.cpp
index f12e207..d7d52a2 100644
--- a/autotests/modifyannotationpropertiestest.cpp
+++ b/autotests/modifyannotationpropertiestest.cpp
@@ -51,7 +51,7 @@ void ModifyAnnotationPropertiesTest::cleanupTestCase()
void ModifyAnnotationPropertiesTest::init()
{
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );
diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp
index 1ed7bbc..1d58a4c 100644
--- a/autotests/parttest.cpp
+++ b/autotests/parttest.cpp
@@ -80,7 +80,7 @@ void PartTest::testReload()
{
QVariantList dummyArgs;
Okular::Part part(NULL, NULL, dummyArgs);
- QVERIFY( openDocument(&part, KDESRCDIR "data/file1.pdf") );
+ QVERIFY( openDocument(&part, QStringLiteral(KDESRCDIR "data/file1.pdf")) );
part.reload();
qApp->processEvents();
}
@@ -90,7 +90,7 @@ void PartTest::testCanceledReload()
{
QVariantList dummyArgs;
PartThatHijacksQueryClose part(NULL, NULL, dummyArgs);
- QVERIFY( openDocument(&part, KDESRCDIR "data/file1.pdf") );
+ QVERIFY( openDocument(&part, QStringLiteral(KDESRCDIR "data/file1.pdf")) );
// When queryClose() returns false, the reload operation is canceled (as if
// the user had chosen Cancel in the "Save changes?" message box)
@@ -105,7 +105,7 @@ void PartTest::testTOCReload()
{
QVariantList dummyArgs;
Okular::Part part(NULL, NULL, dummyArgs);
- QVERIFY( openDocument(&part, KDESRCDIR "data/tocreload.pdf") );
+ QVERIFY( openDocument(&part, QStringLiteral(KDESRCDIR "data/tocreload.pdf")) );
QCOMPARE(part.m_toc->expandedNodes().count(), 0);
part.m_toc->m_treeView->expandAll();
QCOMPARE(part.m_toc->expandedNodes().count(), 3);
@@ -126,15 +126,15 @@ void PartTest::testFowardPDF()
const QDir workDir(QDir(tempDir.path()).filePath(dir));
workDir.mkpath(QStringLiteral("."));
- QFile f(KDESRCDIR "data/synctextest.tex");
- const QString texDestination = workDir.path() + "/synctextest.tex";
+ QFile f(QStringLiteral(KDESRCDIR "data/synctextest.tex"));
+ const QString texDestination = workDir.path() + QStringLiteral("/synctextest.tex");
QVERIFY(f.copy(texDestination));
QProcess process;
process.setWorkingDirectory(workDir.path());
process.start(QStringLiteral("pdflatex"), QStringList() << QStringLiteral("-synctex=1") << QStringLiteral("-interaction=nonstopmode") << texDestination);
process.waitForFinished();
- const QString pdfResult = workDir.path() + "/synctextest.pdf";
+ const QString pdfResult = workDir.path() + QStringLiteral("/synctextest.pdf");
QVERIFY(QFile::exists(pdfResult));
@@ -144,7 +144,7 @@ void PartTest::testFowardPDF()
part.closeUrl();
QUrl u(QUrl::fromLocalFile(pdfResult));
- u.setFragment("src:100" + texDestination);
+ u.setFragment(QStringLiteral("src:100") + texDestination);
part.openUrl(u);
QCOMPARE(part.m_document->currentPage(), 1u);
}
@@ -179,7 +179,7 @@ void PartTest::testSelectText()
{
QVariantList dummyArgs;
Okular::Part part(NULL, NULL, dummyArgs);
- QVERIFY(openDocument(&part, KDESRCDIR "data/file2.pdf"));
+ QVERIFY(openDocument(&part, QStringLiteral(KDESRCDIR "data/file2.pdf")));
part.widget()->show();
QTest::qWaitForWindowShown(part.widget());
@@ -204,14 +204,14 @@ void PartTest::testSelectText()
QApplication::clipboard()->clear();
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "copyTextSelection"));
- QCOMPARE(QApplication::clipboard()->text(), QString("Hola que tal\n"));
+ QCOMPARE(QApplication::clipboard()->text(), QStringLiteral("Hola que tal\n"));
}
void PartTest::testClickInternalLink()
{
QVariantList dummyArgs;
Okular::Part part(NULL, NULL, dummyArgs);
- QVERIFY(openDocument(&part, KDESRCDIR "data/file2.pdf"));
+ QVERIFY(openDocument(&part, QStringLiteral(KDESRCDIR "data/file2.pdf")));
part.widget()->show();
QTest::qWaitForWindowShown(part.widget());
@@ -245,7 +245,7 @@ int main(int argc, char *argv[])
setenv("KDE_SKIP_KDERC", "1", 1);
unsetenv("KDE_COLOR_DEBUG");
QFile::remove(QDir::homePath() + QString::fromLatin1("/.kde-unit-test/share/config/qttestrc"));
- KAboutData aboutData( QByteArray("qttest"), i18n("KDE Test Program"), QByteArray("version") );
+ KAboutData aboutData( QStringLiteral("qttest"), i18n("KDE Test Program"), QStringLiteral("version") );
QApplication app( argc, argv );
app.setApplicationName( QLatin1String("qttest") );
qRegisterMetaType<QUrl>(); /*as done by kapplication*/
diff --git a/autotests/searchtest.cpp b/autotests/searchtest.cpp
index df87cf6..1a41930 100644
--- a/autotests/searchtest.cpp
+++ b/autotests/searchtest.cpp
@@ -53,7 +53,7 @@ class SearchTest : public QObject
void SearchTest::initTestCase()
{
qRegisterMetaType<Okular::Document::SearchStatus>();
- Okular::SettingsCore::instance( "searchtest" );
+ Okular::SettingsCore::instance( QStringLiteral("searchtest") );
}
static void createTextPage(const QVector<QString>& text, const QVector<Okular::NormalizedRect>& rect,
@@ -121,17 +121,17 @@ void SearchTest::testNextAndPrevious()
#define TEST_NEXT_PREV_SITUATION_COUNT 4
QVector<QString> texts[TEST_NEXT_PREV_SITUATION_COUNT] = {
- QVector<QString>() << "a" << "b" << "a" << "b" << "a",
- QVector<QString>() << "a" << "b" << "a" << "b",
- QVector<QString>() << "a" << "b" << "a" << "b" << "a" << "b" << "a" ,
- QVector<QString>() << "a" << " " << "ba" << " " << "b"
+ QVector<QString>() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("a" ) << QStringLiteral("b") << QStringLiteral("a"),
+ QVector<QString>() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("a" ) << QStringLiteral("b"),
+ QVector<QString>() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("a" ) << QStringLiteral("b") << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("a"),
+ QVector<QString>() << QStringLiteral("a") << QStringLiteral(" ") << QStringLiteral("ba") << QStringLiteral(" ") << QStringLiteral("b")
};
QString searchStrings[TEST_NEXT_PREV_SITUATION_COUNT] = {
- "b",
- "ab",
- "aba",
- "a b"
+ QStringLiteral("b"),
+ QStringLiteral("ab"),
+ QStringLiteral("aba"),
+ QStringLiteral("a b")
};
for (int i = 0; i < TEST_NEXT_PREV_SITUATION_COUNT; i++) {
@@ -172,13 +172,13 @@ void SearchTest::test311232()
QObject::connect(&d, SIGNAL(searchFinished(int,Okular::Document::SearchStatus)), &receiver, SLOT(searchFinished(int,Okular::Document::SearchStatus)));
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
d.openDocument(testFile, QUrl(), mime);
const int searchId = 0;
- d.searchText(searchId, " i ", true, Qt::CaseSensitive, Okular::Document::NextMatch, false, QColor());
+ d.searchText(searchId, QStringLiteral(" i "), true, Qt::CaseSensitive, Okular::Document::NextMatch, false, QColor());
QTime t;
t.start();
while (spy.count() != 1 && t.elapsed() < 500)
@@ -200,14 +200,14 @@ void SearchTest::test311232()
void SearchTest::test323262()
{
QVector<QString> text;
- text << "a\n";
+ text << QStringLiteral("a\n");
QVector<Okular::NormalizedRect> rect;
rect << Okular::NormalizedRect(1, 2, 3, 4);
CREATE_PAGE;
- Okular::RegularAreaRect* result = tp->findText(0, "a", Okular::FromBottom, Qt::CaseSensitive, NULL);
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("a"), Okular::FromBottom, Qt::CaseSensitive, NULL);
QVERIFY(result);
delete result;
@@ -217,7 +217,7 @@ void SearchTest::test323262()
void SearchTest::test323263()
{
QVector<QString> text;
- text << "a" << "a" << "b";
+ text << QStringLiteral("a") << QStringLiteral("a") << QStringLiteral("b");
QVector<Okular::NormalizedRect> rect;
rect << Okular::NormalizedRect(0, 0, 1, 1)
@@ -226,7 +226,7 @@ void SearchTest::test323263()
CREATE_PAGE;
- Okular::RegularAreaRect* result = tp->findText(0, "ab", Okular::FromTop, Qt::CaseSensitive, NULL);
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("ab"), Okular::FromTop, Qt::CaseSensitive, NULL);
QVERIFY(result);
Okular::RegularAreaRect expected;
expected.append(rect[1]);
@@ -267,11 +267,11 @@ void SearchTest::testDottedI()
void SearchTest::testHyphenAtEndOfLineWithoutYOverlap()
{
QVector<QString> text;
- text << "super-"
- << "cali-\n"
- << "fragilistic" << "-"
- << "expiali" << "-\n"
- << "docious";
+ text << QStringLiteral("super-")
+ << QStringLiteral("cali-\n")
+ << QStringLiteral("fragilistic") << QStringLiteral("-")
+ << QStringLiteral("expiali") << QStringLiteral("-\n")
+ << QStringLiteral("docious");
QVector<Okular::NormalizedRect> rect;
rect << Okular::NormalizedRect(0.4, 0.0, 0.9, 0.1)
@@ -282,7 +282,7 @@ void SearchTest::testHyphenAtEndOfLineWithoutYOverlap()
CREATE_PAGE;
- Okular::RegularAreaRect* result = tp->findText(0, "supercalifragilisticexpialidocious",
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("supercalifragilisticexpialidocious"),
Okular::FromTop, Qt::CaseSensitive, NULL);
QVERIFY(result);
Okular::RegularAreaRect expected;
@@ -300,7 +300,7 @@ void SearchTest::testHyphenAtEndOfLineWithoutYOverlap()
{ \
CREATE_PAGE; \
\
- Okular::RegularAreaRect* result = tp->findText(0, searchString, \
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral(searchString), \
Okular::FromTop, Qt::CaseSensitive, NULL); \
\
QCOMPARE(!!result, matchExpected); \
@@ -312,8 +312,8 @@ void SearchTest::testHyphenAtEndOfLineWithoutYOverlap()
void SearchTest::testHyphenWithYOverlap()
{
QVector<QString> text;
- text << "a-"
- << "b";
+ text << QStringLiteral("a-")
+ << QStringLiteral("b");
QVector<Okular::NormalizedRect> rect(2);
@@ -347,7 +347,7 @@ void SearchTest::testHyphenAtEndOfPage()
//next character is at the same line) at the end of the page.
QVector<QString> text;
- text << "a-";
+ text << QStringLiteral("a-");
QVector<Okular::NormalizedRect> rect;
rect << Okular::NormalizedRect(0, 0, 1, 1);
@@ -355,14 +355,14 @@ void SearchTest::testHyphenAtEndOfPage()
CREATE_PAGE;
{
- Okular::RegularAreaRect* result = tp->findText(0, "a",
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("a"),
Okular::FromTop, Qt::CaseSensitive, NULL);
QVERIFY(result);
delete result;
}
{
- Okular::RegularAreaRect* result = tp->findText(0, "a",
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("a"),
Okular::FromBottom, Qt::CaseSensitive, NULL);
QVERIFY(result);
delete result;
@@ -382,8 +382,8 @@ void SearchTest::testOneColumn()
//and the horizontal spaces in the example are 0.1, so they are indeed both exactly 100 pixels.)
QVector<QString> text;
- text << "Only" << "one" << "column"
- << "here";
+ text << QStringLiteral("Only") << QStringLiteral("one") << QStringLiteral("column")
+ << QStringLiteral("here");
//characters and line breaks have length 0.05, word breaks 0.1
QVector<Okular::NormalizedRect> rect;
@@ -394,7 +394,7 @@ void SearchTest::testOneColumn()
CREATE_PAGE;
- Okular::RegularAreaRect* result = tp->findText(0, "Only one column",
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("Only one column"),
Okular::FromTop, Qt::CaseSensitive, NULL);
QVERIFY(result);
delete result;
@@ -407,8 +407,8 @@ void SearchTest::testTwoColumns()
//Tests that the layout analysis algorithm can detect two columns.
QVector<QString> text;
- text << "This" << "text" << "in" << "two"
- << "is" << "set" << "columns.";
+ text << QStringLiteral("This") << QStringLiteral("text") << QStringLiteral("in") << QStringLiteral("two")
+ << QStringLiteral("is") << QStringLiteral("set") << QStringLiteral("columns.");
//characters, word breaks and line breaks have length 0.05
QVector<Okular::NormalizedRect> rect;
@@ -422,7 +422,7 @@ void SearchTest::testTwoColumns()
CREATE_PAGE;
- Okular::RegularAreaRect* result = tp->findText(0, "This text in",
+ Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("This text in"),
Okular::FromTop, Qt::CaseSensitive, NULL);
QVERIFY(!result);
delete result;
diff --git a/autotests/shelltest.cpp b/autotests/shelltest.cpp
index ba1aada..a63ccca 100644
--- a/autotests/shelltest.cpp
+++ b/autotests/shelltest.cpp
@@ -16,7 +16,7 @@
static const QUrl makeUrlFromCwd( const QString& u, const QString& ref = QString() )
{
- QUrl url = QUrl::fromLocalFile( QDir::currentPath() + '/' + u) ;
+ QUrl url = QUrl::fromLocalFile( QDir::currentPath() + QLatin1Char('/') + u) ;
if ( !ref.isEmpty() )
url.setFragment( ref );
url.setPath(QDir::cleanPath( url.path() ) );
diff --git a/autotests/translateannotationtest.cpp b/autotests/translateannotationtest.cpp
index 4556845..9fda65d 100644
--- a/autotests/translateannotationtest.cpp
+++ b/autotests/translateannotationtest.cpp
@@ -107,7 +107,7 @@ void TranslateAnnotationTest::cleanupTestCase()
void TranslateAnnotationTest::init()
{
- const QString testFile = KDESRCDIR "data/file1.pdf";
+ const QString testFile = QStringLiteral(KDESRCDIR "data/file1.pdf");
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess );