Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): TabGroup crashes if tab "title" property not set as of 8.0.2 #11001

Merged
merged 6 commits into from Jul 1, 2019

Conversation

jquick-axway
Copy link
Contributor

JIRA:
https://jira.appcelerator.org/browse/TIMOB-27188

Summary:

  • TIMOB-27188 Fixed bug where TabGroup will crash if "title" property is null or left undefined.
    • This is a regression as of Titanium 8.0.2.
  • Added additional null checks to TabGroup Java code.
  • Added icon-only tab group unit tests for top/bottom styles.

Test:

  1. Create a Classic "Default Project".
  2. Replace project's "app.js" with the below code.
  3. Build and run on Android.
  4. Verify 2 tabs appear at the top without titles; only icons. (This used to crash.)
  5. Tap on the right tab.
  6. In the log, verify the following was printed: Tab 1 was unselected
  7. In the log, verify the following was printed: Tab 2 was selected
  8. In the code below, uncomment the tabGroupSettings.style line.
  9. Rebuild and run on Android.
  10. Verify 2 tabs appears at the bottom without titles; only icons. (This used to crash.)
  11. Tap on the right tab.
  12. In the log, verify the following was printed: Tab 1 was unselected
  13. In the log, verify the following was printed: Tab 2 was selected
  14. In the code below, uncomment the title: title line.
  15. Rebuild and run on Android.
  16. Verify that the bottom tabs have both titles and icons.
  17. In the code below, comment-out (or delete) the tabGroupSettings.style line.
  18. Rebuild and run on Android.
  19. Verify that the top tabs have both titles and icons.
function createTab(title, iconPath) {
	var window = Ti.UI.createWindow({ title: title });
	window.add(Ti.UI.createLabel({ text: title + " View" }));
	var tab = Ti.UI.createTab({
//		title: title,
		icon: iconPath,
		window: window,
	});
	tab.addEventListener("unselected", function(e) {
		Ti.API.info("@@@ " + title + " was unselected.");
	});
	tab.addEventListener("selected", function(e) {
		Ti.API.info("@@@ " + title + " was selected.");
	});
	return tab;
}

var tabGroupSettings = {
	tabs: [
		createTab("Tab 1", "/assets/images/tab1.png"),
		createTab("Tab 2", "/assets/images/tab2.png")
	],
};
if (Ti.Android) {
//	tabGroupSettings.style = Ti.UI.Android.TABS_STYLE_BOTTOM_NAVIGATION;
}
var tabGroup = Ti.UI.createTabGroup(tabGroupSettings);
tabGroup.open();

@jquick-axway jquick-axway added this to the 8.3.0 milestone Jun 27, 2019
@jquick-axway jquick-axway requested a review from ypbnv June 27, 2019 04:02
@build build requested a review from a team June 27, 2019 04:24
@build
Copy link
Contributor

build commented Jun 27, 2019

Messages
📖

💾 Here's the generated SDK zipfile.

📖

✅ All tests are passing
Nice one! All 29 tests are passing.
(There are 6 tests skipped)

Generated by 🚫 dangerJS against af619d0

Copy link
Contributor

@ypbnv ypbnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

And thank you for taking care of this!

@keerthi1032
Copy link
Contributor

FR passed. No tab group crash if title property set/not .tested with the test case provided in the PR.
Test Environment:
Name = Mac OS X
Version = 10.14.5
Architecture = 64bit
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = 8.2.0.v20190626210412
Device = oneplus 5t android 9,nexus 5 ANDORID 5,
Emulator = pixel 3xl android 9

@sgtcoolguy sgtcoolguy merged commit 2bdf7f6 into tidev:master Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants