Use o3tl::convert in Math
[LibreOffice.git] / pyuno / qa / pytests / testcollections_mixednameindex.py
blobb4c7958c699637c21a66738f21a1f6474995ffab
1 #!/usr/bin/env python
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 import unittest
11 import uno
13 from testcollections_base import CollectionsTestBase
14 from com.sun.star.beans import PropertyValue
17 # Tests behaviour of objects implementing both XIndexAccess and XNameAccess
18 # using the new-style collection accessors
19 # The objects chosen have no special meaning, they just happen to implement the
20 # tested interfaces
22 class TestMixedNameIndex(CollectionsTestBase):
24 # Tests:
25 # Ability to access a dual XName*/XIndex* object by both name and index
26 def testWriterTextTableNameAndIndex(self):
27 # Given
28 doc = self.createBlankTextDocument()
29 text_table = doc.createInstance("com.sun.star.text.TextTable")
30 text_table.initialize(2, 2)
31 text_table.Name = 'foo'
32 cursor = doc.Text.createTextCursor()
33 doc.Text.insertTextContent(cursor, text_table, False)
35 # When
36 table_by_name = doc.TextTables['foo']
37 table_by_index = doc.TextTables[0]
39 # Then
40 self.assertEqual('foo', table_by_name.Name)
41 self.assertEqual('foo', table_by_index.Name)
42 self.assertEqual(table_by_name, table_by_index)
44 doc.close(True)
47 if __name__ == '__main__':
48 unittest.main()
50 # vim:set shiftwidth=4 softtabstop=4 expandtab: