<s> import unittest <EOL> import GafferUI <EOL> import GafferUITest <EOL> class SelectionMenuTest ( GafferUITest . TestCase ) : <EOL> def testAccessors ( self ) : <EOL> s = GafferUI . SelectionMenu ( ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> self . assertEqual ( s . getTotal ( ) , <NUM_LIT:3> ) <EOL> s . setCurrentIndex ( <NUM_LIT:1> ) <EOL> self . assertEqual ( s . getCurrentItem ( ) , "<STR_LIT>" ) <EOL> self . assertEqual ( s . getItem ( s . getCurrentIndex ( ) ) , "<STR_LIT>" ) <EOL> s . removeIndex ( <NUM_LIT:0> ) <EOL> self . assertEqual ( s . getTotal ( ) , <NUM_LIT:2> ) <EOL> def testInsert ( self ) : <EOL> s = GafferUI . SelectionMenu ( ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> self . assertEqual ( s . getTotal ( ) , <NUM_LIT:3> ) <EOL> s . insertItem ( <NUM_LIT:1> , "<STR_LIT>" ) <EOL> self . assertEqual ( s . getItem ( <NUM_LIT:1> ) , "<STR_LIT>" ) <EOL> def testCurrentIndexChangedSignal ( self ) : <EOL> s = GafferUI . SelectionMenu ( ) <EOL> self . emissions = <NUM_LIT:0> <EOL> def f ( w ) : <EOL> self . emissions += <NUM_LIT:1> <EOL> c = s . currentIndexChangedSignal ( ) . connect ( f ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> self . assertEqual ( self . emissions , <NUM_LIT:1> ) <EOL> def testNoQString ( self ) : <EOL> s = GafferUI . SelectionMenu ( ) <EOL> s . addItem ( "<STR_LIT>" ) <EOL> self . failUnless ( isinstance ( s . getCurrentItem ( ) , str ) ) <EOL> self . failUnless ( isinstance ( s . getItem ( <NUM_LIT:0> ) , str ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
