1# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2#
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/.
6#
7from uitest.framework import UITestCase
8from libreoffice.uno.propertyvalue import mkPropertyValues
9from uitest.uihelper.common import get_url_for_data_file
10from libreoffice.calc.document import get_cell_by_position
11
12class EmbeddedDocument(UITestCase):
13
14  def test_open_embedded_document(self):
15    self.ui_test.load_file(get_url_for_data_file("embedded.pptx"))
16
17    xImpressDoc = self.xUITest.getTopFocusWindow()
18    xEditWin = xImpressDoc.getChild("impress_win")
19
20    xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object 2"}))
21
22    xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
23
24    document = self.ui_test.get_component()
25    self.assertEqual("Name", get_cell_by_position(document, 0, 0, 0).getString())
26    self.assertEqual("NWell", get_cell_by_position(document, 0, 0, 1).getString())
27    self.assertEqual("PWell", get_cell_by_position(document, 0, 0, 2).getString())
28    self.assertEqual("Active", get_cell_by_position(document, 0, 0, 3).getString())
29    self.assertEqual("NoPoly", get_cell_by_position(document, 0, 0, 4).getString())
30    self.assertEqual("Poly", get_cell_by_position(document, 0, 0, 5).getString())
31    self.assertEqual("Sized", get_cell_by_position(document, 0, 0, 6).getString())
32
33    self.xUITest.executeCommand(".uno:CloseDoc")
34
35    self.ui_test.close_doc()
36
37# vim: set shiftwidth=4 softtabstop=4 expandtab:
38