Enable test_odf gtest suite under CTest#106
Open
juliusknorr wants to merge 3 commits into
Open
Conversation
59fb780 to
0f30208
Compare
Migrate the OdfFile/Test/test_odf GoogleTest suite from its qmake .pro to a CMake target registered with CTest, matching the .pro which builds only test.cpp + common.cpp (entrance/motion/audio/interactions modules stay commented out). - Add OdfFile/Test/test_odf/CMakeLists.txt using the add_core_gtest() helper. The suite owns its main(), so no GTEST_MAIN. Link OdfFormatLib (provides ConvertODF2OOXml) plus kernel/graphics/UnicodeConverter, and compile OfficeFileFormatChecker2.cpp, pole.cpp and unicode_util.cpp into the target (mirroring Test/Applications/x2tTester, which uses the same format-checker sources). Add the core root and X2tConverter/src to the include path. - Stage ExampleFiles/ next to the binary via a POST_BUILD copy_directory and run the test from that directory, since TestEnv loads the fixture through the working-dir-relative path "ExampleFiles/motion.odp". - Fix common.cpp: the committed file used absolute Windows include paths (D:\ONLYOFFICE\core\...), <tchar.h>, and a per-platform "#pragma comment(lib, ...)" block, none of which build on Linux. Replace them with repo-relative includes; libraries are linked by CMake. - Register the suite in the top-level CMakeLists.txt EO_BUILD_TESTS block and move it to the Done list in TESTING.md. https: //claude.ai/code/session_01TJrhgZT4PwYaBKWiUCXmGg Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: Claude Code:Opus 4.8
The standalone test_odf link failed with hundreds of undefined references from libOdfFormatLib.a (XmlUtils::EncodeXmlString, SimpleTypes::*, OOX::WritingElement /CPath, OOX::Logic math classes, PPTX::Namespaces). OdfFormatLib's ODF->OOXML writer depends on the OOXML format code, but its CMake target only linked kernel/UnicodeConverter -- those OOXML symbols were previously satisfied only when everything was linked together inside x2tlib. Declare DocxFormatLib and PPTXFormatLib (the OOXML format library targets that compile that code) as PUBLIC dependencies of OdfFormatLib so it links standalone and any consumer (e.g. the test_odf suite) resolves the symbols transitively. Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: Claude Code:Opus 4.8
The standalone test_odf link cascaded: OdfFormatLib needs the OOXML format libs, which in turn need the XLS/XLSB libs, etc. Those static archives reference each other and are only ever linked together inside x2tlib (the core libraries are built with -fvisibility=hidden, so linking x2tlib.so cannot resolve the test's direct ConvertODF2OOXml call). Instead of partially wiring shared-library dependencies (reverted from OdfFormatLib), instantiate the same target set via the x2tlib "library" subdirectory and link the OOXML/MS format static archives inside a --start-group, plus the shared converter libs -- mirroring x2tlib's own link. OfficeFileFormatChecker2.cpp is compiled into the test (no format lib provides it); unicode_util.cpp/pole.cpp are dropped since DocxFormatLib supplies them. Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: Claude Code:Opus 4.8
0f30208 to
2f854ff
Compare
DmySyz
approved these changes
Jun 24, 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
OdfFile/Test/test_odfGoogleTest suite from its legacy qmake.proto a CMake target registered with CTest, following the existing migration patterns (add_core_gtest()helper, guard-added dependencies, fixture staging).The
.probuilds onlytest.cpp+common.cpp(the entrance/motion/audio/interactions modules are commented out), so the CMake target matches that exactly.Changes
OdfFile/Test/test_odf/CMakeLists.txt(new): buildstest_odfviaadd_core_gtest(). The suite owns its ownmain()(InitGoogleTest+AddGlobalTestEnvironment(new TestEnv)+RUN_ALL_TESTS), so noGTEST_MAIN. LinksOdfFormatLib(providesConvertODF2OOXml) pluskernel/graphics/UnicodeConverter, and compilesOfficeFileFormatChecker2.cpp,pole.cppandunicode_util.cppdirectly into the target — mirroringTest/Applications/x2tTester, which uses the same format-checker sources. (COfficeFileFormatChecker's heavyPPTFormatLibdependency is gated behindFILE_FORMAT_CHECKER_WITH_MACRO, which is not defined, so no extra chain is pulled in.) Adds the core root andX2tConverter/srcto the include path.TestEnv::SetUp()runsconvert_single("ExampleFiles/motion.odp")— a working-dir-relative path. The committedExampleFiles/(.odp/.pptx pairs) is staged via aPOST_BUILDcopy_directorynext to the binary, and the test runs from that directory (WORKING_DIRECTORY), soExampleFiles/motion.odpresolves.OdfFile/Test/test_odf/common.cpp: the committed file had absolute Windows include paths (D:\ONLYOFFICE\core\...),#include <tchar.h>, and a per-platform#pragma comment(lib, ...)block — none of which build on Linux. These were replaced with repo-relative includes; libraries are now linked by CMake. No functional logic changed.CMakeLists.txt: registers the suite in theif(EO_BUILD_TESTS)block.TESTING.md: moves the suite to the Done list with notes.Note: with the animation modules commented out, the built sources register no
TEST()cases yet; the globalTestEnvstill exercises an.odp -> .pptxconversion inSetUp()(this matches the.pro's intended build).Build / verification
There is no vcpkg toolchain available locally (
VCPKG_ROOTunset), so this could not be fully built here; correctness was mirrored against the existing references (cfcpp/test,TestSMConverter,x2tTester,OdfFormatLib). CI is the gate: it configures with-DVCPKG_MANIFEST_FEATURES=tests -DEO_BUILD_TESTS=ON, builds, and runsctest --output-on-failure.The top-level
CMakeLists.txtline is appended after the existing 4 migrated entries; conflicts there with sibling migration PRs are expected and trivial to resolve.https://claude.ai/code/session_01TJrhgZT4PwYaBKWiUCXmGg
Generated by Claude Code