{"size": 4436, "ext": "js", "max_stars_repo_path": "drillbit/tests/android/android/android.js", "max_stars_repo_name": "gitizenme/titanium_mobile", "max_stars_repo_stars_event_min_datetime": "2022-02-18T06:22:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-18T06:22:55.000Z", "max_issues_repo_path": "drillbit/tests/android/android/android.js", "max_issues_repo_name": "arnaudsj/titanium_mobile", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "drillbit/tests/android/android/android.js", "max_forks_repo_name": "arnaudsj/titanium_mobile", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 44.8080808081, "max_line_length": 157, "alphanum_fraction": 0.7919296664}
describe("Ti.Android tests", {
	androidAPIs: function() {
		valueOf(Ti.Android).shouldNotBeNull();
		valueOf(Ti.Android.currentActivity).shouldNotBeNull();
	},

	//https://appcelerator.lighthouseapp.com/projects/32238/tickets/1592-android-move-menu-to-tiandroidactivity
	androidMenu: function() {
		var activity = Ti.Android.currentActivity;
		
		valueOf(activity.onCreateOptionsMenu).shouldBeUndefined();
		activity.onCreateOptionsMenu = function(e) {};
		valueOf(activity.onCreateOptionsMenu).shouldBeFunction();
		
		valueOf(activity.onPrepareOptionsMenu).shouldBeUndefined();
		activity.onPrepareOptionsMenu = function(e) {};
		valueOf(activity.onPrepareOptionsMenu).shouldBeFunction();
	},

	//https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2492-android-custom-js-activities-dont-correctly-pre-parse-the-url-attribute
	jsActivityUrl: asyncTest(function() {
		var intent = Ti.Android.createIntent({
			action: Ti.Android.ACTION_MAIN,
			url: 'jsActivity.js'
		});
		intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
		Ti.Android.currentActivity.startActivityForResult(intent, this.async(function(e) {
			Ti.API.debug(JSON.stringify(e));
			valueOf(e.resultCode).shouldBe(Ti.Android.RESULT_OK);
		}));
	}),

	// https://appcelerator.lighthouseapp.com/projects/32238/tickets/2564-android-expose-pendingintent-flag_-constants-in-android-module
	pendingIntentFlags: function() {
		valueOf(Ti.Android.FLAG_CANCEL_CURRENT).shouldBeNumber();
		valueOf(Ti.Android.FLAG_NO_CREATE).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ONE_SHOT).shouldBeNumber();
		valueOf(Ti.Android.FLAG_UPDATE_CURRENT).shouldBeNumber();
	},
	// https://appcelerator.lighthouseapp.com/projects/32238/tickets/3248-android-support-intent-flags
	intentFlags : function() {
		valueOf(Ti.Android.FLAG_GRANT_READ_URI_PERMISSION).shouldBeNumber();
		valueOf(Ti.Android.FLAG_GRANT_WRITE_URI_PERMISSION).shouldBeNumber();
		valueOf(Ti.Android.FLAG_DEBUG_LOG_RESOLUTION).shouldBeNumber();
		valueOf(Ti.Android.FLAG_FROM_BACKGROUND).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_BROUGHT_TO_FRONT).shouldBeNumber();
		//API 11 valueOf(Ti.Android.FLAG_ACTIVITY_CLEAR_TASK).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_CLEAR_TOP).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_FORWARD_RESULT).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_MULTIPLE_TASK).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_NEW_TASK).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_NO_ANIMATION).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_NO_HISTORY).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_NO_USER_ACTION).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_PREVIOUS_IS_TOP).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_REORDER_TO_FRONT).shouldBeNumber();
		valueOf(Ti.Android.FLAG_ACTIVITY_SINGLE_TOP).shouldBeNumber();
		//API 11 sconsvalueOf(Ti.Android.FLAG_ACTIVITY_TASK_ON_HOME).shouldBeNumber();
		valueOf(Ti.Android.FLAG_RECEIVER_REGISTERED_ONLY).shouldBeNumber();		
	},
	intentFlagAccessors : function() {
		var intent = Ti.Android.createIntent({
			action : Ti.Android.ACTION_MAIN,
			flags : Ti.Android.FLAG_ACTIVITY_NEW_TASK
		});
		// Test presence of methods
		valueOf(intent.getFlags).shouldBeFunction();
		valueOf(intent.setFlags).shouldBeFunction();
		valueOf(intent.addFlags).shouldBeFunction();
		
		// Check flags from create args
		valueOf(intent.flags).shouldBeNumber();
		valueOf(intent.getFlags()).shouldBe(Ti.Android.FLAG_ACTIVITY_NEW_TASK);
		
		intent.flags = Ti.Android.FLAG_ACTIVITY_NO_HISTORY;
		valueOf(intent.flags).shouldBe(Ti.Android.FLAG_ACTIVITY_NO_HISTORY);
		
		intent.addFlags(Ti.Android.FLAG_ACTIVITY_NEW_TASK);
		valueOf(intent.getFlags()).shouldBe(Ti.Android.FLAG_ACTIVITY_NEW_TASK + Ti.Android.FLAG_ACTIVITY_NO_HISTORY);
		
		intent = Ti.Android.createIntent({
			action : Ti.Android.ACTION_MAIN
		});
		
		valueOf(intent.flags).shouldBeNumber();
		valueOf(intent.flags).shouldBe(0);
		intent.setFlags(Ti.Android.FLAG_ACTIVITY_NEW_TASK);
		valueOf(intent.getFlags()).shouldBe(Ti.Android.FLAG_ACTIVITY_NEW_TASK);
	},
	
	options: {
		forceBuild: true
	}
});
