forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication-tests.android.ts
More file actions
41 lines (38 loc) · 1.66 KB
/
application-tests.android.ts
File metadata and controls
41 lines (38 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* tslint:disable:no-unused-variable */
import app = require("application");
import TKUnit = require("./TKUnit");
import commonTests = require("./application-tests-common");
// merge the exports of the application_common file with the exports of this file
declare var exports;
require("utils/module-merge").merge(commonTests, exports);
// <snippet module="application" title="application">
// ### Using the Android-specific implementation
// Accessing the Android-specific object instance (will be undefined if running on iOS)
// ``` JavaScript
var androidApp = app.android;
// ```
// </snippet>
// <snippet module="application" title="application">
// ### Using the Android Application context
// ``` JavaScript
var context = app.android.context;
//// get the Files (Documents) folder (directory)
var dir = context.getFilesDir();
// ```
// </snippet>
// <snippet module="application" title="application">
// ### Tracking the current Activity
// ``` JavaScript
if (androidApp.foregroundActivity === androidApp.startActivity) {
console.log("We are currently in the main (start) activity of the application");
}
// ```
// </snippet>
export var testAndroidApplicationInitialized = function () {
TKUnit.assert(app.android, "Android application not initialized.");
TKUnit.assert(app.android.context, "Android context not initialized.");
TKUnit.assert(app.android.foregroundActivity, "Android currentActivity not initialized.");
TKUnit.assert(app.android.startActivity, "Android startActivity not initialized.");
TKUnit.assert(app.android.nativeApp, "Android nativeApp not initialized.");
TKUnit.assert(app.android.packageName, "Android packageName not initialized.");
}