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

New commits:
commit eb2e89096a022ac2264350e70fecd73eaa530cf8
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Nov 12 21:01:10 2025 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Nov 13 06:39:58 2025 +0100

    tdf#139269: sd: add test
    
    Based on https://bugs.documentfoundation.org/show_bug.cgi?id=139269#c4
    
    Change-Id: I5331486f5185669356e2320a2873f01e49243175
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193910
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 4348f0e35e87..24381b980cc7 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1186,6 +1186,38 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf126605)
     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nWritingMode);
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
tdf139269_prevent_pasting_into_readonly_master_objects)
+{
+    createSdImpressDoc();
+
+    insertStringToObject(0, u"Test", /*bUseEscape*/ false);
+
+    dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
+
+    dispatchCommand(mxComponent, u".uno:SlideMasterPage"_ustr, {});
+
+    // Use tab key to select the first object and try to type something to go
+    // into edit mode although it's not possible to add text to it
+    auto pXImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    typeKey(pXImpressDocument, KEY_TAB);
+    typeString(pXImpressDocument, u"test");
+
+    dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
+
+    uno::Reference<drawing::XMasterPagesSupplier> 
xMasterPagesSupplier(mxComponent,
+                                                                       
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPages> 
xMasterPages(xMasterPagesSupplier->getMasterPages());
+    CPPUNIT_ASSERT(xMasterPages.is());
+    uno::Reference<drawing::XDrawPage> xDrawPage(xMasterPages->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Click to edit the title text format
+    // - Actual  : Click to edit the title text formatTest
+    CPPUNIT_ASSERT_EQUAL(u"Click to edit the title text format"_ustr, 
xShape->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf100950)
 {
     createSdImpressDoc();

Reply via email to