The core ships ~50 test projects historically authored as qmake .pro files; 13 are
real GoogleTest suites. CI builds core with
CMake/Ninja, so tests are being migrated to CMake targets registered with CTest —
no separate qmake build is needed. This file documents how to run them and tracks the
per-suite migration.
GoogleTest is pulled in through vcpkg via the tests manifest feature, so configure with
that feature and -DEO_BUILD_TESTS=ON:
cmake -GNinja -S . -B build \
-DVCPKG_TARGET_TRIPLET=x64-linux-dynamic \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_MANIFEST_MODE=ON -DVCPKG_MANIFEST_DIR=. \
-DVCPKG_MANIFEST_FEATURES=tests -DEO_BUILD_TESTS=ON
cmake --build build
ctest --test-dir build --output-on-failureRun a single suite:
ctest --test-dir build -R cfcpp_test --output-on-failureCI runs ctest --test-dir build --output-on-failure after the build step
(.github/workflows/build.yml); a failing assertion fails the job.
CMake already builds every core library these tests link against. To migrate a suite:
- Add a
CMakeLists.txtnext to the suite mirroring the.pro'sADD_DEPENDENCY/SOURCESlines. Pull in each dependency with a guardedif(NOT TARGET <lib>) add_subdirectory(...) endif(). - Build and register it with the
add_core_gtest()helper incommon.cmake(GTEST_MAINif the suite has nomain(),USE_GMOCKif it uses gmock, optionalWORKING_DIRECTORY). - Reproduce any extra
INCLUDEPATHfrom the.prowithtarget_include_directories. - If the suite reads fixtures, stage them next to the test (or at the path the suite
expects) with a
POST_BUILDcopy_directoryand pointWORKING_DIRECTORYat it. add_subdirectory(...)the newCMakeLists.txtfrom the top-levelCMakeLists.txtinside theif(EO_BUILD_TESTS)block.
Common/cfcpp/test/CMakeLists.txt is the reference example (own main, gmock, and
working-dir-relative fixtures).
Done:
-
CMake/CTest scaffolding —
add_core_gtest()incommon.cmake,EO_BUILD_TESTSoption (default OFF; tests are opt-in, enabled with-DEO_BUILD_TESTS=ONplus the vcpkgtestsfeature) +enable_testing()inCMakeLists.txt, CTest step in CI. -
Common/cfcpp/test -
DesktopEditor/graphics/tests/BooleanOperations_Unit-tests— deps: kernel, graphics, UnicodeConverter. No fixtures. 17/20 tests run in CI;OneIntersOutside,OneIntersInside,CurveIntersCurveare quarantined viaGTEST_FILTER(their computed boolean-path output differs from the expected paths — engine bug vs stale expectations not yet determined). See theTODOin that suite'sCMakeLists.txt. -
OdfFile/Reader/Converter/StarMath2OOXML/TestSMConverter— dep: StarMathConverter. No fixtures. -
OdfFile/Reader/Converter/StarMath2OOXML/TestEQNtoOOXML— dep: StarMathConverter. No fixtures. -
OOXML/test— most complex. Ownmain()(noGTEST_MAIN). Links the existingx2tlibshared target (X2tConverter/build/cmake) for the full converter dependency chain; adds only the dylib entry pointX2tConverter/src/dylib/x2t.cppto the test (x2tlib already compilescextracttools.cpp,ASCConverters.cpp,OfficeFileFormatChecker2.cpp, so they are not duplicated). Compiled withBUILD_X2T_AS_LIBRARY_DYLIB. Converts the fixtures undertest/ExampleFiles/(xlsb2xlsx/,xlsx2xlsb/, staged in the working directory) and compares the result with the same workbook saved by Microsoft Excel. The comparison is semantic (workbook_facts.cpp): sheets, defined names, cell values and formulas, cell formatting, merges, comments, tables, pivots, slicers and chart sheets. Byte comparison cannot work: x2t and Excel write the same content differently. For XLSX → XLSB both XLSB files are converted back to XLSX first. A category the workbook doesn't have is skipped.PivotsandSlicersofxlsx2xlsb_simple2are filtered out until #266 (flags never set in the XLSB writer) is fixed. -
X2tConverter/test/TestOOOXml2Odf(ooxml2odf_math_test) — 45 cases forStarMath::COOXml2Odf, which converts OOXML math (m:oMath) to StarMath/MathML when OdfFormatLib writes ODF. It has a.probut was missed by the first migration. Links the static format libraries in a group, liketest_odf.GTEST_MAIN(main.cpphas nomain()). No fixtures: the OOXML math is parsed from strings. -
OdfFile/Test/Test(odf_regression_test) — 54 regression cases named after bug numbers (44363, 57197, 61364: ODT → DOCX; 59708: DOCX → ODT; 69238: PPTX → ODP), inspecting the converted document through the converters' models. Only a Visual Studio project existed and the suite had never built as committed (a duplicate global inTest57197.cpp). Links the static format libraries in a group, liketest_odf; ownmain(). Fixtures underExampleFiles/are staged in the working directory. -
OfficeUtils/tests— deps: kernel, UnicodeConverter. The committedtests/zip/fixtures are staged next to the binary: the suite resolves fixtures relative to the process directory (<binary dir>/../zip), and writes itsunzip/tempoutput dirs alongside (under the build tree, so writable). -
OfficeCryptReader/tests— new suite (officecrypt_test), not a.promigration. Covers the Crypto++ based encryption inCryptTransform: decrypts ECMA-376 agile data encrypted by msoffcrypto-tool and ODF 1.2 data encrypted with Python'scryptography, verifies ECMA-376/ODF write protection hashes computed withhashlib, and round-trips agile, standard (AES, RC4) and ODF (AES, Blowfish) encryption. Deps: CryptoPPLib, kernel, UnicodeConverter, plusOOXML/Base/unicode_util.cppcompiled in. The reference data is generated intoreference_vectors.hbygenerate_vectors.py; no fixture files. -
OdfFile/Reader/Converter/SMCustomShape2OOXML/TestSMCustomShape— dep: SMCustomShape2OOXML (new CMake library target created for this suite; itself depends on UnicodeConverter, kernel). No fixtures. -
OOXML/DocxFormat/test— new suite (docx_numbering_test), not a.promigration. Added to cover a DOCX bullet/numbering-list schema-ordering fix (Microsoft 365 Online was misclassifying list types because<w:lvl>children were emitted out of ECMA-376CT_Lvlsequence). Deps: links the existingx2tlibCMake target (the same oneOOXML/testuses) —DocxFormatLibalone is not link-complete forNumbering.cpp(it pulls inLogic/SectionProperty.h, which reachesPPTXFormatandXmlUtilssymbols that onlyx2tlib's full link supplies), andPPTXFormat/Namespaces.cppis added directly as a source (a small pre-existing gap in the CMake port, unrelated to this suite).GTEST_MAIN(no ownmain()). No fixtures — constructsOOX::Numbering::CLvlobjects directly and asserts the ECMA-376CT_Lvlelement order oftoXML()'s output (including a fully-populated level covering all twelve possible child elements), plusfromXML()'s tolerance of non-schema-ordered input. -
DesktopEditor/raster/test— new suite (raster_formats_test), not a.promigration. Covers the PNM (raster/Pnm) and Sun Raster (raster/Ras) decoders that replaced CxImage's JasPer based decoding, throughCBgraFrame::Decode/OpenFileandCImageFileFormatChecker: all Netpbm variants (ASCII/binary, 16 bit, comments, row padding), RAS at 1/8/24/32 bit, BGR and RGB types, color maps and RLE, plus truncated and oversized input. Also covers CxImage's JPEG codec on libjpeg-turbo: baseline, progressive, arithmetic, grayscale and Adobe CMYK decoding in both channel orders, partial decoding of truncated files, andCBgraFrame::Encoderead back with libjpeg. And its PNG codec on libpng: RGBA, 16 bit, palette and gray transparency, interlaced 2 bit gray,CBgraFrame::EncodeandSaveFileof a palette image read back with libpng. And its TIFF codec on libtiff: uncompressed, LZW, Deflate, PackBits and JPEG in strips and tiles, CCITT G4, palette, 16 bit, multipage, and an IFD loop that libtiff 3.9.4 never returned from. And the WebP decoder (raster/WebP) on libwebp: lossy and lossless in both channel orders, alpha (lossless and next to lossy color), the first frame of an animation,OpenFile, and truncated input. And the HEIF decoder (raster/heif) on libheif: HEIC and AVIF detection (also by file name, as before inserting a file), HEIC in both channel orders, AVIF with alpha and at 10 bits, rotation fromirot,OpenFile, and truncated input. And ICO and PSD: detection of bitmap, PNG and cursor icons and of PSD (not PSB), icons of both kinds in both channel orders, PSD raw and RLE at 8 and 16 bits, with transparency, with a layer section that is skipped, and truncated or corrupt RLE data. Deps: kernel, graphics, UnicodeConverter, jpeg, png, tiff, webp and webpmux (to build and read the test images).GTEST_MAIN. Images are built in memory, except the HEIF ones: core cannot encode HEIF, soheif/holds small fixtures fromheif/generate.py, read in place. -
DesktopEditor/fontengine/test— new suite (fontengine_test), not a.promigration. Covers the FreeType based font engine in libgraphics:CApplicationFonts(font list, localized family names read from FreeType's internal sfnt name table) andCFontManager(font type, metrics incl.headandOS/2values, cmap lookup, advances, glyph boxes) for TrueType, WOFF2 (brotli), OpenType/CFF and Type 1. Deps: kernel, graphics, UnicodeConverter.GTEST_MAIN. Fixtures are read in place:fonts/holds tiny fonts with exactly known metrics generated byfonts/generate.py(fontTools), the Type 1 font isPdfFile/Resources/Fonts/n019003l.pfb. -
DesktopEditor/raster/Jp2/openjpeg/test— new suite (openjpeg_test), not a.promigration. Coversopenjpeg::GetData(opj_bgraframe.cpp), the JPEG 2000 decoder behind PdfFile's JPXDecode streams. Compiles the same openjp2 sources (fromCommon/3dParty/openjpeg) and wrapper as PdfFile; dep: kernel.GTEST_MAIN. No fixtures — images are encoded losslessly in memory with OpenJPEG's encoder and must decode back exactly: J2K/JP2 with 1/3/4 components, tiled multi-resolution, the unflipped (bottom-up) row order, and an image above the 5 MP strip-decoding limit. Plus non-JPEG 2000, truncated and corrupted input (must return, not crash). -
PdfFile/test/jbig2— new suite (pdf_jbig2_test), not a.promigration. Covers JBIG2 encoding on jbig2enc and Leptonica:CPdfFile::DrawImage1bpp(DjVu pages, symbol mode with sharedJBIG2Globals, also across the writer's five-image dictionary limit),DrawImageWith1bppMask(DjVu color pages) andCBgraFrame::SaveFilewith type 21 (a generic region, wrapped into a hand-built PDF). Every result is decoded again by xpdf's JBIG2 decoder throughConvertToPixelsat 1:1 and compared with the source pixels. Deps: UnicodeConverter, kernel, graphics, PdfFile.GTEST_MAIN. No fixtures — pages are built in memory. -
DjVuFile/test— new suite (djvu_test), not a.promigration. CoversCDjVuFileon DjVuLibre's libdjvu (Common/3dParty/djvulibre): page count, sizes and resolution of a bundled document, an exact 1:1 rendering of a JB2 page, an IW44 color page (with a tolerance), bookmarks (GetStructure), links (GetLinks), the text layer as written to a PDF page, and truncated or overwritten input (must not crash). Deps: UnicodeConverter, kernel, graphics, PdfFile, DjVuFile.GTEST_MAIN. Fixtures are read in place:data/holds three tiny documents generated bydata/generate.pywith DjVuLibre's tools. -
RtfFile/Format/test— new suite (rtf_lex_test), not a.promigration. First coverage for the RTF tokenizer that fronts every RTF import (RtfLex, rtf2docx). Deps: links the existingx2tlibtarget;RtfLex.cpp,RtfToken.cppandUtils.cppare compiled directly into the test binary (their symbols are hidden inside the sharedx2tlib, same pattern asdocx_numbering_testcompilingPPTXFormat/Namespaces.cpp).GTEST_MAIN. No fixtures — each case writes its RTF snippet to a temp file (the lexer only accepts file paths); every snippet rides a minimal{\rtf1 …}envelope becauseSetSourcerefuses files under 5 bytes. 16 tests: token dispatch (group/keyword/control/text/EOF incl. EOF persistence), keyword parameters (positive, negative, trailing-space consumption), escaped delimiters, control symbols,\'hhhex control tokens (the decimal-key quirk and the +1 shift for the 0x00–0x1E range), backslash-tab/CR/LF →tab/par, newline suppression inside text runs, control-byte skipping, the 5-byte error contract, and read-buffer growth past the initial 5 MB (a 6 MB text run lexes whole). The binary links the systemlibstdc++ahead of the converter chain (ICU interposition, #173). -
OOXML/Binary/Sheets/Reader/test— new suite (csv_reader_test), not a.promigration. First coverage for the bin-format CSV reader used by every CSV/TXT import: encodings (ANSI/UTF-8/UTF-16LE/UTF-32LE, BOM),sep=directive, RFC4180 quoting, tab handling, empty-cell positions, the 500k-char chunked-erase path, and thereadToxmlCache_branch. Carries the regression case (Utf8TrailingLineBreakAddsNoEmptyRow) for the #160 ghost-row bug fixed in #170. The binary links the systemlibstdc++ahead of the converter chain on Linux (ICU interposition, #173). -
OdfFile/Test/test_odf— deps: OdfFormatLib (forConvertODF2OOXml), kernel, graphics, UnicodeConverter;OfficeFileFormatChecker2.cpp,pole.cppandunicode_util.cppare compiled into the target (asx2tTesterdoes). Owns itsmain()(so noGTEST_MAIN). The.probuilt onlytest.cpp+common.cpp; the CMake target also builds the entrance/motion/audio/interactions modules (144 cases), which convert their.odp/.pptxfixtures in both directions and inspect the converters' animation trees. Their environments incommon.cppread the fixtures working-dir-relative.columns.cppstays out:columns.pptxwas never committed. The globalTestEnvexercises an.odp -> .pptxconversion in itsSetUp(), andODP2PPTX.EmptyCustomShapeFormulaconvertsempty_custom_shape_formula.odp, a regression fixture for a custom-shape equation with an emptydraw:formula. Fixtures underExampleFiles/are staged next to the binary and the test runs from there (the fixture pathExampleFiles/motion.odpis working-dir-relative). The committedcommon.cpphad absolute Windows include paths and a#pragma comment(lib, ...)block; these were replaced with repo-relative includes (CMake links the libraries). Tests that check one XML part of a converted document use the helpers incommon.h:convert_odf_to_ooxml_dir()(ODT/ODS/ODP → unpacked OOXML, viaConvertODF2OOXml),convert_ooxml_to_odf_dir()(DOCX/XLSX/PPTX → unpacked ODF, viaOox2Odf::Converteras x2t calls it),read_part()andis_well_formed(). Both converters run in-process, not throughX2T_Convert, so they work headless. The output directories are removed by the globalTearDown().conversion_helpers.cppholds the controls:plain_paragraph.odtandplain_paragraph.docxconvert and the expected part is well-formed and holds the text, andis_well_formed()rejects an unescaped&and broken markup. -
DesktopEditor/xmlsec/src/test(xmlsec_test) — deps: kernel, ooxmlsignature. Not a GoogleTest suite (unlike every other entry here) — a plainmain()returning a real exit code, since it exercisesCOOXMLSigner/COOXMLVerifierdirectly rather than asserting individual cases. Signsfile.docxand verifies the result in the same process (USE_SIGN/USE_VERIFY), and separately verifies a committed fixture,legacy-signed.docx, signed by upstream ONLYOFFICE Desktop Editors 9.4.0 under OpenSSL 1.1.1f (USE_VERIFY_LEGACY) — proving documents signed under OpenSSL 1.1.1 still verify under this fork's 4.0.1. Because it copies itself intoEO_CORE_OUTPUT_DIR(matchingx2t/UnicodeConverter's convention, not theWORKING_DIRECTORY $<TARGET_FILE_DIR:...>pattern the other suites use), itsadd_testruns that copy directly rather than the raw build-tree binary. Not the same as theDesktopEditor/xmlsec/src/osign/testsuite below despite the similar path —osignis an unrelated, separate signing library. -
DesktopEditor/doctrenderer/test/json— dep: doctrenderer (V8). DefineJSON_GOOGLE_TEST; ownmain()is compiled out under that define, soGTEST_MAIN. No fixtures (JS built inline viarunScript). -
DesktopEditor/doctrenderer/test/js_internal— dep: doctrenderer (V8). DefineJS_INTERNAL_GOOGLE_TEST; ownmain()is compiled out under that define, soGTEST_MAIN. No fixtures. -
DesktopEditor/doctrenderer/test/embed/internal/hash— dep: doctrenderer (V8). No google-test define; no ownmain(), soGTEST_MAIN. No fixtures.V8 runtime requirement (satisfied in CI): these three suites instantiate
CJSContext, which initializes a V8 isolate. The V8 monolith is built in CI bycommon.cmake(build_3rdparty.py, populatingV8_INSTALL_DIR) and is self-contained at run time: the x64-linux V8 build setsv8_use_external_startup_data=false(startup snapshot is linked into the monolith) andv8_enable_i18n_support=false(no externalicudtl.dat), so no external V8 runtime data files need to be staged next to the test binaries. Thedoctrenderershared library these suites link is already built in CI (thedocbuilderapp links it), so the suites run headless without extra provisioning. -
PdfFile/test(pdffile_test) — deps: UnicodeConverter, kernel, graphics, PdfFile, DjVuFile, ooxmlsignature. CoversCPdfFile: writing and reading (page sizes, colours read back by rendering), loading from memory, document info, metadata (ONLYOFFICEFORM), passwords andChangePassword, editing (rotate, delete, move, add, draw),SplitPages,MergePages, copying pages through the renderer, and signing and verifying with a generated RSA certificate.GTEST_MAIN. No fixtures: every test writes the PDFs it needs withCPdfFileitself, in its own directory.DrawTextInsideRedactiondrives the redaction early-return inCPdfWriter::DrawText(#224); it checks the path succeeds, not the heap, so it would not catch the leak alone. It replaces ONLYOFFICE's scratchpad, whose cases mostly asserted nothing, depended on each other's output files and needed fixtures that were never published, among them editor binaries (pdf.bin,changes.bin,base64.txt) only sdkjs produces. Not covered yet: DjVu to PDF, the editor binary formats, applying redactions and printing. -
MsBinaryFile/DocFile/test(doc_fkp_test) — new suite, not a.promigration. Regression tests for the bounds checks in the.docFormatted Disk Page parsers (FormattedDiskPageCHPX/PAPX). Each case writes a hand-built 512 byte FKP into a temporary compound file through POLE and runs the real constructors on it. Deps: DocFormatLib + XlsFormatLib (forLog::warning) in a linker group, kernel, UnicodeConverter;pole.cpp/unicode_util.cppare compiled into the target asx2tTesterdoes. No fixtures. Building it with-fsanitize=addressalso turns any remaining out-of-bounds read into a failure. -
MsBinaryFile/PptFile/test(pptfile_test) — new suite, not a.promigration. Regression cases forCRecordExObjStg, the reader of embedded OLE objects andvbaProject.binin.pptfiles: a compressed record too short to hold its size field, a claimed size the stored data cannot inflate to or above the 128 MiB ceiling, data that does not inflate, and stored, compressed and named objects that must still come out intact. LinksPptFormatLibwith the rest of the format-library group the same wayOdfFile/Test/test_odfdoes.GTEST_MAIN. No fixtures: each case writes its own compound file into a fresh temp directory with POLE. -
DesktopEditor/xmlsec/src/osign/test— deps: kernel and a newosignCMake library target (DesktopEditor/xmlsec/src/osign/lib/CMakeLists.txt) ported fromosign.pro. No fixtures — the suite generates its own passwords and certificates at run time.common_openssl.cppis compiled into the library (osign.propulls it in throughCONFIG += open_ssl_common, andcertificate.cppneedsNSOpenSSL::PBKDF2/AES_*_desktop_GCM);Base64.cppandFile.cppare not — the.procompiled them directly because qmake did not link kernel, but the CMake target linkskernel, which already providesNSBase64/NSFile. Unlikeooxmlsignature— whichx2tlibpulls into the default build —osignhas no non-test consumer, so it is reached only through the test's guardedadd_subdirectoryand nothing changes whenEO_BUILD_TESTSis OFF.certificate.cppwas written for OpenSSL 1.1 and was ported to the OpenSSL 4 API (opaqueASN1_STRING, constX509_get_subject_name/X509_get_ext) for this.
Runnable headless once migrated (no missing fixtures, no JS engine):
(none — all migrated; see Done above.)
Blocked / need extra work (build targets intentionally not created yet):
(none)
The remaining ~37 .pro "tests" are interactive/GUI tools (SVG dumpers, viewers, manual
testers) — they don't assert and can't run headless, so they are not CTest candidates.
They can optionally be given build-only CMake targets later; until then build them with
qmake (qmake <tool>.pro && make) against a qmake build of core.