tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / pyuno / qa / pytests / testcollections_mixednameindex.py
blobc363c0ca70b88614129720d2d877409e75d71a74
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
12 from testcollections_base import CollectionsTestBase
15 # Tests behaviour of objects implementing both XIndexAccess and XNameAccess
16 # using the new-style collection accessors
17 # The objects chosen have no special meaning, they just happen to implement the
18 # tested interfaces
20 class TestMixedNameIndex(CollectionsTestBase):
22 # Tests:
23 # Ability to access a dual XName*/XIndex* object by both name and index
24 def testWriterTextTableNameAndIndex(self):
25 # Given
26 doc = self.createBlankTextDocument()
27 text_table = doc.createInstance("com.sun.star.text.TextTable")
28 text_table.initialize(2, 2)
29 text_table.Name = 'foo'
30 cursor = doc.Text.createTextCursor()
31 doc.Text.insertTextContent(cursor, text_table, False)
33 # When
34 table_by_name = doc.TextTables['foo']
35 table_by_index = doc.TextTables[0]
37 # Then
38 self.assertEqual('foo', table_by_name.Name)
39 self.assertEqual('foo', table_by_index.Name)
40 self.assertEqual(table_by_name, table_by_index)
42 doc.close(True)
45 if __name__ == '__main__':
46 unittest.main()
48 # vim:set shiftwidth=4 softtabstop=4 expandtab: