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/.
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
20 class TestMixedNameIndex(CollectionsTestBase
):
23 # Ability to access a dual XName*/XIndex* object by both name and index
24 def testWriterTextTableNameAndIndex(self
):
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)
34 table_by_name
= doc
.TextTables
['foo']
35 table_by_index
= doc
.TextTables
[0]
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
)
45 if __name__
== '__main__':
48 # vim:set shiftwidth=4 softtabstop=4 expandtab: