[TIMOB-17031] BlackBerry: ProgressBar causes crash on start
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-06-16T21:14:23.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | n/a |
Components | BlackBerry |
Labels | progressbar, qe-3.3.0, qe-testadded |
Reporter | Olga Romero |
Assignee | Pedro Enrique |
Created | 2014-05-27T20:18:48.000+0000 |
Updated | 2014-06-16T21:14:23.000+0000 |
Description
When testing progress bar functionality, using the below code
var win = Ti.UI.createWindow({
layout:'vertical'
});
var value = 0;
var ind, button, interval,lbl1,lbl2;
button = Titanium.UI.createButton({
title : 'Start Progress',
height : Ti.UI.SIZE,
width : 200,
top : 20
});
ind = Titanium.UI.createProgressBar({
width : Ti.UI.SIZE,
min : 0,
max : 10,
top: 50,
value : 0,
height : Ti.UI.SIZE,
color : '#888',
//message : 'Downloading 0 of 10',
//font : {fontSize : 14}
//fontWeight : 'bold'
});
//
// BUTTON LISTENER TO KICK OFF PROGRESS BARS
//
button.addEventListener('click', function() {
ind.show();
val = 0;
if (interval) {
clearInterval(interval);
}
interval = setInterval(function() {
lbl2 = Ti.UI.createLabel({
text:'INTERVAL FIRED value ' + val,
color:'red',
top: 5,
width:Ti.UI.SIZE,
Height:Ti.UI.SIZE,
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
font:{fontSize:8}
});
win.add(lbl2);
Ti.API.info('INTERVAL FIRED value ' + val);
if (val >= 10) {
clearInterval(interval);
lbl1 = Ti.UI.createLabel({
text:'Progress Complete',
color:'red',
top: 20,
width:Ti.UI.SIZE,
Height:Ti.UI.SIZE,
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
font:{fontSize:12}
});
win.add(lbl1);
};
ind.value = val;
//ind.message = 'Downloading ' + val + ' of 10';
val++;
}, 1000);
});
win.add(button);
win.add(ind);
win.open();
the app crashes after click event
[INFO] INTERVAL FIRED value 0
Steps
1. In Studio create the app and replace app.js with above code 2. Build for BB device 3. Start progress barExpected
[INFO] : INTERVAL FIRED value 0
[INFO] : INTERVAL FIRED value 1
[INFO] : INTERVAL FIRED value 2
[INFO] : INTERVAL FIRED value 3
[INFO] : INTERVAL FIRED value 4
[INFO] : INTERVAL FIRED value 5
[INFO] : INTERVAL FIRED value 6
[INFO] : INTERVAL FIRED value 7
[INFO] : INTERVAL FIRED value 8
[INFO] : INTERVAL FIRED value 9
[INFO] : INTERVAL FIRED value 10
Attachments
File | Date | Size |
---|---|---|
expected.png | 2014-05-27T20:30:09.000+0000 | 50479 |
log.txt | 2014-05-27T20:18:48.000+0000 | 13141 |
Resolving as invalid. The JavaScript test is wrong and the code is bad, bad in syntax, structure, and API usage. Use this code instead:
Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201406111952 Titanium SDK, build: 3.3.0.v20140613161751 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-rc npm@1.3.2 titanium@3.3.0-rc titanium-code-processor@1.1.1 Device: BB Z10 (10.2.1) Verified as fixed.