sw/qa/api/SwXAutoTextContainer.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 0d16b0e351e455a87292fd7d7e0dc0f626d74b82
Author:     Miklos Vajna <[email protected]>
AuthorDate: Mon Dec 16 09:12:32 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Dec 16 12:08:24 2024 +0100

    CppunitTest_sw_apitests: remove leftover myNewGroup2.bau before the test
    
    This fails for me in a tree that runs 'make check' and there was a
    previous 'make check' previously.
    
    Seems the trouble is that we have this C++ test creating an autotext
    .bau file, but there is also a Java one, so if we're not lucky with the
    order of these, the C++ one will fail with its hardcoded "must be 3 .bau
    files in instdir" assertion.
    
    Fix the immediate problem by removing the test .bau file before running
    the C++ test.
    
    A better, but more complex fix would be to create the test .bau file in
    the user profile (and not in instdir) for both the Java and C++ cases,
    and then none of these tests would influece other tests during 'make
    check'.
    
    Change-Id: I536d769db733515ec6a7d41fd7dbf601c4b582d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178548
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/sw/qa/api/SwXAutoTextContainer.cxx 
b/sw/qa/api/SwXAutoTextContainer.cxx
index 1f1fc3df1d49..7c116544d9bf 100644
--- a/sw/qa/api/SwXAutoTextContainer.cxx
+++ b/sw/qa/api/SwXAutoTextContainer.cxx
@@ -53,6 +53,15 @@ public:
         Reference<text::XAutoTextContainer> xAutoTextContainer
             = 
text::AutoTextContainer::create(comphelper::getProcessComponentContext());
 
+        try
+        {
+            // See qadevOOo/tests/java/mod/_sw/SwXAutoTextGroup.java.
+            xAutoTextContainer->removeByName(u"myNewGroup2*1"_ustr);
+        }
+        catch (const container::NoSuchElementException&)
+        {
+        }
+
         Reference<container::XNameAccess> xNA(xAutoTextContainer, 
UNO_QUERY_THROW);
         Sequence<rtl::OUString> aNames = xNA->getElementNames();
         std::cout << aNames[0] << std::endl;

Reply via email to