def testSetMultiSelectMode(self):
        """Tests setting the multiselect mode of the Table. The multiselect
        mode affects how mouse selection is made in the table by the user.
        """
        table = Table('', self.createTestContainer())

        # Default multiselect mode should be MultiSelectMode.DEFAULT
        self.assertEquals(MultiSelectMode.DEFAULT, table.getMultiSelectMode())

        # Tests if multiselectmode is set
        table.setMultiSelectMode(MultiSelectMode.SIMPLE)
        self.assertEquals(MultiSelectMode.SIMPLE, table.getMultiSelectMode())
示例#2
0
    def testFooterVisibility(self):
        """Tests if setting the footer visibility works properly"""

        table = Table('Test table', self.createContainer())

        # The footer should by default be hidden
        self.assertFalse(table.isFooterVisible())

        # Set footer visibility to tru should be reflected in the
        # isFooterVisible() method
        table.setFooterVisible(True)
        self.assertTrue(table.isFooterVisible())
示例#3
0
    def createTableWithDefaultContainer(cls, properties, items):
        t = Table()

        for i in range(properties):
            t.addContainerProperty("Property %d" % i, str, None)

        for j in range(items):
            item = t.addItem("Item %d" % j)
            for i in range(properties):
                v = "Item %d/Property %d" % (j, i)
                item.getItemProperty("Property %d" % i).setValue(v)

        return t
示例#4
0
    def createTableWithDefaultContainer(cls, properties, items):
        t = Table()

        for i in range(properties):
            t.addContainerProperty('Property %d' % i, str, None)

        for j in range(items):
            item = t.addItem('Item %d' % j)
            for i in range(properties):
                v = 'Item %d/Property %d' % (j, i)
                item.getItemProperty('Property %d' % i).setValue(v)

        return t
示例#5
0
    def testRemovingFooters(self):
        """Test removing footers"""

        table = Table('Test table', self.createContainer())

        table.setColumnFooter('col1', 'Footer1')
        table.setColumnFooter('col2', 'Footer2')

        # Test removing footer
        self.assertNotEquals(table.getColumnFooter('col1'), None)
        table.setColumnFooter('col1', None)
        self.assertEquals(table.getColumnFooter('col1'), None)

        # The other footer should still be there
        self.assertNotEquals(table.getColumnFooter('col2'), None)

        # Remove non-existing footer
        table.setColumnFooter('fail', None)
示例#6
0
    def testSetMultipleItems(self):
        """Tests weather the multiple select mode is set when using
        Table.set"""
        table = Table('', self.createTestContainer())

        # Tests if multiple selection is set
        table.setMultiSelect(True)
        self.assertTrue(table.isMultiSelect())

        # Test multiselect by setting several items at once
        table.setValue(['1', '3'])
        self.assertEquals(2, len(table.getValue()))
    def testSetMultipleItems(self):
        """Tests weather the multiple select mode is set when using
        Table.set"""
        table = Table('', self.createTestContainer())

        # Tests if multiple selection is set
        table.setMultiSelect(True)
        self.assertTrue(table.isMultiSelect())

        # Test multiselect by setting several items at once
        table.setValue(['1', '3'])
        self.assertEquals(2, len(table.getValue()))
示例#8
0
    def testFooterVisibility(self):
        """Tests if setting the footer visibility works properly"""

        table = Table('Test table', self.createContainer())

        # The footer should by default be hidden
        self.assertFalse(table.isFooterVisible())

        # Set footer visibility to tru should be reflected in the
        # isFooterVisible() method
        table.setFooterVisible(True)
        self.assertTrue(table.isFooterVisible())
示例#9
0
    def testSetMultiSelectMode(self):
        """Tests setting the multiselect mode of the Table. The multiselect
        mode affects how mouse selection is made in the table by the user.
        """
        table = Table('', self.createTestContainer())

        # Default multiselect mode should be MultiSelectMode.DEFAULT
        self.assertEquals(MultiSelectMode.DEFAULT, table.getMultiSelectMode())

        # Tests if multiselectmode is set
        table.setMultiSelectMode(MultiSelectMode.SIMPLE)
        self.assertEquals(MultiSelectMode.SIMPLE, table.getMultiSelectMode())
示例#10
0
    def testAddingFooters(self):
        """Tests adding footers to the columns"""

        table = Table('Test table', self.createContainer())

        # Table should not contain any footers at initialization
        self.assertIsNone(table.getColumnFooter('col1'))
        self.assertIsNone(table.getColumnFooter('col2'))
        self.assertIsNone(table.getColumnFooter('col3'))

        # Adding column footer
        table.setColumnFooter('col1', 'Footer1')
        self.assertEquals('Footer1', table.getColumnFooter('col1'))

        # Add another footer
        table.setColumnFooter('col2', 'Footer2')
        self.assertEquals('Footer2', table.getColumnFooter('col2'))

        # Add footer for a non-existing column
        table.setColumnFooter('fail', 'FooterFail')
示例#11
0
    def testRemovingFooters(self):
        """Test removing footers"""

        table = Table('Test table', self.createContainer())

        table.setColumnFooter('col1', 'Footer1')
        table.setColumnFooter('col2', 'Footer2')

        # Test removing footer
        self.assertNotEquals(table.getColumnFooter('col1'), None)
        table.setColumnFooter('col1', None)
        self.assertEquals(table.getColumnFooter('col1'), None)

        # The other footer should still be there
        self.assertNotEquals(table.getColumnFooter('col2'), None)

        # Remove non-existing footer
        table.setColumnFooter('fail', None)
示例#12
0
    def testAddingFooters(self):
        """Tests adding footers to the columns"""

        table = Table('Test table', self.createContainer())

        # Table should not contain any footers at initialization
        self.assertIsNone(table.getColumnFooter('col1'))
        self.assertIsNone(table.getColumnFooter('col2'))
        self.assertIsNone(table.getColumnFooter('col3'))

        # Adding column footer
        table.setColumnFooter('col1', 'Footer1')
        self.assertEquals('Footer1', table.getColumnFooter('col1'))

        # Add another footer
        table.setColumnFooter('col2', 'Footer2')
        self.assertEquals('Footer2', table.getColumnFooter('col2'))

        # Add footer for a non-existing column
        table.setColumnFooter('fail', 'FooterFail')