[AC-2072] Ti.UI.convertUnits returns NaN
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-04-03T22:39:40.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Stanislav Fedorenko |
Assignee | Mauro Parra-Miranda |
Created | 2012-11-06T17:39:33.000+0000 |
Updated | 2016-03-08T07:41:02.000+0000 |
Description
Anvil test fails on
suite: ui_layout
test: convertUnits
with message:
convertUnits - 67ms - error - Message: should be: '0', was: 'NaN'
Fix:
in file titanium\Ti\UI.js
in function convertUnits
change 1st line to:
// even if result is NaN - convert it to 0;
var intermediary = +(dom.computeSize(convertFromValue, 0, false)) || 0;
Please can you provide some more information about this? What's "Anvil test"? Please could you provide a reproducible test case? Thanks!
This was found in test form suites\ui_layout.js : On MobileWeb: {quote} {noformat} // Functional Test #1087-#1097 this.convertUnits = function(testRun) { //...... skipped ...... // #1097 valueOf(testRun, Math.round(Ti.UI.convertUnits('abc', Ti.UI.UNIT_PX))).shouldBe(0); } {noformat} {quote} According to this test code: Ti.UI.convertUnits('abc', Ti.UI.UNIT_PX) should not return NaN. It must return 0.
This function is to convert units such as pixels or dips. "abc" is not a number, it's a string.
Invalid issue.