PdfFile/test: CMake wiring + fixture investigation#105
Open
juliusknorr wants to merge 2 commits into
Open
Conversation
9f3a01c to
6acced3
Compare
Member
Author
|
🏓 for review. Will rebase and resolve conflicts before merging as every of the test prs conflicts |
Add a CMakeLists.txt for PdfFile/test that mirrors the qmake test.pro ADD_DEPENDENCY line (UnicodeConverter, kernel, graphics, PdfFile, DjVuFile, ooxmlsignature) and builds the suite via add_core_gtest with GTEST_MAIN (test.cpp has no own main()). All six dependencies map to existing CMake library targets, so no dependency porting is required. The suite's runtime fixtures (test.pdf, base64.txt, pdf.bin, pfx.pfx, test.djvu, changes.bin, test.jpeg, resI/) are not committed to the repo. Every test case self-skips except CPdfFileTest.EditPdfFromBase64, which would hard-fail without test.pdf/base64.txt. That single case is excluded with GTEST_FILTER so the suite builds, links and runs green; the remaining cases report as skipped. Registered in the top-level EO_BUILD_TESTS block. Update TESTING.md: move PdfFile/test to Done with the full fixture catalogue (inputs vs intermediates vs outputs) and the exact steps to fully enable it. Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: Claude Code:Opus 4.8
GoogleTest only defines EXPECT_HRESULT_SUCCEEDED/ASSERT_HRESULT_SUCCEEDED on Windows. The PdfFile suite uses them, so it failed to compile on the Linux CI build with "use of undeclared identifier 'EXPECT_HRESULT_SUCCEEDED'". Add portable definitions (HRESULT success is >= 0 on all platforms) so the suite compiles. The affected cases still GTEST_SKIP() at runtime pending fixtures. Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: Claude Code:Opus 4.8
6acced3 to
b994641
Compare
DmySyz
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the qmake
PdfFile/test/test.proGoogleTest suite to a CMake/CTest target and documents the fixture situation.PdfFile/test/CMakeLists.txt:project(pdffile_test),CORE_ROOT_DIR = ../..,include(common.cmake), guard-added deps,add_core_gtest(NAME pdffile_test SOURCES test.cpp LIBS ... GTEST_MAIN GTEST_FILTER ...).test.cpphas no ownmain(), soGTEST_MAINis used.CMakeLists.txtif(EO_BUILD_TESTS)block, after the existing four suites.TESTING.mdupdated with the full fixture catalogue and exact steps to fully enable.Dependencies
test.pro'sADD_DEPENDENCY(UnicodeConverter, kernel, graphics, PdfFile, DjVuFile, ooxmlsignature)maps cleanly to existing CMake targets — no dependency lacks a CMake target, so no library porting is needed:UnicodeConverterCommonDesktopEditor/graphics/cmakePdfFileDjVuFileDesktopEditor/xmlsec/srcGating decision
Registered live, but with one case excluded via
GTEST_FILTERto keep CI green.Every test case in
test.cppcallsGTEST_SKIP()at the top exceptCPdfFileTest.EditPdfFromBase64, whoseGTEST_SKIP()is commented out. That case callsLoadFromFile()(anASSERT_TRUEon loading the missingtest.pdf) and opensbase64.txt, so it would hard-fail headless. It is excluded withGTEST_FILTER "-CPdfFileTest.EditPdfFromBase64". The suite then builds, links and runs cleanly (remaining cases report as skipped), so it gates the build/link without turning CI red.Missing fixtures (none present anywhere in the repo)
Inputs:
test.pdf,base64.txt,pdf.bin,pfx.pfx(PKCS#12, password123456),test.djvu,changes.bin,test.jpeg(used byEditPdfSign; not in the original blocker list), and anresI/directory of reference PNGs forImgDiff.Intermediate:
ONLYOFFICEFORM.docxf(produced byGetMetaData, consumed bySetMetaData).Outputs (generated at runtime, not required inputs):
test2.pdf,test3.pdf,test_split.pdf,pdftemp/,resO/,resD/,fonts_cache/,resPdfBinToPng.png.To fully enable
Commit the input fixtures above, stage them next to the test binary (the suite reads from
NSFile::GetProcessDirectory(), so useWORKING_DIRECTORYplus aPOST_BUILD copy_directory), drop theGTEST_FILTER, and un-GTEST_SKIP()the desired cases.Build/CI note
There is no vcpkg toolchain locally (
VCPKG_ROOTunset), so this could not be fully configured/built here. The PR's CI is the gate: configure with-DVCPKG_MANIFEST_FEATURES=tests -DEO_BUILD_TESTS=ON, build, thenctest --output-on-failure.https://claude.ai/code/session_01TJrhgZT4PwYaBKWiUCXmGg
Generated by Claude Code