1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
9 from libreoffice
.uno
.eventlistener
import EventListener
11 from uitest
.framework
import UITestCase
13 from uitest
.debug
import sleep
14 from uitest
.path
import get_srcdir_url
19 def get_url_for_data_file(file_name
):
20 return get_srcdir_url() + "/uitest/demo_ui/data/" + file_name
22 class HandleFiles(UITestCase
):
24 def test_load_file(self
):
26 calc_file
= self
.ui_test
.load_file(get_url_for_data_file("test.ods"))
28 calc_file2
= self
.ui_test
.load_file(get_url_for_data_file("test2.ods"))
30 frames
= self
.ui_test
.get_frames()
31 self
.assertEqual(len(frames
), 2)
33 self
.ui_test
.close_doc()
35 frames
= self
.ui_test
.get_frames()
36 self
.assertEqual(len(frames
), 1)
38 # this is currently still necessary as otherwise
39 # the command is not forwarded to the correct frame
40 # TODO: provide an additional event that we can use
41 # and get rid of the sleep
44 self
.ui_test
.close_doc()
46 def test_select_frame(self
):
47 calc_file
= self
.ui_test
.load_file(get_url_for_data_file("test.ods"))
49 calc_file2
= self
.ui_test
.load_file(get_url_for_data_file("test2.ods"))
50 frames
= self
.ui_test
.get_frames()
51 self
.assertEqual(len(frames
), 2)
54 self
.ui_test
.close_doc()
56 frames
= self
.ui_test
.get_frames()
57 self
.assertEqual(len(frames
), 1)
59 self
.assertTrue(frames
[0].getTitle().startswith("test2.ods"))
61 # vim: set shiftwidth=4 softtabstop=4 expandtab: