tdf#139301 line dash interoperability: fix asynchron UI test

to avoid false alarms during slow testing. Also the test
doesn't open the same file n times for testing the n line dash
styles now.

The problem reported by Stephan Bergmann.

See also commit 8cc78b527bf2b7dcaaff73d8f0770f3d324ac839
("Avoid test_tdf139301 hanging upon failure") and
commit commit 183c06fc02a50fb117bb6162e4d6e56cdd34fad1
("tdf#139301 fix OOXML-compatible preset dash styles").

Change-Id: I4b072f334a59abda373ab3a92f27afafda981145
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110574
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py
index caca09f..db48b4d 100644
--- a/sw/qa/uitest/writer_tests7/tdf139301.py
+++ b/sw/qa/uitest/writer_tests7/tdf139301.py
@@ -11,15 +11,16 @@ import time
class tdf139301(UITestCase):

    def test_tdf139301(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx"))

        styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot')

        for i in range(len(styles)):
            writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx"))
            xWriterDoc = self.xUITest.getTopFocusWindow()
            xWriterEdit = xWriterDoc.getChild("writer_edit")
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

            for i in range(i+1):
                self.xUITest.executeCommand(".uno:JumpToNextFrame")
        for i in range(len(styles)):
            # select next line shape
            writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])

            # wait for available line style setting
            self.ui_test.wait_until_child_is_available(xWriterEdit, 'metricfield')
@@ -34,15 +35,16 @@ class tdf139301(UITestCase):
            xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
            time.sleep(1)

            # preset line style
            # check preset line style
            style = get_state_as_dict(xLineStyle)['SelectEntryText']

            xOKBtn = xFormatLineDlg.getChild("ok")
            self.ui_test.close_dialog_through_button(xOKBtn)

            self.ui_test.close_doc()

            self.assertEqual(style, styles[i])

        self.ui_test.close_doc()


# vim: set shiftwidth=4 softtabstop=4 expandtab: