#!/usr/bin/env ruic metadata 'MetaData.xml' # optional; also may be set via -m flag uia 'projects/BMW_Cluster/BMW_Cluster.uia' # required before other commands show "Uh oh!", app.errors if app.errors? assert app.filename == 'BMW_Cluster.uia' assert app.assets.length==10, "There should be 10 assets" assert app.behaviors.length==3 assert app.presentations.length==6 assert app['#logic'] assert app['#logic'].datamodel=='{output=output}' assert app['#logic']==app['states/logic.scxml'] assert app['#logic']==app['./states/logic.scxml'] assert app['#logic']==app['../BMW_Cluster/states/logic.scxml'] main = app['#main'] # Look up a presentation by asset id assert main == app.main_presentation # …or ask for the main rendered presentation assert main == app.main # …also available as a shortcut name assert main.filename == 'BMW_Cluster.uip' # You can also ask for the full path via .file assert main == app['BMW_Cluster.uip'] # Look up a presentation by asset id assert !app['beejonkers'] # If an asset id doesn't exist, you'll get nil scene = app/'main:Scene' assert scene assert scene==main.scene assert scene.type == 'Scene' assert scene.name == 'Scene' assert scene['name'].value == 'Scene' # Find an element based on path, prefixed with asset id sm = app/'main:Scene.ClassicContent.ClassicContent.SimpleMedia' assert sm.name == 'SimpleMedia' assert sm.type == 'Model' assert sm.path == 'main:Scene.ClassicContent.ClassicContent.SimpleMedia' assert sm==main/'Scene.ClassicContent.ClassicContent.SimpleMedia' assert sm.component == (main/'Scene.ClassicContent.ClassicContent') assert sm.component.slides.length==2 assert sm.component.slides[0].name == 'Master Slide' assert sm.component.slides[0].index == 0 assert sm.component.slides[2].name == 'CarStatus' assert sm.component.slides[2].index == 2 assert sm.component.slides['CarStatus'].name == 'CarStatus' assert sm.component.slides['CarStatus'] == sm.component.slides[2] assert sm['endtime',0]==250 assert sm['endtime',1]==500 assert sm['endtime','SimpleMedia']==500 assert sm['endtime','CarStatus' ]==250 assert sm['endtime',99].nil? assert sm['position'].linked? assert !sm['endtime'].linked? assert sm['endtime'].values == [250,500,250] assert sm['endtime'].value == 250 assert sm['endtime',1]==500 assert sm['endtime','SimpleMedia']==500 assert sm['endtime','CarStatus' ]==250 sm['endtime','CarStatus'] = 750 assert sm['endtime','SimpleMedia']==500 assert sm['endtime','CarStatus' ]==750 sm['endtime'] = 100 assert sm['endtime',0]==100 assert sm['endtime',1]==100 assert sm['endtime',2]==100 assert sm['position',0].x==0 assert sm['scale',0].y == 2.88 sm['position',0].x=42 assert sm['position',0].x==42 sm['position',0].y=17 assert sm['position',0].y==17 assert sm['position',0].x==42