<s> '''<STR_LIT>''' <EOL> __docformat__ = '<STR_LIT>' <EOL> __version__ = '<STR_LIT>' <EOL> import unittest <EOL> from pyglet import app <EOL> from pyglet import gl <EOL> from pyglet import graphics <EOL> from pyglet import text <EOL> from pyglet . text import caret <EOL> from pyglet . text import layout <EOL> from pyglet import window <EOL> from pyglet . window import key , mouse <EOL> doctext = '''<STR_LIT>''' <EOL> class TestWindow ( window . Window ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( TestWindow , self ) . __init__ ( * args , ** kwargs ) <EOL> self . batch = graphics . Batch ( ) <EOL> self . document = text . decode_text ( doctext ) <EOL> self . margin = <NUM_LIT:2> <EOL> self . layout = layout . IncrementalTextLayout ( self . document , <EOL> self . width - self . margin * <NUM_LIT:2> , self . height - self . margin * <NUM_LIT:2> , <EOL> multiline = True , <EOL> batch = self . batch ) <EOL> self . caret = caret . Caret ( self . layout ) <EOL> self . push_handlers ( self . caret ) <EOL> self . set_mouse_cursor ( self . get_system_mouse_cursor ( '<STR_LIT:text>' ) ) <EOL> def on_resize ( self , width , height ) : <EOL> super ( TestWindow , self ) . on_resize ( width , height ) <EOL> self . layout . begin_update ( ) <EOL> self . layout . x = self . margin <EOL> self . layout . y = self . margin <EOL> self . layout . width = width - self . margin * <NUM_LIT:2> <EOL> self . layout . height = height - self . margin * <NUM_LIT:2> <EOL> self . layout . end_update ( ) <EOL> def on_mouse_scroll ( self , x , y , scroll_x , scroll_y ) : <EOL> self . layout . view_x -= scroll_x <EOL> self . layout . view_y += scroll_y * <NUM_LIT:16> <EOL> def on_draw ( self ) : <EOL> gl . glClearColor ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . clear ( ) <EOL> self . batch . draw ( ) <EOL> def on_key_press ( self , symbol , modifiers ) : <EOL> super ( TestWindow , self ) . on_key_press ( symbol , modifiers ) <EOL> if symbol == key . TAB : <EOL> self . caret . on_text ( '<STR_LIT:\t>' ) <EOL> class TestCase ( unittest . TestCase ) : <EOL> def test ( self ) : <EOL> self . window = TestWindow ( resizable = True , visible = False ) <EOL> self . window . set_visible ( ) <EOL> app . run ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
