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/.
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
22 class TestMixedNameIndex(CollectionsTestBase
):
25 # Ability to access a dual XName*/XIndex* object by both name and index
26 def testWriterTextTableNameAndIndex(self
):
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)
36 table_by_name
= doc
.TextTables
['foo']
37 table_by_index
= doc
.TextTables
[0]
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
)
47 if __name__
== '__main__':
50 # vim:set shiftwidth=4 softtabstop=4 expandtab: