summaryrefslogtreecommitdiff
path: root/tests/auto/pdf
Commit message (Collapse)AuthorAgeFilesLines
* QPdfNavigator: emit forward/backAvailableChanged when jumping pagesJoni Poikelin2023-04-204-1/+87
| | | | | | | | | | | | | | QPdfPageNavigator did not emit the page history signals when pages were jumped. This patch ensures correct signal emission in all cases. It adds a new auto test class for QPdfPageNavigator. Fixes: QTBUG-112614 Pick-to: 6.5 6.2 Change-Id: I67af5a4d22a8e76b9c12c72c168fa5b3b4390f2c Reviewed-by: Yigit Akcay <yigit.akcay@qt.io> Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Add TESTDATA to qtpdf tests and fix data urlMichal Klocek2023-02-234-0/+11
| | | | | | | | | | Make cmake aware of test data, this will make data deployable on android. Task-number: QTBUG-83459 Change-Id: Id4271f54f8351e955a6ee57c3a36656d69a2a682 Reviewed-by: Michael Brüning <michael.bruning@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Route Qt::TimeSpec usage via QTimeZoneEdward Welbourne2022-12-121-2/+6
| | | | | | | | QTimeZone now packages Qt::TimeSpec details, unifying QDateTime APIs. Task-number: QTBUG-108199 Change-Id: I62d9837fac01b5d95e9fd0cff034cb450854c9e7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size() - V4Marc Mutz2022-10-113-41/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I3e6fef8eca212da0c4f0b464545ba96183b4476f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix locally falling tst_qpdfdocument on qemuMichal Klocek2022-09-151-1/+1
| | | | | | | | | | Use name for temporary file otherwise is can not be opened on qemu. Task-number: QTBUG-105342 Pick-to: 6.4 6.3 Change-Id: I7f9ed244c32b866ead6832ed942e2293be24811b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-265-5/+5
| | | | | | Task-number: QTBUG-105718 Change-Id: I2ad190e5536cdbdc8d2656e61892545d66911a02 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-284-4/+4
| | | | | Change-Id: I31bd3dd7d7be0f32b999b3874cc996815758c146 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-075-0/+15
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I118bd63694cfe2c9a413af4a38828a31727f8e86 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-224-152/+8
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I869ffda1080e283f231eb0dc4477b260f2054d99 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add QPdfDocument::pageLabel(int) and pageModel propertyShawn Rutledge2022-06-042-0/+11
| | | | | | | | | | | This API is available for both C++ and QML. The pageModel makes it easier to populate item-views with per-page information, such as thumbnails labeled with page labels. Fixes: QTBUG-102271 Change-Id: I70df481b378efed0327e7bb89a63c7669daecc70 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Renumber pages in test.pdfShawn Rutledge2022-05-311-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Give them unique labels. This was done with pdftk: $ pdftk resources/test.pdf update_info_utf8 update output test.pdf where the file "update" contains PageLabelBegin PageLabelNewIndex: 1 PageLabelStart: 1 PageLabelPrefix: Qt PageLabelNumStyle: NoNumber PageLabelBegin PageLabelNewIndex: 2 PageLabelStart: 1 PageLabelNumStyle: DecimalArabicNumerals PageLabelBegin PageLabelNewIndex: 3 PageLabelStart: 1 PageLabelNumStyle: LowercaseRomanNumerals The instructions to do this came from https://emacs.stackexchange.com/questions/58315/edit-pdf-page-labels-in-pdf-tools Task-number: QTBUG-102271 Change-Id: I97df7ca538690baf3329fcbef371dcd92c4d8966 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Rename QPdfDocument::pageSize() to QPdfDocument::pagePointSize()Shawn Rutledge2022-05-311-1/+1
| | | | | | | | It is in fact the size in points (1/72 of an inch), so we might as well be consistent about the naming between QML and C++ APIs. Change-Id: I8f8b05eeecc635a4d105558959834ae0e15add81 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Rename QPdfNavigationStack to QPdfPageNavigator; QML type tooShawn Rutledge2022-05-271-1/+1
| | | | | | | | | | | | | | | | | This might reduce some confusion about the fact that the back/forward "stack" isn't strictly a stack in the data structure sense: it's more like QUndoStack. It causes a QML source incompatibility relative to Qt 5, but keeps the C++ class name the same as it has been in QtPdf for a long time. Amends 3ad445f9f24a9d3f259ed1781460a63346a728e4 [ChangeLog][QtPDF] The PdfNavigationStack QML type has been renamed to PdfPageNavigator, matching the C++ type QPdfPageNavigator. These remember navigation history within a document, and are helpful to implement back/forward buttons similar to those on a web browser in both Qt Quick and widget-based viewer applications. Change-Id: Id8dc17aa416bb7064b1f0f300a47c07c83b7f47e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove QPdfBookmarkModel::structureModeShawn Rutledge2022-05-241-65/+0
| | | | | | | | | | | Bookmarks are naturally a tree. It's unusual for a QAIM to have the internal ability to flatten a tree to a list, and we don't need it in any of our viewers or examples. This patch could be reverted if it turns out that anybody misses this feature; or else flattening could be done in a proxy model. Change-Id: I5cf60a39cb699932cc7c61e33a5129323d648344 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfBookmarkModel: replace StructureMode enum with an enum classShawn Rutledge2022-05-241-3/+3
| | | | | Change-Id: I6335c1b13ef50dc04d50bd1ce66b3524e2615b3f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfDocument: use enum classesShawn Rutledge2022-05-243-63/+63
| | | | | Change-Id: Iad3f8da130abe86a464d63323920a2a39d6fa955 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Un-blacklist QtPdf password testsShawn Rutledge2022-05-191-6/+0
| | | | | Change-Id: Ife034dc0578268c1bed660bbacc163f393a50c29 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QPdfBookmarkModel: add location and zoom rolesShawn Rutledge2022-04-241-0/+28
| | | | | | | | | | | We need them for more accurate navigation. Switch to initializing BookmarkNode's variables where declared, while we're at it. Task-number: QTBUG-77510 Change-Id: Ia6762c9b6336c9148a85ad782e71e5b59feab754 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Turn QPdfBookmarkModel::Role into an enum classShawn Rutledge2022-04-221-36/+36
| | | | | | | | | - link, search and bookmark models have similar role names now - being an enum class allows the role name to be shorter - the Role enum name is the same as the name in roleNames(), lowercased Change-Id: I2e710d7acb8479995d82ef2d324807b6cd4e10e5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Move QQuickPdfNavStack core into QPdfNavigationStack; use in QPdfViewShawn Rutledge2022-04-084-212/+1
| | | | | | | | | | | | | | | QQuickPdfNavigationStack was implemented independently until now, but users will need the same functionality in widget-based PDF viewers. QPdfPageNavigation on the other hand may have eventually had the same aspiration, but was just a glorified up/down counter thus far, with questionable API; so we get rid of it, and make the API for page navigation as much the same as possible between Quick and Widgets. We rename push() to jump() along with removing the emitJumped argument. Now jump() always emits (so we have to be more careful when to call it). Change-Id: Icb07158a351e29b81e58ec037cd323bc0f54a1a1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QtPdf: add a very rudimentary test for QPdfSelectionMarc Mutz2022-01-041-2/+34
| | | | | | | | | | | | | ... as part of tst_QPdfDocument. The smaller QtPdf classes should probably all have their own tests. The existing tests are far from being sufficient. Pick-to: 6.3 Change-Id: I01ff2b7abbdbe43ee596d682c256001539fde1bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use up-to date LGPL license headerKai Köhne2021-12-025-55/+70
| | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. For the examples, use BSD. Change-Id: I1fae49110160c1183327ec54c9dc447c69588a65 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Nuke all qmake files from testsMichal Klocek2021-08-316-34/+0
| | | | | | Pick-to: 6.2 Change-Id: Ibad2e50d840a2eb0ccb9ac65158e512249a2bc79 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add QtPdf to cmake buildMichal Klocek2021-08-176-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Port QtPdf to Qt6: * QtPdf,QtPdfWidgets,QtPdfQuick libs * QtPdfQuickPlugin, QtPdfPlugin (imageformat) plugins * widget and quick examples * qtpdf tests To fit gn cmake integration and new repo layout code is a bit reshuffled. Compared to qmke build following features are not ported yet: * ios fat libs * qtbase 3rdparty static dependencies WebEngine build can be skipped with setting QT_FEATURE_qtwebengine_build=OFF Note this patch needs follow up for 6.2 branch to disable qtpdf builds by default, since this should not part of qt 6.2 release. Pick-to: 6.2 Task-number: QTBUG-95353 Change-Id: I4dd9f3934bdd478fb6d2fa686074a24d91f09953 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use QList instead of QVectorJarek Kobus2020-07-151-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: I666a060351f73783e15e3f96884c9393a5cd7e46 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Enum class QPdfPageRenderer::RenderModev5.15.0-beta2Allan Sandfeld Jensen2020-03-161-4/+4
| | | | | | | Avoid having the enum name in the enum values. Change-Id: Ida5b3405e6922eb1a2a37edc6fb650019254f4d4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QPdfSearchModel, QML PdfSearchModel and PdfPageViewShawn Rutledge2020-01-233-0/+74
| | | | | | | | | | | | | | | | This enables searching a PDF for a text string and getting the boundaries of the areas where it is found. The boundaries are returned as polygons intended to be rendered with PathMultiline. PdfPageView is a QML component intended to be a drop-in viewer for use in applications that need the most common PDF viewing functionality. More advanced applications are free to use it as a starting point for customization. Task-number: QTBUG-77507 Task-number: QTBUG-77514 Change-Id: Id08ac30224e41b6cdfb9300cc4288d5750259f78 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_qpdfdocument: use QElapsedTimer instead of QTimeShawn Rutledge2019-11-251-2/+1
| | | | | Change-Id: Ifdac9ae6b216605166cefc9dbab60f5ab4b1dcbf Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Add QtPdf and QtPdfWidgets modulesMichal Klocek2019-11-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds two new modules to qtwebengine repository. New modules do not depend on webengine module, however webengine chromium source code and Chromium "gn" configuration is required to build QtPdf. Adding two unrelated modules to webengine might look crazy: however sharing gn build configuration and Chromium code base with necessary qt adaptations simplifies code maintenance and minimises required code checkouts. Back porting of security patches for Chromium also affects Pdfium. Moreover, Pdfium is no longer a separate project, but integrated into Chromium: therefore moving it out of Chromium source tree would require extra effort. Rename webengine-core feature to build-qtwebengine-core, this makes consistent feature naming with build-qtpdf At the moment two new modules have integrated build, with possible shortcuts: qmake -- --no-build-qtwebengine-core qmake -- --no-build-qtpdf Webengine build is disabled by default now. Change-Id: Iac3d9927d51f3ac316db0148d275eda843dcc19b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Initial import of qtpdf source codeMichal Klocek2019-11-251-0/+0
| | | | | | | | | | | | | | | Code has been imported from git://code.qt.io/qt-labs/qtpdf to src/pdf, src/pdfwidgets, examples/pdfwidgets and tests/auto/pdf. Some git revision history was rewritten to remove conflicting files like src.pro, examples.pro, tests.pro, .gitingnore, .gitmodules, sync.profile, .qmake.conf, 3rdparty Removed unneeded leftovers after import. Change-Id: Ifc1e02828adfefe8db68d596cd2cb238de22408b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Add QPdfPageRenderer classTobias Koenig2019-11-254-1/+191
| | | | | | | | | | The QPdfPageRenderer renders a page of a QPdfDocument for a given zoom factor. Depending on its render mode, it does the rendering in the UI thread or a worker thread. Subsequent requests are queued and processed in order. Change-Id: I95820cd318cb443b2572f6d3db5a0bee53939bd1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add QPdfPageNavigation classTobias Koenig2019-11-254-1/+209
| | | | | | | | | | | | The QPdfPageNavigation class encapsulates the logic of navigating inside a QPdfDocument. It has the notion of a 'current' page and provides slots to navigate to the previous/next page or jump directly to a given page. Additionally it provides properties to indicate whether there is a previous or next page, relative to the current one. Change-Id: I053f3c49ab4a70b2610b64d96d2c274c3d0f629b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix emission of QPdfDocument::pageCountChanged signalTobias Koenig2019-11-251-0/+31
| | | | | | | | Emit the signal whenever the amount of pages changes on loading/closing the document. Change-Id: I0555a9cad93cb1f125ded19889eda91e08725592 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add 'PageNumberRole' to QPdfBookmarkModelTobias Koenig2019-11-252-0/+25
| | | | | | | | Provide the referenced page of an bookmark entry through a model role. Change-Id: Ia1657d75acf0128389ef0de896b242b4e8df87fe Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* change the license to LGPLv3 (with the commercial option)Shawn Rutledge2019-11-252-5/+57
| | | | | | Change-Id: I2caed38ece8067ecdad877dcc278f7828a3cb0bb Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Add QPdfBookmarkModel classTobias Koenig2019-11-254-1/+254
| | | | | Change-Id: I000a398d2347870916bd93b290a1ddf5023fb0ce Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Refactor the state handling of QPdfDocumentTobias Koenig2019-11-251-22/+106
| | | | | | | | Introduce a status property, which describes the current status of the QPdfDocument during loading/closing workflow. Change-Id: I2c095c41cfaacb4cd325682def71f80ffe6ab6d9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add metaData() accessor method to QPdfDocumentShawn Rutledge2019-11-252-0/+28
| | | | | Change-Id: Ib25ae8940ff8a35627093031a82c1f25c7c940fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add passwordChanged() signal to QPdfDocumentTobias Koenig2019-11-251-0/+27
| | | | | | | | The passwordChanged() signal is emitted whenever the password on the document is changed. Change-Id: I8c35274dba7160b81555eac5bbda37d47cb8c9b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add close() method to QPdfDocumentTobias Koenig2019-11-251-0/+68
| | | | | | | | | The close() method will close an open document and emit the aboutToBeClosed() signal, so that other component, which keep a pointer to QPdfDocument, can react to it. Change-Id: I93200eb0b4bf96479fc114b43c9f6f2af4d15ffa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Skip build of auto-test when print support is disabled in the Qt buildSimon Hausmann2019-11-251-1/+1
| | | | | Change-Id: I86bd5779ae4fee7dfba0b7a2121128120dbe3a5b Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
* Clean up the loadingSimon Hausmann2019-11-251-4/+11
| | | | Unify the load API and implementation to always go through FPDFAvail.
* Provide unit test for password protected PDFsSimon Hausmann2019-11-252-0/+11
|
* Keep reading until all pages are availableSimon Hausmann2019-11-251-2/+4
|
* Provide async loading through QNetworkReplySimon Hausmann2019-11-252-10/+36
|
* Allow loading documents synchronously from a QIODeviceSimon Hausmann2019-11-251-17/+32
|
* Added basic rendering and page size getterSimon Hausmann2019-11-251-2/+8
|
* Implement basic document loading from a fileSimon Hausmann2019-11-253-0/+54
|
* Re-organize the build system to turn this into a full-fledged moduleSimon Hausmann2019-11-251-0/+0