Handle some Windows \r or \r\n vs. \n differences in UITests

...similar to e22a3f596ce50b5166063e217d96ef674a54d380 "UITest: fix
spellDialog.SpellingAndGrammarDialog.test_tdf46852" already handled that for a
different test.

Seen

> FAIL: test_insert_caption (insertCaption.insertCaption)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "C:/lo/core/sw/qa/uitest/writer_tests/insertCaption.py", line 46, in test_insert_caption
>     self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption")
> AssertionError: '\r\nText 1: Caption' != '\nText 1: Caption'
> -
> +
>   Text 1: Caption

etc. in UITest_writer_tests and

> FAIL: test_tdf115088 (tdf115088.tdf115088)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "C:/lo/core/sw/qa/uitest/writer_tests4/tdf115088.py", line 33, in test_tdf115088
>     self.assertEqual(document.Text.String[0:2], "1\n")
> AssertionError: '1\r' != '1\n'
> + 1

in UITest_writer_tests4.

Change-Id: I3ed3cfaa70856f4e77467ad49a2117a25ed955af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91963
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py
index b516cf9..de73b3b 100644
--- a/sw/qa/uitest/writer_tests/insertCaption.py
+++ b/sw/qa/uitest/writer_tests/insertCaption.py
@@ -43,7 +43,7 @@ class insertCaption(UITestCase):

        xFrame = document.TextFrames[0]

        self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption")
        self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption")

        self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog")   # 2nd caption
        xDialogCaption = self.xUITest.getTopFocusWindow()
@@ -55,7 +55,7 @@ class insertCaption(UITestCase):
        xOkBtn=xDialogCaption.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption\nText 2-: Caption2")
        self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2")

        self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog")   # 3. caption
        xDialogCaption = self.xUITest.getTopFocusWindow()
@@ -69,7 +69,7 @@ class insertCaption(UITestCase):
        xOkBtn=xDialogCaption.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        self.assertEqual(document.TextFrames[0].Text.String, "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
        self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")

        self.ui_test.close_doc()

diff --git a/sw/qa/uitest/writer_tests4/tdf115088.py b/sw/qa/uitest/writer_tests4/tdf115088.py
index 47e99b6..f10fe74 100644
--- a/sw/qa/uitest/writer_tests4/tdf115088.py
+++ b/sw/qa/uitest/writer_tests4/tdf115088.py
@@ -30,7 +30,7 @@ class tdf115088(UITestCase):
        self.xUITest.executeCommand(".uno:GoLeft")
        self.xUITest.executeCommand(".uno:GoLeft")
        self.xUITest.executeCommand(".uno:PasteUnformatted")
        self.assertEqual(document.Text.String[0:2], "1\n")
        self.assertEqual(document.Text.String[0:2].replace('\r', '\n'), "1\n")

        self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: