sd/qa/unit/uiimpress.cxx |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

New commits:
commit cd65c4c3bc78d95d45cbbc4c2959697dbaa66e80
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Nov 13 23:15:12 2025 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Nov 14 08:31:45 2025 +0100

    tdf#68320: sd_uiimpress: Add test
    
    Change-Id: I386853eb4421e422a77394e87a429f70492d2136
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193996
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 24381b980cc7..295d97151484 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1355,6 +1355,44 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testmoveSlides)
     CPPUNIT_ASSERT_EQUAL(u"Test 2"_ustr, 
pViewShell->GetActualPage()->GetName());
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testTdf68320_hidden_pages_total_slide_count)
+{
+    createSdImpressDoc();
+
+    dispatchCommand(mxComponent, u".uno:InsertPage"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:HideSlide"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:InsertPage"_ustr, {});
+    checkCurrentPageNumber(3);
+
+    insertStringToObject(0, u"Pages: ", /*bUseEscape*/ false);
+
+    dispatchCommand(mxComponent, u".uno:InsertPagesField"_ustr, {});
+
+    auto pXImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    typeString(pXImpressDocument, u"/");
+
+    dispatchCommand(mxComponent, u".uno:InsertPageField"_ustr, {});
+
+    dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:Cut"_ustr, {});
+
+    uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
+        { { "SelectedFormat", 
uno::Any(static_cast<sal_uInt32>(SotClipboardFormatId::STRING)) } });
+
+    // Paste as Unformatted text in order to get the field's values
+    dispatchCommand(mxComponent, u".uno:ClipboardFormatItems"_ustr, 
aPropertyValues);
+
+    uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(2),
+                                                 uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+
+    // Without the fix in place, this test would have failed wiht
+    // - Expected: Pages: 3/3
+    // - Actual  : Pages: 2/3
+    CPPUNIT_ASSERT_EQUAL(u"Pages: 3/3"_ustr, xShape->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf148620)
 {
     createSdImpressDoc();

Reply via email to