Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Persch
poppler
Commits
28e953cb
Commit
28e953cb
authored
Nov 07, 2018
by
Albert Astals Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor clazy Qt fixes in tests and demo
parent
74ad4e35
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
304 additions
and
244 deletions
+304
-244
qt5/demos/abstractinfodock.cpp
qt5/demos/abstractinfodock.cpp
+1
-1
qt5/demos/embeddedfiles.cpp
qt5/demos/embeddedfiles.cpp
+1
-1
qt5/demos/fonts.cpp
qt5/demos/fonts.cpp
+2
-2
qt5/demos/info.cpp
qt5/demos/info.cpp
+2
-2
qt5/demos/navigationtoolbar.cpp
qt5/demos/navigationtoolbar.cpp
+6
-3
qt5/demos/optcontent.cpp
qt5/demos/optcontent.cpp
+1
-1
qt5/demos/pageview.h
qt5/demos/pageview.h
+1
-1
qt5/demos/permissions.cpp
qt5/demos/permissions.cpp
+1
-1
qt5/demos/thumbnails.cpp
qt5/demos/thumbnails.cpp
+2
-2
qt5/demos/toc.cpp
qt5/demos/toc.cpp
+2
-2
qt5/demos/viewer.cpp
qt5/demos/viewer.cpp
+19
-15
qt5/demos/viewer.h
qt5/demos/viewer.h
+1
-1
qt5/tests/check_actualtext.cpp
qt5/tests/check_actualtext.cpp
+3
-1
qt5/tests/check_annotations.cpp
qt5/tests/check_annotations.cpp
+4
-2
qt5/tests/check_attachments.cpp
qt5/tests/check_attachments.cpp
+13
-11
qt5/tests/check_dateConversion.cpp
qt5/tests/check_dateConversion.cpp
+3
-0
qt5/tests/check_fonts.cpp
qt5/tests/check_fonts.cpp
+12
-10
qt5/tests/check_forms.cpp
qt5/tests/check_forms.cpp
+2
-0
qt5/tests/check_goostring.cpp
qt5/tests/check_goostring.cpp
+5
-3
qt5/tests/check_lexer.cpp
qt5/tests/check_lexer.cpp
+2
-0
qt5/tests/check_links.cpp
qt5/tests/check_links.cpp
+8
-6
qt5/tests/check_metadata.cpp
qt5/tests/check_metadata.cpp
+6
-4
qt5/tests/check_object.cpp
qt5/tests/check_object.cpp
+2
-0
qt5/tests/check_optcontent.cpp
qt5/tests/check_optcontent.cpp
+22
-20
qt5/tests/check_pagelabelinfo.cpp
qt5/tests/check_pagelabelinfo.cpp
+2
-0
qt5/tests/check_pagelayout.cpp
qt5/tests/check_pagelayout.cpp
+2
-0
qt5/tests/check_pagemode.cpp
qt5/tests/check_pagemode.cpp
+2
-0
qt5/tests/check_password.cpp
qt5/tests/check_password.cpp
+7
-5
qt5/tests/check_permissions.cpp
qt5/tests/check_permissions.cpp
+2
-0
qt5/tests/check_search.cpp
qt5/tests/check_search.cpp
+48
-46
qt5/tests/check_strings.cpp
qt5/tests/check_strings.cpp
+30
-27
qt5/tests/check_utf_conversion.cpp
qt5/tests/check_utf_conversion.cpp
+14
-12
qt5/tests/poppler-fonts.cpp
qt5/tests/poppler-fonts.cpp
+3
-3
qt5/tests/poppler-forms.cpp
qt5/tests/poppler-forms.cpp
+1
-1
qt5/tests/stress-poppler-dir.cpp
qt5/tests/stress-poppler-dir.cpp
+9
-9
qt5/tests/stress-poppler-qt5.cpp
qt5/tests/stress-poppler-qt5.cpp
+12
-11
qt5/tests/stress-threads-qt5.cpp
qt5/tests/stress-threads-qt5.cpp
+12
-8
qt5/tests/test-password-qt5.cpp
qt5/tests/test-password-qt5.cpp
+18
-15
qt5/tests/test-poppler-qt5.cpp
qt5/tests/test-poppler-qt5.cpp
+18
-15
qt5/tests/test-render-to-file.cpp
qt5/tests/test-render-to-file.cpp
+3
-3
No files found.
qt5/demos/abstractinfodock.cpp
View file @
28e953cb
...
...
@@ -21,7 +21,7 @@
AbstractInfoDock
::
AbstractInfoDock
(
QWidget
*
parent
)
:
QDockWidget
(
parent
),
m_filled
(
false
)
{
connect
(
this
,
SIGNAL
(
visibilityChanged
(
bool
)),
SLOT
(
slotVisibilityChanged
(
bool
))
);
connect
(
this
,
&
AbstractInfoDock
::
visibilityChanged
,
this
,
&
AbstractInfoDock
::
slotVisibilityChanged
);
}
AbstractInfoDock
::~
AbstractInfoDock
()
...
...
qt5/demos/embeddedfiles.cpp
View file @
28e953cb
...
...
@@ -59,7 +59,7 @@ void EmbeddedFilesDock::fillInfo()
m_table
->
setItem
(
i
,
3
,
new
QTableWidgetItem
(
file
->
createDate
().
toString
(
Qt
::
SystemLocaleDate
)));
m_table
->
setItem
(
i
,
4
,
new
QTableWidgetItem
(
file
->
modDate
().
toString
(
Qt
::
SystemLocaleDate
)));
const
QByteArray
checksum
=
file
->
checksum
();
const
QString
checksumString
=
!
checksum
.
isEmpty
()
?
QString
::
fromLatin1
(
checksum
.
toHex
())
:
QString
::
fromLatin1
(
"n/a"
);
const
QString
checksumString
=
!
checksum
.
isEmpty
()
?
QString
::
fromLatin1
(
checksum
.
toHex
())
:
QString
Literal
(
"n/a"
);
m_table
->
setItem
(
i
,
5
,
new
QTableWidgetItem
(
checksumString
));
++
i
;
}
...
...
qt5/demos/fonts.cpp
View file @
28e953cb
...
...
@@ -24,7 +24,7 @@
static
QString
yesNoStatement
(
bool
value
)
{
return
value
?
QString
::
fromLatin1
(
"yes"
)
:
QString
::
fromLatin1
(
"no"
);
return
value
?
QString
Literal
(
"yes"
)
:
QString
Literal
(
"no"
);
}
FontsDock
::
FontsDock
(
QWidget
*
parent
)
...
...
@@ -50,7 +50,7 @@ void FontsDock::fillInfo()
int
i
=
0
;
Q_FOREACH
(
const
Poppler
::
FontInfo
&
font
,
fonts
)
{
if
(
font
.
name
().
isNull
())
{
m_table
->
setItem
(
i
,
0
,
new
QTableWidgetItem
(
QString
::
fromLatin1
(
"[none]"
)));
m_table
->
setItem
(
i
,
0
,
new
QTableWidgetItem
(
QString
Literal
(
"[none]"
)));
}
else
{
m_table
->
setItem
(
i
,
0
,
new
QTableWidgetItem
(
font
.
name
()));
}
...
...
qt5/demos/info.cpp
View file @
28e953cb
...
...
@@ -43,8 +43,8 @@ void InfoDock::fillInfo()
m_table
->
setHorizontalHeaderLabels
(
QStringList
()
<<
tr
(
"Key"
)
<<
tr
(
"Value"
));
m_table
->
setRowCount
(
keys
.
count
());
QStringList
dateKeys
;
dateKeys
<<
QString
::
fromLatin1
(
"CreationDate"
);
dateKeys
<<
QString
::
fromLatin1
(
"ModDate"
);
dateKeys
<<
QString
Literal
(
"CreationDate"
);
dateKeys
<<
QString
Literal
(
"ModDate"
);
int
i
=
0
;
Q_FOREACH
(
const
QString
&
date
,
dateKeys
)
{
const
int
id
=
keys
.
indexOf
(
date
);
...
...
qt5/demos/navigationtoolbar.cpp
View file @
28e953cb
...
...
@@ -30,7 +30,8 @@ NavigationToolBar::NavigationToolBar(QWidget *parent)
m_firstAct
=
addAction
(
tr
(
"First"
),
this
,
SLOT
(
slotGoFirst
()));
m_prevAct
=
addAction
(
tr
(
"Previous"
),
this
,
SLOT
(
slotGoPrev
()));
m_pageCombo
=
new
QComboBox
(
this
);
connect
(
m_pageCombo
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
slotComboActivated
(
int
)));
// TODO replace with qOverload once we start requiring Qt 5.7
connect
(
m_pageCombo
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
activated
),
this
,
&
NavigationToolBar
::
slotComboActivated
);
addWidget
(
m_pageCombo
);
m_nextAct
=
addAction
(
tr
(
"Next"
),
this
,
SLOT
(
slotGoNext
()));
m_lastAct
=
addAction
(
tr
(
"Last"
),
this
,
SLOT
(
slotGoLast
()));
...
...
@@ -52,7 +53,8 @@ NavigationToolBar::NavigationToolBar(QWidget *parent)
m_zoomCombo
->
addItem
(
tr
(
"300%"
));
m_zoomCombo
->
addItem
(
tr
(
"400%"
));
m_zoomCombo
->
setCurrentIndex
(
6
);
// "100%"
connect
(
m_zoomCombo
,
SIGNAL
(
currentIndexChanged
(
QString
)),
this
,
SLOT
(
slotZoomComboChanged
(
QString
)));
// TODO replace with qOverload once we start requiring Qt 5.7
connect
(
m_zoomCombo
,
static_cast
<
void
(
QComboBox
::*
)(
const
QString
&
)
>
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
NavigationToolBar
::
slotZoomComboChanged
);
addWidget
(
m_zoomCombo
);
m_rotationCombo
=
new
QComboBox
(
this
);
...
...
@@ -61,7 +63,8 @@ NavigationToolBar::NavigationToolBar(QWidget *parent)
m_rotationCombo
->
addItem
(
trUtf8
(
"90
\302\260
"
));
m_rotationCombo
->
addItem
(
trUtf8
(
"180
\302\260
"
));
m_rotationCombo
->
addItem
(
trUtf8
(
"270
\302\260
"
));
connect
(
m_rotationCombo
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
slotRotationComboChanged
(
int
)));
// TODO replace with qOverload once we start requiring Qt 5.7
connect
(
m_rotationCombo
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
NavigationToolBar
::
slotRotationComboChanged
);
addWidget
(
m_rotationCombo
);
documentClosed
();
...
...
qt5/demos/optcontent.cpp
View file @
28e953cb
...
...
@@ -51,7 +51,7 @@ void OptContentDock::fillInfo()
}
m_view
->
setModel
(
document
()
->
optionalContentModel
());
connect
(
m_view
->
model
(),
SIGNAL
(
dataChanged
(
QModelIndex
,
QModelIndex
)),
this
,
SLOT
(
reloadImage
())
);
connect
(
m_view
->
model
(),
&
QAbstractItemModel
::
dataChanged
,
this
,
&
OptContentDock
::
reloadImage
);
m_view
->
expandToDepth
(
1
);
}
...
...
qt5/demos/pageview.h
View file @
28e953cb
...
...
@@ -38,7 +38,7 @@ public:
void
documentClosed
()
override
;
void
pageChanged
(
int
page
)
override
;
p
rivate
Q_SLOTS
:
p
ublic
Q_SLOTS
:
void
slotZoomChanged
(
qreal
value
);
void
slotRotationChanged
(
int
value
);
...
...
qt5/demos/permissions.cpp
View file @
28e953cb
...
...
@@ -41,7 +41,7 @@ void PermissionsDock::fillInfo()
do { \
QListWidgetItem *item = new QListWidgetItem(); \
item->setFlags(item->flags() & ~Qt::ItemIsEnabled); \
item->setText(title); \
item->setText(
QStringLiteral(
title)
)
; \
item->setCheckState(document()->function() ? Qt::Checked : Qt::Unchecked); \
m_table->addItem(item); \
} while (0)
...
...
qt5/demos/thumbnails.cpp
View file @
28e953cb
...
...
@@ -34,8 +34,8 @@ ThumbnailsDock::ThumbnailsDock(QWidget *parent)
m_list
->
setViewMode
(
QListView
::
ListMode
);
m_list
->
setMovement
(
QListView
::
Static
);
m_list
->
setVerticalScrollMode
(
QListView
::
ScrollPerPixel
);
connect
(
m_list
,
SIGNAL
(
itemActivated
(
QListWidgetItem
*
))
,
this
,
SLOT
(
slotItemActivated
(
QListWidgetItem
*
))
);
connect
(
m_list
,
&
QListWidget
::
itemActivated
,
this
,
&
ThumbnailsDock
::
slotItemActivated
);
}
ThumbnailsDock
::~
ThumbnailsDock
()
...
...
qt5/demos/toc.cpp
View file @
28e953cb
...
...
@@ -37,8 +37,8 @@ static void fillToc(const QDomNode &parent, QTreeWidget *tree, QTreeWidgetItem *
newitem
->
setText
(
0
,
e
.
tagName
());
bool
isOpen
=
false
;
if
(
e
.
hasAttribute
(
QString
::
fromLatin1
(
"Open"
)))
{
isOpen
=
QVariant
(
e
.
attribute
(
QString
::
fromLatin1
(
"Open"
))).
toBool
();
if
(
e
.
hasAttribute
(
QString
Literal
(
"Open"
)))
{
isOpen
=
QVariant
(
e
.
attribute
(
QString
Literal
(
"Open"
))).
toBool
();
}
if
(
isOpen
)
{
tree
->
expandItem
(
newitem
);
...
...
qt5/demos/viewer.cpp
View file @
28e953cb
...
...
@@ -43,21 +43,24 @@
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QMessageBox>
PdfViewer
::
PdfViewer
()
:
QMainWindow
(),
m_currentPage
(
0
),
m_doc
(
nullptr
)
PdfViewer
::
PdfViewer
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
m_currentPage
(
0
),
m_doc
(
nullptr
)
{
setWindowTitle
(
tr
(
"Poppler-Qt5 Demo"
));
// setup the menus
QMenu
*
fileMenu
=
menuBar
()
->
addMenu
(
tr
(
"&File"
));
m_fileOpenAct
=
fileMenu
->
addAction
(
tr
(
"&Open"
),
this
,
SLOT
(
slotOpenFile
()));
// TODO Use modern syntax when depending on Qt 5.6
m_fileOpenAct
=
fileMenu
->
addAction
(
tr
(
"&Open"
),
this
,
SLOT
(
slotOpenFile
()));
// clazy:exclude=old-style-connect
m_fileOpenAct
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
Key_O
);
fileMenu
->
addSeparator
();
m_fileSaveCopyAct
=
fileMenu
->
addAction
(
tr
(
"&Save a Copy..."
),
this
,
SLOT
(
slotSaveCopy
()));
// TODO Use modern syntax when depending on Qt 5.6
m_fileSaveCopyAct
=
fileMenu
->
addAction
(
tr
(
"&Save a Copy..."
),
this
,
SLOT
(
slotSaveCopy
()));
// clazy:exclude=old-style-connect
m_fileSaveCopyAct
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
SHIFT
+
Qt
::
Key_S
);
m_fileSaveCopyAct
->
setEnabled
(
false
);
fileMenu
->
addSeparator
();
QAction
*
act
=
fileMenu
->
addAction
(
tr
(
"&Quit"
),
qApp
,
SLOT
(
closeAllWindows
()));
// TODO Use modern syntax when depending on Qt 5.6
QAction
*
act
=
fileMenu
->
addAction
(
tr
(
"&Quit"
),
qApp
,
SLOT
(
closeAllWindows
()));
// clazy:exclude=old-style-connect
act
->
setShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Q
);
QMenu
*
viewMenu
=
menuBar
()
->
addMenu
(
tr
(
"&View"
));
...
...
@@ -65,10 +68,10 @@ PdfViewer::PdfViewer()
QMenu
*
settingsMenu
=
menuBar
()
->
addMenu
(
tr
(
"&Settings"
));
m_settingsTextAAAct
=
settingsMenu
->
addAction
(
tr
(
"Text Antialias"
));
m_settingsTextAAAct
->
setCheckable
(
true
);
connect
(
m_settingsTextAAAct
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
slotToggleTextAA
(
bool
))
);
connect
(
m_settingsTextAAAct
,
&
QAction
::
toggled
,
this
,
&
PdfViewer
::
slotToggleTextAA
);
m_settingsGfxAAAct
=
settingsMenu
->
addAction
(
tr
(
"Graphics Antialias"
));
m_settingsGfxAAAct
->
setCheckable
(
true
);
connect
(
m_settingsGfxAAAct
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
slotToggleGfxAA
(
bool
))
);
connect
(
m_settingsGfxAAAct
,
&
QAction
::
toggled
,
this
,
&
PdfViewer
::
slotToggleGfxAA
);
QMenu
*
settingsRenderMenu
=
settingsMenu
->
addMenu
(
tr
(
"Render Backend"
));
m_settingsRenderBackendGrp
=
new
QActionGroup
(
settingsRenderMenu
);
m_settingsRenderBackendGrp
->
setExclusive
(
true
);
...
...
@@ -81,12 +84,14 @@ PdfViewer::PdfViewer()
act
->
setCheckable
(
true
);
act
->
setData
(
qVariantFromValue
(
1
));
m_settingsRenderBackendGrp
->
addAction
(
act
);
connect
(
m_settingsRenderBackendGrp
,
SIGNAL
(
triggered
(
QAction
*
))
,
this
,
SLOT
(
slotRenderBackend
(
QAction
*
))
);
connect
(
m_settingsRenderBackendGrp
,
&
QActionGroup
::
triggered
,
this
,
&
PdfViewer
::
slotRenderBackend
);
QMenu
*
helpMenu
=
menuBar
()
->
addMenu
(
tr
(
"&Help"
));
act
=
helpMenu
->
addAction
(
tr
(
"&About"
),
this
,
SLOT
(
slotAbout
()));
act
=
helpMenu
->
addAction
(
tr
(
"About &Qt"
),
this
,
SLOT
(
slotAboutQt
()));
// TODO Use modern syntax when depending on Qt 5.6
act
=
helpMenu
->
addAction
(
tr
(
"&About"
),
this
,
SLOT
(
slotAbout
()));
// clazy:exclude=old-style-connect
// TODO Use modern syntax when depending on Qt 5.6
act
=
helpMenu
->
addAction
(
tr
(
"About &Qt"
),
this
,
SLOT
(
slotAboutQt
()));
// clazy:exclude=old-style-connect
NavigationToolBar
*
navbar
=
new
NavigationToolBar
(
this
);
addToolBar
(
navbar
);
...
...
@@ -148,8 +153,8 @@ PdfViewer::PdfViewer()
obs
->
m_viewer
=
this
;
}
connect
(
navbar
,
SIGNAL
(
zoomChanged
(
qreal
)),
view
,
SLOT
(
slotZoomChanged
(
qreal
))
);
connect
(
navbar
,
SIGNAL
(
rotationChanged
(
int
))
,
view
,
SLOT
(
slotRotationChanged
(
int
))
);
connect
(
navbar
,
&
NavigationToolBar
::
zoomChanged
,
view
,
&
PageView
::
slotZoomChanged
);
connect
(
navbar
,
&
NavigationToolBar
::
rotationChanged
,
view
,
&
PageView
::
slotRotationChanged
);
// activate AA by default
m_settingsTextAAAct
->
setChecked
(
true
);
...
...
@@ -254,8 +259,7 @@ void PdfViewer::slotSaveCopy()
void
PdfViewer
::
slotAbout
()
{
const
QString
text
(
"This is a demo of the Poppler-Qt5 library."
);
QMessageBox
::
about
(
this
,
QString
::
fromLatin1
(
"About Poppler-Qt5 Demo"
),
text
);
QMessageBox
::
about
(
this
,
tr
(
"About Poppler-Qt5 Demo"
),
tr
(
"This is a demo of the Poppler-Qt5 library."
));
}
void
PdfViewer
::
slotAboutQt
()
...
...
qt5/demos/viewer.h
View file @
28e953cb
...
...
@@ -36,7 +36,7 @@ class PdfViewer : public QMainWindow
friend
class
DocumentObserver
;
public:
PdfViewer
();
PdfViewer
(
QWidget
*
parent
=
nullptr
);
~
PdfViewer
();
QSize
sizeHint
()
const
override
;
...
...
qt5/tests/check_actualtext.cpp
View file @
28e953cb
...
...
@@ -7,6 +7,8 @@
class
TestActualText
:
public
QObject
{
Q_OBJECT
public:
TestActualText
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkActualText1
();
};
...
...
@@ -20,7 +22,7 @@ void TestActualText::checkActualText1()
Poppler
::
Page
*
page
=
doc
->
page
(
0
);
QVERIFY
(
page
);
QCOMPARE
(
page
->
text
(
QRectF
()),
QString
(
"The slow brown fox jumps over the black dog."
)
);
QCOMPARE
(
page
->
text
(
QRectF
()),
Q
Latin1
String
(
"The slow brown fox jumps over the black dog."
)
);
delete
page
;
...
...
qt5/tests/check_annotations.cpp
View file @
28e953cb
...
...
@@ -13,6 +13,8 @@
class
TestAnnotations
:
public
QObject
{
Q_OBJECT
public:
TestAnnotations
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkQColorPrecision
();
void
checkFontSizeAndColor
();
...
...
@@ -38,10 +40,10 @@ void TestAnnotations::checkQColorPrecision() {
void
TestAnnotations
::
checkFontSizeAndColor
()
{
const
QString
contents
{
"foobar"
}
;
const
QString
contents
=
QStringLiteral
(
"foobar"
)
;
const
std
::
vector
<
QColor
>
testColors
{
QColor
::
fromRgb
(
0xAB
,
0xCD
,
0xEF
),
QColor
::
fromCmyk
(
0xAB
,
0xBC
,
0xCD
,
0xDE
)};
const
QFont
testFont
(
"Helvetica"
,
20
);
const
QFont
testFont
(
QStringLiteral
(
"Helvetica"
)
,
20
);
QTemporaryFile
tempFile
;
QVERIFY
(
tempFile
.
open
());
...
...
qt5/tests/check_attachments.cpp
View file @
28e953cb
...
...
@@ -7,6 +7,8 @@
class
TestAttachments
:
public
QObject
{
Q_OBJECT
public:
TestAttachments
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkNoAttachments
();
void
checkAttach1
();
...
...
@@ -39,7 +41,7 @@ void TestAttachments::checkAttach1()
QCOMPARE
(
fileList
.
size
(),
2
);
Poppler
::
EmbeddedFile
*
embfile
=
fileList
.
at
(
0
);
QCOMPARE
(
embfile
->
name
(),
QString
(
"kroller.png"
)
);
QCOMPARE
(
embfile
->
name
(),
Q
Latin1
String
(
"kroller.png"
)
);
QCOMPARE
(
embfile
->
description
(),
QString
()
);
QCOMPARE
(
embfile
->
createDate
(),
QDateTime
(
QDate
(),
QTime
()
)
);
QCOMPARE
(
embfile
->
modDate
(),
QDateTime
(
QDate
(),
QTime
()
)
);
...
...
@@ -53,7 +55,7 @@ void TestAttachments::checkAttach1()
Poppler
::
EmbeddedFile
*
embfile2
=
fileList
.
at
(
1
);
QCOMPARE
(
embfile2
->
name
(),
QString
(
"gnome-64.gif"
)
);
QCOMPARE
(
embfile2
->
name
(),
Q
Latin1
String
(
"gnome-64.gif"
)
);
QCOMPARE
(
embfile2
->
description
(),
QString
()
);
QCOMPARE
(
embfile2
->
modDate
(),
QDateTime
(
QDate
(),
QTime
()
)
);
QCOMPARE
(
embfile2
->
createDate
(),
QDateTime
(
QDate
(),
QTime
()
)
);
...
...
@@ -83,21 +85,21 @@ void TestAttachments::checkAttach2()
QCOMPARE
(
fileList
.
size
(),
3
);
Poppler
::
EmbeddedFile
*
embfile1
=
fileList
.
at
(
0
);
QCOMPARE
(
embfile1
->
name
(),
QString
(
"Acro7 thoughts"
)
);
QCOMPARE
(
embfile1
->
name
(),
Q
Latin1
String
(
"Acro7 thoughts"
)
);
QCOMPARE
(
embfile1
->
description
(),
QString
()
);
QCOMPARE
(
embfile1
->
createDate
(),
QDateTime
(
QDate
(
2003
,
8
,
4
),
QTime
(
13
,
54
,
54
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile1
->
modDate
(),
QDateTime
(
QDate
(
2003
,
8
,
4
),
QTime
(
14
,
15
,
27
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile1
->
mimeType
(),
QString
(
"text/xml"
)
);
QCOMPARE
(
embfile1
->
mimeType
(),
Q
Latin1
String
(
"text/xml"
)
);
Poppler
::
EmbeddedFile
*
embfile2
=
fileList
.
at
(
1
);
QCOMPARE
(
embfile2
->
name
(),
QString
(
"acro transitions 1.xls"
)
);
QCOMPARE
(
embfile2
->
name
(),
Q
Latin1
String
(
"acro transitions 1.xls"
)
);
QCOMPARE
(
embfile2
->
description
(),
QString
()
);
QCOMPARE
(
embfile2
->
createDate
(),
QDateTime
(
QDate
(
2003
,
7
,
18
),
QTime
(
21
,
7
,
16
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile2
->
modDate
(),
QDateTime
(
QDate
(
2003
,
7
,
22
),
QTime
(
13
,
4
,
40
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile2
->
mimeType
(),
QString
(
"application/excel"
)
);
QCOMPARE
(
embfile2
->
mimeType
(),
Q
Latin1
String
(
"application/excel"
)
);
Poppler
::
EmbeddedFile
*
embfile3
=
fileList
.
at
(
2
);
QCOMPARE
(
embfile3
->
name
(),
QString
(
"apago_pdfe_wide.gif"
)
);
QCOMPARE
(
embfile3
->
name
(),
Q
Latin1
String
(
"apago_pdfe_wide.gif"
)
);
QCOMPARE
(
embfile3
->
description
(),
QString
()
);
QCOMPARE
(
embfile3
->
createDate
(),
QDateTime
(
QDate
(
2003
,
1
,
31
),
QTime
(
15
,
54
,
29
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile3
->
modDate
(),
QDateTime
(
QDate
(
2003
,
1
,
31
),
QTime
(
15
,
52
,
58
),
Qt
::
UTC
)
);
...
...
@@ -120,7 +122,7 @@ void TestAttachments::checkAttach3()
QCOMPARE
(
fileList
.
size
(),
1
);
Poppler
::
EmbeddedFile
*
embfile
=
fileList
.
at
(
0
);
QCOMPARE
(
embfile
->
name
(),
QString
(
"ADEX1.xpdf.pgp"
)
);
QCOMPARE
(
embfile
->
name
(),
Q
Latin1
String
(
"ADEX1.xpdf.pgp"
)
);
QCOMPARE
(
embfile
->
description
(),
QString
()
);
QCOMPARE
(
embfile
->
createDate
(),
QDateTime
(
QDate
(
2004
,
3
,
29
),
QTime
(
19
,
37
,
16
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile
->
modDate
(),
QDateTime
(
QDate
(
2004
,
3
,
29
),
QTime
(
19
,
37
,
16
),
Qt
::
UTC
)
);
...
...
@@ -143,11 +145,11 @@ void TestAttachments::checkAttach4()
QCOMPARE
(
fileList
.
size
(),
1
);
Poppler
::
EmbeddedFile
*
embfile
=
fileList
.
at
(
0
);
QCOMPARE
(
embfile
->
name
(),
QString
(
"export-altona.csv"
)
);
QCOMPARE
(
embfile
->
description
(),
QString
(
"Altona Export"
)
);
QCOMPARE
(
embfile
->
name
(),
Q
Latin1
String
(
"export-altona.csv"
)
);
QCOMPARE
(
embfile
->
description
(),
Q
Latin1
String
(
"Altona Export"
)
);
QCOMPARE
(
embfile
->
createDate
(),
QDateTime
(
QDate
(
2005
,
8
,
30
),
QTime
(
20
,
49
,
35
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile
->
modDate
(),
QDateTime
(
QDate
(
2005
,
8
,
30
),
QTime
(
20
,
49
,
52
),
Qt
::
UTC
)
);
QCOMPARE
(
embfile
->
mimeType
(),
QString
(
"application/vnd.ms-excel"
)
);
QCOMPARE
(
embfile
->
mimeType
(),
Q
Latin1
String
(
"application/vnd.ms-excel"
)
);
delete
doc
;
}
...
...
qt5/tests/check_dateConversion.cpp
View file @
28e953cb
...
...
@@ -8,6 +8,9 @@ Q_DECLARE_METATYPE(QTime)
class
TestDateConv
:
public
QObject
{
Q_OBJECT
public:
TestDateConv
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{}
private
slots
:
void
initTestCase
();
void
checkDates_data
();
...
...
qt5/tests/check_fonts.cpp
View file @
28e953cb
...
...
@@ -7,6 +7,8 @@
class
TestFontsData
:
public
QObject
{
Q_OBJECT
public:
TestFontsData
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkNoFonts
();
void
checkType1
();
...
...
@@ -72,9 +74,9 @@ void TestFontsData::checkType1()
QList
<
Poppler
::
FontInfo
>
listOfFonts
=
doc
->
fonts
();
QCOMPARE
(
listOfFonts
.
size
(),
1
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
name
(),
QString
(
"Helvetica"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
name
(),
Q
Latin1
String
(
"Helvetica"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
type
(),
Poppler
::
FontInfo
::
Type1
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
typeName
(),
QString
(
"Type 1"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
typeName
(),
Q
Latin1
String
(
"Type 1"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
isEmbedded
(),
false
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
isSubset
(),
false
);
...
...
@@ -90,16 +92,16 @@ void TestFontsData::checkType3()
QList
<
Poppler
::
FontInfo
>
listOfFonts
=
doc
->
fonts
();
QCOMPARE
(
listOfFonts
.
size
(),
2
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
name
(),
QString
(
"Helvetica"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
name
(),
Q
Latin1
String
(
"Helvetica"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
type
(),
Poppler
::
FontInfo
::
Type1
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
typeName
(),
QString
(
"Type 1"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
typeName
(),
Q
Latin1
String
(
"Type 1"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
isEmbedded
(),
false
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
isSubset
(),
false
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
name
(),
QString
(
""
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
name
(),
QString
()
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
type
(),
Poppler
::
FontInfo
::
Type3
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
typeName
(),
QString
(
"Type 3"
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
typeName
(),
Q
Latin1
String
(
"Type 3"
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
isEmbedded
(),
true
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
isSubset
(),
false
);
...
...
@@ -115,16 +117,16 @@ void TestFontsData::checkTrueType()
QList
<
Poppler
::
FontInfo
>
listOfFonts
=
doc
->
fonts
();
QCOMPARE
(
listOfFonts
.
size
(),
2
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
name
(),
QString
(
"Arial-BoldMT"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
name
(),
Q
Latin1
String
(
"Arial-BoldMT"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
type
(),
Poppler
::
FontInfo
::
TrueType
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
typeName
(),
QString
(
"TrueType"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
typeName
(),
Q
Latin1
String
(
"TrueType"
)
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
isEmbedded
(),
false
);
QCOMPARE
(
listOfFonts
.
at
(
0
).
isSubset
(),
false
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
name
(),
QString
(
"ArialMT"
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
name
(),
Q
Latin1
String
(
"ArialMT"
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
type
(),
Poppler
::
FontInfo
::
TrueType
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
typeName
(),
QString
(
"TrueType"
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
typeName
(),
Q
Latin1
String
(
"TrueType"
)
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
isEmbedded
(),
false
);
QCOMPARE
(
listOfFonts
.
at
(
1
).
isSubset
(),
false
);
...
...
qt5/tests/check_forms.cpp
View file @
28e953cb
...
...
@@ -7,6 +7,8 @@
class
TestForms
:
public
QObject
{
Q_OBJECT
public:
TestForms
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
testCheckbox
();
// Test for issue #655
};
...
...
qt5/tests/check_goostring.cpp
View file @
28e953cb
...
...
@@ -6,6 +6,8 @@
class
TestGooString
:
public
QObject
{
Q_OBJECT
public:
TestGooString
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
testInsertData_data
();
void
testInsertData
();
...
...
@@ -83,19 +85,19 @@ void TestGooString::testFormat()
{
const
QScopedPointer
<
GooString
>
goo
(
GooString
::
format
(
"{0:ud} {1:d} {2:d}"
,
UINT_MAX
,
INT_MAX
,
INT_MIN
));
const
QByteArray
expected
=
QString
(
"%1 %2 %3"
).
arg
(
UINT_MAX
).
arg
(
INT_MAX
).
arg
(
INT_MIN
).
toLatin1
();
const
QByteArray
expected
=
QString
Literal
(
"%1 %2 %3"
).
arg
(
UINT_MAX
).
arg
(
INT_MAX
).
arg
(
INT_MIN
).
toLatin1
();
QCOMPARE
(
goo
->
getCString
(),
expected
.
constData
());
}
{
const
QScopedPointer
<
GooString
>
goo
(
GooString
::
format
(
"{0:uld} {1:ld} {2:ld}"
,
ULONG_MAX
,
LONG_MAX
,
LONG_MIN
));
const
QByteArray
expected
=
QString
(
"%1 %2 %3"
).
arg
(
ULONG_MAX
).
arg
(
LONG_MAX
).
arg
(
LONG_MIN
).
toLatin1
();
const
QByteArray
expected
=
QString
Literal
(
"%1 %2 %3"
).
arg
(
ULONG_MAX
).
arg
(
LONG_MAX
).
arg
(
LONG_MIN
).
toLatin1
();
QCOMPARE
(
goo
->
getCString
(),
expected
.
constData
());
}
{
const
QScopedPointer
<
GooString
>
goo
(
GooString
::
format
(
"{0:ulld} {1:lld} {2:lld}"
,
ULLONG_MAX
,
LLONG_MAX
,
LLONG_MIN
));
const
QByteArray
expected
=
QString
(
"%1 %2 %3"
).
arg
(
ULLONG_MAX
).
arg
(
LLONG_MAX
).
arg
(
LLONG_MIN
).
toLatin1
();
const
QByteArray
expected
=
QString
Literal
(
"%1 %2 %3"
).
arg
(
ULLONG_MAX
).
arg
(
LLONG_MAX
).
arg
(
LLONG_MIN
).
toLatin1
();
QCOMPARE
(
goo
->
getCString
(),
expected
.
constData
());
}
{
...
...
qt5/tests/check_lexer.cpp
View file @
28e953cb
...
...
@@ -6,6 +6,8 @@
class
TestLexer
:
public
QObject
{
Q_OBJECT
public:
TestLexer
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
testNumbers
();
};
...
...
qt5/tests/check_links.cpp
View file @
28e953cb
...
...
@@ -7,6 +7,8 @@
class
TestLinks
:
public
QObject
{
Q_OBJECT
public:
TestLinks
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkDocumentWithNoDests
();
void
checkDests_xr01
();
...
...
@@ -31,7 +33,7 @@ void TestLinks::checkDocumentWithNoDests()
QVERIFY
(
doc
);
std
::
unique_ptr
<
Poppler
::
LinkDestination
>
dest
;
dest
.
reset
(
doc
->
linkDestination
(
"no.dests.in.this.document"
)
);
dest
.
reset
(
doc
->
linkDestination
(
QStringLiteral
(
"no.dests.in.this.document"
)
)
);
QVERIFY
(
!
isDestinationValid_pageNumber
(
dest
.
get
(),
doc
)
);
QVERIFY
(
isDestinationValid_name
(
dest
.
get
()
)
);
...
...
@@ -56,7 +58,7 @@ void TestLinks::checkDests_xr01()
const
Poppler
::
LinkDestination
dest
=
link
->
destination
();
QVERIFY
(
!
isDestinationValid_pageNumber
(
&
dest
,
doc
)
);
QVERIFY
(
isDestinationValid_name
(
&
dest
)
);
QCOMPARE
(
dest
.
destinationName
(),
Q
String
::
from
Latin1
(
"section.1"
)
);
QCOMPARE
(
dest
.
destinationName
(),
QLatin1
String
(
"section.1"
)
);
}
{
...
...
@@ -65,7 +67,7 @@ void TestLinks::checkDests_xr01()
const
Poppler
::
LinkDestination
dest
=
link
->
destination
();
QVERIFY
(
!
isDestinationValid_pageNumber
(
&
dest
,
doc
)
);
QVERIFY
(
isDestinationValid_name
(
&
dest
)
);
QCOMPARE
(
dest
.
destinationName
(),
Q
String
::
from
Latin1
(
"section.2"
)
);
QCOMPARE
(
dest
.
destinationName
(),
QLatin1
String
(
"section.2"
)
);
}
qDeleteAll
(
links
);
...
...
@@ -80,13 +82,13 @@ void TestLinks::checkDests_xr02()
QVERIFY
(
doc
);
std
::
unique_ptr
<
Poppler
::
LinkDestination
>
dest
;
dest
.
reset
(
doc
->
linkDestination
(
"section.1"
)
);
dest
.
reset
(
doc
->
linkDestination
(
QStringLiteral
(
"section.1"
)
)
);
QVERIFY
(
isDestinationValid_pageNumber
(
dest
.
get
(),
doc
)
);
QVERIFY
(
!
isDestinationValid_name
(
dest
.
get
()
)
);
dest
.
reset
(
doc
->
linkDestination
(
"section.2"
)
);
dest
.
reset
(
doc
->
linkDestination
(
QStringLiteral
(
"section.2"
)
)
);
QVERIFY
(
isDestinationValid_pageNumber
(
dest
.
get
(),
doc
)
);
QVERIFY
(
!
isDestinationValid_name
(
dest
.
get
()
)
);
dest
.
reset
(
doc
->
linkDestination
(
"section.3"
)
);
dest
.
reset
(
doc
->
linkDestination
(
QStringLiteral
(
"section.3"
)
)
);
QVERIFY
(
!
isDestinationValid_pageNumber
(
dest
.
get
(),
doc
)
);
QVERIFY
(
isDestinationValid_name
(
dest
.
get
()
)
);
...
...
qt5/tests/check_metadata.cpp
View file @
28e953cb
...
...
@@ -5,6 +5,8 @@
class
TestMetaData
:
public
QObject
{
Q_OBJECT
public:
TestMetaData
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkStrings_data
();
void
checkStrings
();
...
...
@@ -85,8 +87,8 @@ void TestMetaData::checkStringKeys()
QVERIFY
(
doc
);
QStringList
keyList
;
keyList
<<
"Title"
<<
"Author"
<<
"Creator"
<<
"Keywords"
<<
"CreationDate"
;
keyList
<<
"Producer"
<<
"ModDate"
<<
"Custom1"
<<
"Custom2"
;
keyList
<<
QStringLiteral
(
"Title"
)
<<
QStringLiteral
(
"Author"
)
<<
QStringLiteral
(
"Creator"
)
<<
QStringLiteral
(
"Keywords"
)
<<
QStringLiteral
(
"CreationDate"
)
;
keyList
<<
QStringLiteral
(
"Producer"
)
<<
QStringLiteral
(
"ModDate"
)
<<
QStringLiteral
(
"Custom1"
)
<<
QStringLiteral
(
"Custom2"
)
;
keyList
.
sort
();
QStringList
keysInDoc
=
doc
->
infoKeys
();
keysInDoc
.
sort
();
...
...
@@ -147,8 +149,8 @@ void TestMetaData::checkDate()
doc
=
Poppler
::
Document
::
load
(
TESTDATADIR
"/unittestcases/truetype.pdf"
);
QVERIFY
(
doc
);
QCOMPARE
(
doc
->
date
(
"ModDate"
),
QDateTime
(
QDate
(
2005
,
12
,
5
),
QTime
(
9
,
44
,
46
),
Qt
::
UTC
)
);
QCOMPARE
(
doc
->
date
(
"CreationDate"
),
QDateTime
(
QDate
(
2005
,
8
,
13
),
QTime
(
1
,
12
,
11
),
Qt
::
UTC
)
);
QCOMPARE
(
doc
->
date
(
QStringLiteral
(
"ModDate"
)
)
,
QDateTime
(
QDate
(
2005
,
12
,
5
),
QTime
(
9
,
44
,
46
),
Qt
::
UTC
)
);
QCOMPARE
(
doc
->
date
(
QStringLiteral
(
"CreationDate"
)
)
,
QDateTime
(
QDate
(
2005
,
8
,
13
),
QTime
(
1
,
12
,
11
),
Qt
::
UTC
)
);
delete
doc
;
}
...
...
qt5/tests/check_object.cpp
View file @
28e953cb
...
...
@@ -6,6 +6,8 @@
class
TestObject
:
public
QObject
{
Q_OBJECT
public:
TestObject
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
benchDefaultConstructor
();
void
benchMoveConstructor
();
...
...
qt5/tests/check_optcontent.cpp
View file @
28e953cb
...
...
@@ -8,6 +8,8 @@
class
TestOptionalContent
:
public
QObject
{
Q_OBJECT
public:
TestOptionalContent
(
QObject
*
parent
=
nullptr
)
:
QObject
(
parent
)
{
}
private
slots
:
void
checkVisPolicy
();
void
checkNestedLayers
();
...
...
@@ -28,10 +30,10 @@ void TestOptionalContent::checkVisPolicy()
Poppler
::
OptContentModel
*
optContent
=
doc
->
optionalContentModel
();
QModelIndex
index
;
index
=
optContent
->
index
(
0
,
0
,
QModelIndex
()
);
QCOMPARE
(
optContent
->
data
(
index
,
Qt
::
DisplayRole
).
toString
(),
QString
(
"A"
)
);
QCOMPARE
(
optContent
->
data
(
index
,
Qt
::
DisplayRole
).
toString
(),
Q
Latin1
String
(
"A"
)
);
QCOMPARE
(
static_cast
<
Qt
::
CheckState
>
(
optContent
->
data
(
index
,
Qt
::
CheckStateRole
).
toInt
()
),
Qt
::
Checked
);
index
=
optContent
->
index
(
1
,
0
,
QModelIndex
()
);