A test library for Titanium Mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.currentWindow; | |
var view = Ti.UI.createView(); | |
view.layout = 'vertical'; | |
function addTest(title,action){ | |
var button = Ti.UI.createButton({ | |
title:title, | |
width:300, | |
height:30 | |
}); | |
button.addEventListener('click',function(){ | |
Ti.API.info('start:'+title); | |
if(action) { | |
action(); | |
} | |
Ti.API.info('end:'+title); | |
}); | |
view.add(button); | |
} | |
function addSpacer(){ | |
var spacer = Ti.UI.createView({ | |
width:200, | |
height:10 | |
}); | |
view.add(spacer); | |
} | |
function musttrue(assert,title){ | |
if (assert){ | |
Ti.API.info('OK:'+title); | |
}else{ | |
Ti.API.error('NG:'+title); | |
} | |
} | |
function mustequal(value,expect,title){ | |
if (value==expect){ | |
Ti.API.info('OK:'+title); | |
}else{ | |
Ti.API.error('NG:'+title); | |
Ti.API.error('value:'+value); | |
Ti.API.error('expect:'+expect); | |
} | |
} | |
function mustdifferent(value,expect,title){ | |
if (value!=expect){ | |
Ti.API.info('OK:'+title); | |
}else{ | |
Ti.API.error('NG:'+title); | |
Ti.API.error('value:'+value); | |
Ti.API.error('expect:'+expect); | |
} | |
} | |
win.add(view); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment