Tests moved into separate folders (#3794)

Fix android crash on application exit
This commit is contained in:
Hristo Hristov
2017-03-15 12:26:54 +02:00
committed by GitHub
parent 58ab01870d
commit 7b5ef052fd
50 changed files with 258 additions and 120 deletions

View File

@@ -0,0 +1,40 @@
import * as TKUnit from "../TKUnit";
import * as app from "tns-core-modules/application";
import { isIOS, isAndroid } from "tns-core-modules/platform";
// >> platform-require
import * as platformModule from "tns-core-modules/platform";
// << platform-require
export function test_setTimeout_isDefined() {
var expected;
if (app.android) {
expected = "Android";
}
else {
expected = "iOS";
}
TKUnit.assertEqual(platformModule.device.os, expected, "device.os");
};
export function snippet_print_all() {
// >> platform-current
console.log("Device model: " + platformModule.device.model);
console.log("Device type: " + platformModule.device.deviceType);
console.log("OS: " + platformModule.device.os);
console.log("OS version: " + platformModule.device.osVersion);
console.log("SDK Version: " + platformModule.device.sdkVersion);
console.log("Screen width: " + platformModule.screen.mainScreen.widthPixels);
console.log("Screen height: " + platformModule.screen.mainScreen.heightPixels);
console.log("Screen scale: " + platformModule.screen.mainScreen.scale);
// << platform-current
};
export function testIsIOSandIsAndroid() {
if (isIOS) {
TKUnit.assertTrue(!!NSObject, "isIOS is true-ish but common iOS APIs are not available.");
} else if (isAndroid) {
TKUnit.assertTrue(!!android, "isAndroid is true but common 'android' package is not available.");
}
}

View File

@@ -0,0 +1,14 @@
---
nav-title: "platform How-To"
title: "platform"
environment: nativescript
description: "Examples for using platform"
previous_url: /ApiReference/platform/HOW-TO
---
# Platform
Information about the current device and screen are defined in the platform module
### Declaring platform module to be available for further usage.
{%snippet platform-require%}
### Getting information about the current device:
{%snippet platform-current%}