{ "id": "88764", "key": "TIMOB-8280", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-03-27T08:42:43.000+0000", "created": "2012-03-24T13:23:17.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "qe-ios031912" ], "versions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T23:14:12.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Layout of the button is getting distorted intermittently.\r\n\r\nSteps to reproduce:\r\n1.Launch app a couple of times.\r\n\r\nExpected results:\r\nShould see random numbered buttons in 4 toolbars and will not crash. Layout of all buttons should be correct every time.\r\n\r\nActual:\r\nThe layout of the last button gets distorted when test steps are repeated couple of times. Please find the screenshot attached.\r\n\r\nApp.js\r\n{code}\r\n\r\nvar win = Ti.UI.createWindow({\r\n    backgroundColor : 'black'\r\n});\r\n        \r\n            var goal = Math.floor(Math.random() * 21) + 10;\r\n\r\n            var solutionValue = [];\r\n            solutionValue[0] = Math.floor(Math.random() * (goal - (goal / 2) - 1)) + 1;\r\n            solutionValue[1] = Math.floor(Math.random() * (goal - (goal / 2) - 1)) + 1;\r\n            solutionValue[2] = goal - (solutionValue[0] + solutionValue[1]);\r\n\r\n    \r\n            for(var i = 3; i < 12; i++) {\r\n                solutionValue[i] = Math.floor(Math.random() * (goal - (goal / 2) - 1)) + 1;\r\n            }\r\n            Titanium.API.info(\"Goal: \" + goal);\r\n            for( i = 0; i < 12; i++) {\r\n                Titanium.API.info(\"Solution \" + i + \": \" + solutionValue[i]);\r\n            }\r\n\r\n            // Create a banner with the goal\r\n            var goalLabel = Titanium.UI.createButton({\r\n                title : goal,\r\n                color : '#fff', // white text\r\n                style : Titanium.UI.iPhone.SystemButtonStyle.PLAIN\r\n            });\r\n            win.add(goalLabel);\r\n\r\n            var assigned = [];\r\n            for( i = 0; i < 12; i++) {\r\n                assigned[i] = 0;\r\n            }\r\n\r\n            var solutionButton = [];\r\n            for( i = 0; i < 12; i++) {\r\n                var valueIndex = Math.floor(Math.random() * 12);\r\n                if(valueIndex == 12) {\r\n                    valueIndex = 11;\r\n                }\r\n\r\n                while(assigned[valueIndex] == 1) {\r\n                    valueIndex += 1;\r\n                }\r\n                assigned[valueIndex] = 1;\r\n\r\n                Titanium.API.info(\"Creating a button ...\");\r\n                solutionButton[i] = Titanium.UI.createButton({\r\n                    title : solutionValue[valueIndex],\r\n                    style : Titanium.UI.iPhone.SystemButtonStyle.BORDERED\r\n                });\r\n            }\r\n\r\n            Titanium.API.info(\"All buttons created\");\r\n\r\n            var flexSpace = Titanium.UI.createButton({\r\n                systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE\r\n            });\r\n\r\n            var toolbar = [];\r\n            for( i = 0; i < 4; i++) {\r\n                Titanium.API.info(\"Creating a toolbar ...\");\r\n\r\n                toolbar[i] = Titanium.UI.iOS.createToolbar({\r\n                    items : [solutionButton[i], flexSpace, solutionButton[i + 1], flexSpace, solutionButton[i + 2]],\r\n                    top : 40 * i,\r\n                    borderTop : false,\r\n                    borderBottom : true\r\n                });\r\n                win.add(toolbar[i]);\r\n            }\r\n\r\n            Titanium.API.info(\"Opening the window ...\");    \r\n    \r\nwin.open();\r\n\r\n{code}", "attachment": [ { "id": "26576", "filename": "Screenshot 2012.03.23 17.54.23.png", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-24T13:23:17.000+0000", "size": 26844, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Titanium.UI.Button: Layout of the button is getting distorted intermittently", "creator": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK version: 2.0.0.v20120323221800\r\nPlatform & version: iOS (V 5.1)\r\nDevice Details: iPad 2.0\r\nHost Operating System: OSX 10.7.2\r\nTitanium Studio version: 2.0.0.201203240504", "comment": { "comments": [ { "id": "188627", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Need test code", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-26T11:51:05.000+0000", "updated": "2012-03-26T11:51:05.000+0000" }, { "id": "188799", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "The code is adding the same button to different toolbars which will result in undefined behavior on IOS. Use this code instead which ensures that a button is added to a toolbar only once.\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : 'black'\r\n});\r\n \r\n var goal = Math.floor(Math.random() * 21) + 10;\r\n \r\n var solutionValue = [];\r\n solutionValue[0] = Math.floor(Math.random() * (goal - (goal / 2) - 1)) + 1;\r\n solutionValue[1] = Math.floor(Math.random() * (goal - (goal / 2) - 1)) + 1;\r\n solutionValue[2] = goal - (solutionValue[0] + solutionValue[1]);\r\n \r\n \r\n for(var i = 3; i < 12; i++) {\r\n solutionValue[i] = Math.floor(Math.random() * (goal - (goal / 2) - 1)) + 1;\r\n }\r\n Titanium.API.info(\"Goal: \" + goal);\r\n for( i = 0; i < 12; i++) {\r\n Titanium.API.info(\"Solution \" + i + \": \" + solutionValue[i]);\r\n }\r\n \r\n // Create a banner with the goal\r\n var goalLabel = Titanium.UI.createButton({\r\n title : goal,\r\n color : '#fff', // white text\r\n style : Titanium.UI.iPhone.SystemButtonStyle.PLAIN\r\n });\r\n win.add(goalLabel);\r\n \r\n var assigned = [];\r\n for( i = 0; i < 12; i++) {\r\n assigned[i] = 0;\r\n }\r\n \r\n var solutionButton = [];\r\n for( i = 0; i < 12; i++) {\r\n var valueIndex = Math.floor(Math.random() * 12);\r\n if(valueIndex == 12) {\r\n valueIndex = 11;\r\n }\r\n \r\n while(assigned[valueIndex] == 1) {\r\n valueIndex += 1;\r\n }\r\n assigned[valueIndex] = 1;\r\n \r\n Titanium.API.info(\"Creating a button ...\");\r\n solutionButton[i] = Titanium.UI.createButton({\r\n title : solutionValue[valueIndex],\r\n style : Titanium.UI.iPhone.SystemButtonStyle.BORDERED\r\n });\r\n }\r\n \r\n Titanium.API.info(\"All buttons created\");\r\n \r\n var flexSpace = Titanium.UI.createButton({\r\n systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE\r\n });\r\n \r\n var toolbar = [];\r\n for( i = 0,j=0; i < 12,j<4; j++,i+=3) {\r\n Titanium.API.info(\"Creating a toolbar ...\");\r\n \r\n toolbar[j] = Titanium.UI.iOS.createToolbar({\r\n items : [solutionButton[i], flexSpace, solutionButton[i + 1], flexSpace, solutionButton[i + 2]],\r\n top : 40 * j,\r\n borderTop : false,\r\n borderBottom : true\r\n });\r\n win.add(toolbar[j]);\r\n }\r\n \r\n Titanium.API.info(\"Opening the window ...\"); \r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-27T08:42:43.000+0000", "updated": "2012-03-27T08:42:43.000+0000" }, { "id": "410951", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-09T23:14:12.000+0000", "updated": "2017-03-09T23:14:12.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }