chore: cleanup

This commit is contained in:
Nathan Walker
2020-07-27 21:11:01 -07:00
parent 61ff24e704
commit 0791878e2b
5 changed files with 16 additions and 18 deletions

View File

@@ -1,7 +1,6 @@
import { Image } from '@nativescript/core/ui/image';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import { GridLayout } from '@nativescript/core/ui/layouts/grid-layout';
import { isIOS, isAndroid } from '@nativescript/core/platform';
import { PropertyChangeData } from '@nativescript/core';
import * as utils from '@nativescript/core/utils';
import * as TKUnit from '../../tk-unit';
@@ -24,7 +23,7 @@ export function test_recycling() {
helper.nativeView_recycling_test(() => new Image());
}
if (isAndroid) {
if (global.isAndroid) {
(<any>backgroundModule).initImageCache(androidApp.startActivity, (<any>backgroundModule).CacheMode.memory); // use memory cache only.
}
@@ -64,7 +63,7 @@ function runImageTestSync(image: ImageModule.Image, src: string) {
image.src = src;
let imageSourceAvailable = isIOS ? !!image.imageSource : true;
let imageSourceAvailable = global.isIOS ? !!image.imageSource : true;
TKUnit.assertFalse(image.isLoading, 'Image.isLoading should be false.');
TKUnit.assertTrue(imageSourceAvailable, 'imageSource should be set.');
}
@@ -77,7 +76,7 @@ function runImageTestAsync(image: ImageModule.Image, src: string, done: (e: any)
image.off(IMAGE_LOADED_EVENT, handler);
try {
let imageSourceAvailable = isIOS ? !!image.imageSource : true;
let imageSourceAvailable = global.isIOS ? !!image.imageSource : true;
TKUnit.assertFalse(image.isLoading, 'Image.isLoading should be false.');
TKUnit.assertTrue(imageSourceAvailable, 'imageSource should be set.');
done(null);
@@ -254,7 +253,7 @@ export const test_SettingStretch_none = function () {
};
function ios<T>(func: T): T {
return isIOS ? func : undefined;
return global.isIOS ? func : undefined;
}
export const test_SettingImageSourceWhenSizedToParentDoesNotRequestLayout = ios(() => {

View File

@@ -3,7 +3,7 @@ import { Frame, EventData, Button, ActionBar } from '@nativescript/core';
const iconModes = ['automatic', 'alwaysOriginal', 'alwaysTemplate', undefined];
export function navigate(args) {
Frame.topmost().navigate('ui-tests-app/action-bar/clean');
Frame.topmost().navigate('action-bar/clean-page');
}
export function onChangeRenderingMode(args: EventData) {

View File

@@ -1,14 +1,9 @@
import { GestureEventData, RotationGestureEventData, GestureTypes, SwipeGestureEventData, PanGestureEventData, PinchGestureEventData, GestureStateTypes } from '@nativescript/core/ui/gestures';
import { Button } from '@nativescript/core/ui/button';
import { Label } from '@nativescript/core/ui/label';
import { Page } from '@nativescript/core/ui/page';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import { screen, isAndroid } from '@nativescript/core/platform';
import { Screen, StackLayout, Page, Label, Button, GestureEventData, RotationGestureEventData, GestureTypes, SwipeGestureEventData, PanGestureEventData, PinchGestureEventData, GestureStateTypes } from '@nativescript/core';
export function createPage() {
const stack = new StackLayout();
var stopButton = new Button();
if (isAndroid) {
if (global.isAndroid) {
stopButton.height = 30;
stopButton.fontSize = 8;
}
@@ -16,7 +11,7 @@ export function createPage() {
stopButton.automationText = 'stopGesturesDetecting';
stack.addChild(stopButton);
const labelHeight = Math.round(screen.mainScreen.heightPixels / (10 * screen.mainScreen.scale));
const labelHeight = Math.round(Screen.mainScreen.heightPixels / (10 * Screen.mainScreen.scale));
const tapLabel = createLabel('Tap here', labelHeight);
stack.addChild(tapLabel);

View File

@@ -21,16 +21,16 @@ export { addWeakEventListener, removeWeakEventListener } from './core/weak-event
export { DatePicker } from './date-picker';
// No need go export dialogs, they are already export exported globally
export { action, alert, confirm, login, prompt, getCurrentPage, Dialogs } from './dialogs';
export type { DialogStrings, DialogOptions, CancelableOptions, AlertOptions, PromptResult, PromptOptions, ActionOptions, ConfirmOptions, LoginResult, LoginOptions, inputType, capitalizationType } from './dialogs';
export { action, alert, confirm, login, prompt, getCurrentPage, Dialogs, inputType, capitalizationType } from './dialogs';
export type { DialogStrings, DialogOptions, CancelableOptions, AlertOptions, PromptResult, PromptOptions, ActionOptions, ConfirmOptions, LoginResult, LoginOptions } from './dialogs';
export * from './editable-text-base';
export { Enums } from './enums';
export { Frame, setActivityCallbacks } from './frame';
export type { NavigationEntry, NavigationContext, NavigationTransition, BackstackEntry, ViewEntry, AndroidActivityCallbacks } from './frame';
export { GesturesObserver, TouchAction } from './gestures';
export type { GestureEventData, GestureEventDataWithState, GestureStateTypes, GestureTypes, TapGestureEventData, PanGestureEventData, PinchGestureEventData, RotationGestureEventData, SwipeDirection, SwipeGestureEventData, TouchGestureEventData } from './gestures';
export { GesturesObserver, TouchAction, GestureTypes, GestureStateTypes, SwipeDirection } from './gestures';
export type { GestureEventData, GestureEventDataWithState, TapGestureEventData, PanGestureEventData, PinchGestureEventData, RotationGestureEventData, SwipeGestureEventData, TouchGestureEventData } from './gestures';
export { HtmlView } from './html-view';
export { Image } from './image';

View File

@@ -36,6 +36,10 @@ interface Rect {
const clearCGColor = UIColor.clearColor.CGColor;
const symbolUrl = Symbol('backgroundImageUrl');
export enum CacheMode {
none,
}
export module ios {
export function createBackgroundUIColor(view: View, callback: (uiColor: UIColor) => void, flip?: boolean): void {
const background = view.style.backgroundInternal;