SHARE
TWEET
Testability Driver example test
a guest
Jan 31st, 2012
140
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # Example test for Unity 2D with Testability Driver.
- #
- # Reference: http://i.imgur.com/psi7m.png
- #
- # Note: this probably won't succeed on your installation. Only works
- # on unity-2d trunk *right now*, something that will change soon.
- require 'tdriver'
- include TDriverVerify
- # Establish connection to 'qttasserver' on target
- @sut = TDriver.connect_sut(:Id => 'sut_qt')
- # Execute the application to test, supplying '-testability' flag
- @app = @sut.run( :name => 'unity-2d-launcher',
- :arguments => '-testability' )
- # ------------- Start of Testing Code ----------------
- # Check Launcher is 65 pixels wide
- verify_true(1, 'Launcher is not 65 pixels wide') {
- @app.LauncherView()['width'] == '65'
- }
- # Check that Terminal tile is using correct icon source
- verify_true(1, 'Terminal icon in Launcher is wrong') {
- @app.LauncherList( :name => 'main' ) \
- .QDeclarativeItem( :name => 'Terminal' ) \
- .QDeclarativeImage( :name => 'icon' )['source'] == 'image://icons/utilities-terminal'
- }
- # this is a bad test, as the name "Terminal" can be localised, meaning a fail if
- # you're using a non-English installation. Choosing good objectNames is important.
- # ------------------- Clean up -----------------------
- # This closes (kills actually) the launcher when we're done.
- @app.kill
RAW Paste Data

