<s> from unittest import TestCase <EOL> from muntjac . ui . label import Label <EOL> from muntjac . ui . tab_sheet import TabSheet <EOL> class TestTabSheet ( TestCase ) : <EOL> def testAddExistingComponent ( self ) : <EOL> c = Label ( '<STR_LIT:abc>' ) <EOL> tabSheet = TabSheet ( ) <EOL> tabSheet . addComponent ( c ) <EOL> tabSheet . addComponent ( c ) <EOL> itr = tabSheet . getComponentIterator ( ) <EOL> self . assertEquals ( c , itr . next ( ) ) <EOL> self . assertRaises ( StopIteration , itr . next ) <EOL> self . assertNotEquals ( tabSheet . getTab ( c ) , None ) <EOL> def testGetComponentFromTab ( self ) : <EOL> c = Label ( '<STR_LIT:abc>' ) <EOL> tabSheet = TabSheet ( ) <EOL> tab = tabSheet . addTab ( c ) <EOL> self . assertEquals ( c , tab . getComponent ( ) ) <EOL> def testAddTabWithComponentOnly ( self ) : <EOL> tabSheet = TabSheet ( ) <EOL> tab1 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab2 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab3 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( <NUM_LIT:0> , tabSheet . getTabPosition ( tab1 ) ) <EOL> self . assertEquals ( <NUM_LIT:1> , tabSheet . getTabPosition ( tab2 ) ) <EOL> self . assertEquals ( <NUM_LIT:2> , tabSheet . getTabPosition ( tab3 ) ) <EOL> tabSheet . addTab ( tab1 . getComponent ( ) ) <EOL> self . assertEquals ( <NUM_LIT:0> , tabSheet . getTabPosition ( tab1 ) ) <EOL> self . assertEquals ( <NUM_LIT:1> , tabSheet . getTabPosition ( tab2 ) ) <EOL> self . assertEquals ( <NUM_LIT:2> , tabSheet . getTabPosition ( tab3 ) ) <EOL> def testAddTabWithComponentAndIndex ( self ) : <EOL> tabSheet = TabSheet ( ) <EOL> tab1 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab2 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab3 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab4 = tabSheet . addTab ( Label ( '<STR_LIT>' ) , <NUM_LIT:1> ) <EOL> tab5 = tabSheet . addTab ( Label ( '<STR_LIT>' ) , <NUM_LIT:3> ) <EOL> self . assertEquals ( <NUM_LIT:0> , tabSheet . getTabPosition ( tab1 ) ) <EOL> self . assertEquals ( <NUM_LIT:1> , tabSheet . getTabPosition ( tab4 ) ) <EOL> self . assertEquals ( <NUM_LIT:2> , tabSheet . getTabPosition ( tab2 ) ) <EOL> self . assertEquals ( <NUM_LIT:3> , tabSheet . getTabPosition ( tab5 ) ) <EOL> self . assertEquals ( <NUM_LIT:4> , tabSheet . getTabPosition ( tab3 ) ) <EOL> tabSheet . addTab ( tab1 . getComponent ( ) , <NUM_LIT:3> ) <EOL> self . assertEquals ( <NUM_LIT:0> , tabSheet . getTabPosition ( tab1 ) ) <EOL> self . assertEquals ( <NUM_LIT:1> , tabSheet . getTabPosition ( tab4 ) ) <EOL> self . assertEquals ( <NUM_LIT:2> , tabSheet . getTabPosition ( tab2 ) ) <EOL> self . assertEquals ( <NUM_LIT:3> , tabSheet . getTabPosition ( tab5 ) ) <EOL> self . assertEquals ( <NUM_LIT:4> , tabSheet . getTabPosition ( tab3 ) ) <EOL> def testAddTabWithAllParameters ( self ) : <EOL> tabSheet = TabSheet ( ) <EOL> tab1 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab2 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab3 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab4 = tabSheet . addTab ( Label ( '<STR_LIT>' ) , '<STR_LIT>' , None , <NUM_LIT:1> ) <EOL> tab5 = tabSheet . addTab ( Label ( '<STR_LIT>' ) , '<STR_LIT>' , None , <NUM_LIT:3> ) <EOL> self . assertEquals ( <NUM_LIT:0> , tabSheet . getTabPosition ( tab1 ) ) <EOL> self . assertEquals ( <NUM_LIT:1> , tabSheet . getTabPosition ( tab4 ) ) <EOL> self . assertEquals ( <NUM_LIT:2> , tabSheet . getTabPosition ( tab2 ) ) <EOL> self . assertEquals ( <NUM_LIT:3> , tabSheet . getTabPosition ( tab5 ) ) <EOL> self . assertEquals ( <NUM_LIT:4> , tabSheet . getTabPosition ( tab3 ) ) <EOL> tabSheet . addTab ( tab1 . getComponent ( ) , '<STR_LIT>' , None , <NUM_LIT:3> ) <EOL> self . assertEquals ( <NUM_LIT:0> , tabSheet . getTabPosition ( tab1 ) ) <EOL> self . assertEquals ( <NUM_LIT:1> , tabSheet . getTabPosition ( tab4 ) ) <EOL> self . assertEquals ( <NUM_LIT:2> , tabSheet . getTabPosition ( tab2 ) ) <EOL> self . assertEquals ( <NUM_LIT:3> , tabSheet . getTabPosition ( tab5 ) ) <EOL> self . assertEquals ( <NUM_LIT:4> , tabSheet . getTabPosition ( tab3 ) ) <EOL> def testGetTabByPosition ( self ) : <EOL> tabSheet = TabSheet ( ) <EOL> tab1 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab2 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> tab3 = tabSheet . addTab ( Label ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( tab1 , tabSheet . getTab ( <NUM_LIT:0> ) ) <EOL> self . assertEquals ( tab2 , tabSheet . getTab ( <NUM_LIT:1> ) ) <EOL> self . assertEquals ( tab3 , tabSheet . getTab ( <NUM_LIT:2> ) ) </s>
