[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 4 21:34:55 UTC 2020
sw/qa/extras/uiwriter/uiwriter.cxx | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
New commits:
commit b05955b480fe4d32852e7be8a118d46ca7e6dbfa
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Nov 4 17:30:07 2020 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Nov 4 22:34:12 2020 +0100
tdf#79717: sw_uiwriter: Add unittest
Change-Id: I866cbc057113003e5bbbd20e2e5812a1045b5133
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105300
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 884d896ccf62..49bbb7fe9eb7 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -213,6 +213,7 @@ public:
void testCreatePortions();
void testBookmarkUndo();
void testFdo85876();
+ void testTdf79717();
void testFdo87448();
void testTextCursorInvalidation();
void testTdf68183();
@@ -440,6 +441,7 @@ public:
CPPUNIT_TEST(testCreatePortions);
CPPUNIT_TEST(testBookmarkUndo);
CPPUNIT_TEST(testFdo85876);
+ CPPUNIT_TEST(testTdf79717);
CPPUNIT_TEST(testFdo87448);
CPPUNIT_TEST(testTextCursorInvalidation);
CPPUNIT_TEST(testTdf68183);
@@ -2010,6 +2012,36 @@ void SwUiWriterTest::testFdo85876()
}
}
+void SwUiWriterTest::testTdf79717()
+{
+ SwDoc* const pDoc = createDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->Insert("normal");
+ lcl_setWeight(pWrtShell, WEIGHT_BOLD);
+ pWrtShell->Insert("bold");
+ pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
+ // Select 'bol' and rewrite it
+ pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false);
+ pWrtShell->Insert("bol");
+
+ // Without the fix in place, 'bol' would have been rewritten with normal font weight
+
+ auto xText = getParagraph(1)->getText();
+ CPPUNIT_ASSERT(xText.is());
+ {
+ auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 1)));
+ CPPUNIT_ASSERT(xCursor.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("normal"), xCursor->getString());
+ CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xCursor, "CharWeight"));
+ }
+ {
+ auto xCursor(xText->createTextCursorByRange(getRun(getParagraph(1), 2)));
+ CPPUNIT_ASSERT(xCursor.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("bold"), xCursor->getString());
+ CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xCursor, "CharWeight"));
+ }
+}
+
void SwUiWriterTest::testFdo87448()
{
createDoc("fdo87448.odt");
More information about the Libreoffice-commits
mailing list