def test_collapse_empty(self): """ Test for collapse function when the collapse origin is an empty tabwidget. It's sibling can have an arbitrary layout and the result would be such that this layout is transferred to the parent. """ # setup root = EditorAreaWidget(editor_area=SplitEditorAreaPane(), parent=None) tabwidget = root.tabwidget() tabwidget.setParent(None) left, left_left, left_right = self._setUp_collapse(parent=root) right = EditorAreaWidget(editor_area=root.editor_area, parent=root) root.leftchild = left root.rightchild = right # perform collapse on leftchild right.collapse() # test # is the layout of root now same as left? self.assertEquals(root.count(), 2) self.assertEquals(root.leftchild, left_left) self.assertEquals(root.rightchild, left_right) # are the contents of left_left and left_right preserved self.assertEquals(root.leftchild.tabwidget().count(), 2) self.assertEquals(root.rightchild.tabwidget().count(), 2) self.assertEquals(root.leftchild.tabwidget().currentIndex(), 1) self.assertEquals(root.rightchild.tabwidget().currentIndex(), 0) # what is the current active_tabwidget? self.assertEquals(root.editor_area.active_tabwidget, root.leftchild.tabwidget())
def test_collapse_empty(self): """ Test for collapse function when the collapse origin is an empty tabwidget. It's sibling can have an arbitrary layout and the result would be such that this layout is transferred to the parent. """ # setup root = EditorAreaWidget(editor_area=SplitEditorAreaPane(), parent=None) tabwidget = root.tabwidget() tabwidget.setParent(None) left, left_left, left_right = self._setUp_collapse(parent=root) right = EditorAreaWidget(editor_area=root.editor_area, parent=root) root.leftchild = left root.rightchild = right # perform collapse on leftchild right.collapse() # test # is the layout of root now same as left? self.assertEqual(root.count(), 2) self.assertEqual(root.leftchild, left_left) self.assertEqual(root.rightchild, left_right) # are the contents of left_left and left_right preserved self.assertEqual(root.leftchild.tabwidget().count(), 2) self.assertEqual(root.rightchild.tabwidget().count(), 2) self.assertEqual(root.leftchild.tabwidget().currentIndex(), 1) self.assertEqual(root.rightchild.tabwidget().currentIndex(), 0) # what is the current active_tabwidget? self.assertEqual(root.editor_area.active_tabwidget, root.leftchild.tabwidget())