[Libreoffice-commits] core.git: sw/qa

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 9 15:07:11 UTC 2020


 sw/qa/uitest/writer_tests/insertCaption.py |    6 +++---
 sw/qa/uitest/writer_tests4/tdf115088.py    |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e3d130fbdf061da36b317a5b610eef4b4cc51732
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Apr 9 12:46:52 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Apr 9 17:06:37 2020 +0200

    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 at redhat.com>

diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py
index b516cf9b16db..de73b3b767e5 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 47e99b688540..f10fe7490448 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:


More information about the Libreoffice-commits mailing list