Handle more Windows \r\n vs. \n differences in UITests

...similar to e22a3f596ce50b5166063e217d96ef674a54d380 "UITest: fix
spellDialog.SpellingAndGrammarDialog.test_tdf46852" and
e3d130fbdf061da36b317a5b610eef4b4cc51732 "Handle some Windows \r or \r\n vs. \n
differences in UITests".

Change-Id: I7ffd61614455a5cf674a8cd1169d9da64ec96b02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92240
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py
index 5d64e1b..7b243f00 100644
--- a/sw/qa/uitest/librelogo/run.py
+++ b/sw/qa/uitest/librelogo/run.py
@@ -64,7 +64,7 @@ class LibreLogoTest(UITestCase):
        self.logo("__translate__")
        # a) check expansion of abbreviated commands : fd -> FORWARD, rt -> RIGHT,
        # b) check line breaking (fix for tdf#100941: new line instead of the text "\" and "n")
        self.assertEqual(document.Text.String, "\nFORWARD 100 RIGHT 45 FORWARD 100")
        self.assertEqual(document.Text.String.replace('\r\n', '\n'), "\nFORWARD 100 RIGHT 45 FORWARD 100")
        # c) check usage of real paragraphs instead of line break (tdf#120422)
        # first paragraph is empty (for working page break)
        self.assertEqual(document.Text.createEnumeration().nextElement().String, "")
diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py
index 5985519..f47eeee 100644
--- a/sw/qa/uitest/table/tableToText.py
+++ b/sw/qa/uitest/table/tableToText.py
@@ -46,7 +46,7 @@ class tableToText(UITestCase):
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(document.Text.String[0:4], "a\na\n")
        self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
@@ -60,7 +60,7 @@ class tableToText(UITestCase):
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(document.Text.String[0:6], "a;a\n;\n")
        self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
@@ -78,7 +78,7 @@ class tableToText(UITestCase):
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(document.Text.String[0:6], "a:a\n:\n")
        self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py b/sw/qa/uitest/writer_tests6/tdf125104.py
index cf38208..b711b01 100644
--- a/sw/qa/uitest/writer_tests6/tdf125104.py
+++ b/sw/qa/uitest/writer_tests6/tdf125104.py
@@ -33,13 +33,15 @@ class tdf125104(UITestCase):
        self.xUITest.executeCommand(".uno:InsertPageNumberField")
        self.xUITest.executeCommand(".uno:InsertPagebreak")
        self.xUITest.executeCommand(".uno:InsertPageNumberField")
        self.assertEqual(document.Text.String[0:1], "1")
        self.assertEqual(document.Text.String[2:3], "2")
        text = document.Text.String.replace('\r\n', '\n')
        self.assertEqual(text[0:1], "1")
        self.assertEqual(text[2:3], "2")

        # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later
        self.set_combo_layout_format(self.open_page_style_dialog(), "1st, 2nd, 3rd, ...")
        self.assertEqual(document.Text.String[0:3], "1st")
        self.assertEqual(document.Text.String[4:7], "2nd")
        text = document.Text.String.replace('\r\n', '\n')
        self.assertEqual(text[0:3], "1st")
        self.assertEqual(text[4:7], "2nd")

        xDialog = self.open_page_style_dialog()
        comboLayoutFormat = xDialog.getChild("comboLayoutFormat")
@@ -49,13 +51,15 @@ class tdf125104(UITestCase):

        # change to devanagari alphabet format
        self.set_combo_layout_format(self.open_page_style_dialog(), "क, ख, ग, ...")
        self.assertEqual(document.Text.String[0:1], "क")
        self.assertEqual(document.Text.String[2:3], "ख")
        text = document.Text.String.replace('\r\n', '\n')
        self.assertEqual(text[0:1], "क")
        self.assertEqual(text[2:3], "ख")

        # change to devanagari number format
        self.set_combo_layout_format(self.open_page_style_dialog(), "१, २, ३, ...")
        self.assertEqual(document.Text.String[0:1], "१")
        self.assertEqual(document.Text.String[2:3], "२")
        text = document.Text.String.replace('\r\n', '\n')
        self.assertEqual(text[0:1], "१")
        self.assertEqual(text[2:3], "२")

        self.ui_test.close_doc()

diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py b/sw/qa/uitest/writer_tests6/tdf126017.py
index 1395e00..99ca147 100644
--- a/sw/qa/uitest/writer_tests6/tdf126017.py
+++ b/sw/qa/uitest/writer_tests6/tdf126017.py
@@ -55,7 +55,7 @@ class tdf126017(UITestCase):
        self.xUITest.executeCommand(".uno:Undo")
        self.xUITest.executeCommand(".uno:Undo")

        self.assertEqual(document.Text.String[1:7], "CRASHY")
        self.assertEqual(document.Text.String.replace('\r\n', '\n')[1:7], "CRASHY")

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