mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Stabilizing layout tests
This commit is contained in:

committed by
Hristo Hristov

parent
1757eb7092
commit
c2cb4a8f61
@ -18,24 +18,27 @@ export module layout {
|
||||
export function getDisplayDensity(): number {
|
||||
return 1;
|
||||
}
|
||||
|
||||
export function toDevicePixels(value: number): number {
|
||||
return value * getDisplayDensity();
|
||||
}
|
||||
|
||||
export function toDeviceIndependentPixels(value: number): number {
|
||||
return value / getDisplayDensity();
|
||||
}
|
||||
}
|
||||
|
||||
export module ios {
|
||||
export module collections {
|
||||
export function jsArrayToNSArray(str: string[]): any {
|
||||
var arr = new NSMutableArray();
|
||||
if ("undefined" !== typeof str) {
|
||||
for (var element in str) {
|
||||
arr.addObject(str[element]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
export function jsArrayToNSArray(str: string[]): NSArray {
|
||||
return NSArray.arrayWithArray(<any>str);
|
||||
}
|
||||
|
||||
export function nsArrayToJSArray(a: any): string[] {
|
||||
export function nsArrayToJSArray(a: NSArray): Array<Object> {
|
||||
var arr = [];
|
||||
if ("undefined" !== typeof a) {
|
||||
for (var i = 0; i < a.count; i++) {
|
||||
let count = a.count;
|
||||
for (let i = 0; i < count; i++) {
|
||||
arr.push(a.objectAtIndex(i));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user