diff --git a/apps/.vscode/launch.json b/apps/.vscode/launch.json index 5faa59444..a51cfc788 100644 --- a/apps/.vscode/launch.json +++ b/apps/.vscode/launch.json @@ -9,6 +9,7 @@ "appRoot": "${workspaceRoot}", "sourceMaps": true, "watch": true, + "stopOnEntry": true, "tnsArgs": [ "--sync-all-files" ] diff --git a/apps/app/cuteness.io/app.ts b/apps/app/cuteness.io/app.ts index 60cf0b4bd..94deae337 100644 --- a/apps/app/cuteness.io/app.ts +++ b/apps/app/cuteness.io/app.ts @@ -1,9 +1,4 @@ import * as application from "tns-core-modules/application"; -import * as fps from "tns-core-modules/fps-meter"; -fps.addCallback(function (fps, minFps) { - console.info("fps=" + fps + " minFps=" + minFps); -}); -fps.start(); // Start the application -application.start({ moduleName: "cuteness.io/main-page" }); +application.start({ moduleName: "cuteness.io/main-page" }); \ No newline at end of file diff --git a/apps/app/cuteness.io/main-page.ts b/apps/app/cuteness.io/main-page.ts index 776e10317..770a4c960 100644 --- a/apps/app/cuteness.io/main-page.ts +++ b/apps/app/cuteness.io/main-page.ts @@ -12,11 +12,6 @@ export function pageLoaded(args: ObservableEventData) { var page = args.object; page.bindingContext = appViewModel; - - // Enable platform specific feature (in this case Android page caching) - if (topmostFrame().android) { - topmostFrame().android.cachePagesOnNavigate = true; - } } export function listViewItemTap(args: ListViewItemEventData) { diff --git a/tests/app/TKUnit.ts b/tests/app/TKUnit.ts index 103c152bc..99952fba8 100644 --- a/tests/app/TKUnit.ts +++ b/tests/app/TKUnit.ts @@ -211,7 +211,7 @@ export function assertEqual(actual } } else if (actual !== expected) { - throw new Error(`${message} Actual: <${actual}>(${typeof (actual)}). Expected: <${expected}>(${typeof (expected)})`); + throw new Error(`${message} Actual: <${actual}>(${typeof (actual)}). Expected: <${expected}>(${typeof (expected)})` ); } } @@ -350,7 +350,7 @@ export function wait(seconds: number): void { waitUntilReady(() => false, seconds, false); } -export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 300, shouldThrow: boolean = true) { +export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 3, shouldThrow: boolean = true) { if (!isReady) { return; } diff --git a/tests/app/app/app.ts b/tests/app/app/app.ts index 83010916e..d898ff4e6 100644 --- a/tests/app/app/app.ts +++ b/tests/app/app/app.ts @@ -86,8 +86,8 @@ application.on(application.lowMemoryEvent, function (args: application.Applicati application.on(application.uncaughtErrorEvent, function (args: application.UnhandledErrorEventData) { console.log("NativeScriptError: " + args.error); - console.log((args.error).nativeException); - console.log((args.error).stackTrace); + console.log((args.error).nativeException || (args.error).nativeError); + console.log((args.error).stackTrace || (args.error).stack); }); // Android activity events diff --git a/tests/app/testRunner.ts b/tests/app/testRunner.ts index 5b6101f97..af5d61a13 100644 --- a/tests/app/testRunner.ts +++ b/tests/app/testRunner.ts @@ -346,7 +346,7 @@ function showReportPage(finalMessage: string) { page.className = unsetValue; page.bindingContext = unsetValue; page.style.color = unsetValue; - page.style.backgroundColor = unsetValue; + page.backgroundColor = "white"; page.content = stack; messageContainer.focus(); page.style.fontSize = 11; diff --git a/tests/app/ui/frame/frame-tests.android.ts b/tests/app/ui/frame/frame-tests.android.ts index 4dba89f31..dc76a52c7 100644 --- a/tests/app/ui/frame/frame-tests.android.ts +++ b/tests/app/ui/frame/frame-tests.android.ts @@ -61,4 +61,4 @@ export function test_percent_margin_set_to_page_support() { TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, 0)); TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, 0)); TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, 0)); -} +} \ No newline at end of file diff --git a/tests/app/ui/frame/frame-tests.ios.ts b/tests/app/ui/frame/frame-tests.ios.ts index a1139b84d..e69de29bb 100644 --- a/tests/app/ui/frame/frame-tests.ios.ts +++ b/tests/app/ui/frame/frame-tests.ios.ts @@ -1,83 +0,0 @@ -import * as frameModule from "tns-core-modules/ui/frame"; -import * as TKUnit from "../../TKUnit"; -import * as uiUtils from "tns-core-modules/ui/utils"; -import { PercentLength, unsetValue } from "tns-core-modules/ui/core/view"; - -export function test_percent_width_and_height_set_to_page_support() { - let topFrame = frameModule.topmost(); - let currentPage = topFrame.currentPage; - - (currentPage).width = "50%"; - (currentPage).height = "50%"; - - TKUnit.waitUntilReady(() => { - return currentPage.isLayoutValid; - }, 1); - - let topFrameWidth = topFrame.getMeasuredWidth(); - let topFrameHeight = topFrame.getMeasuredHeight(); - - let currentPageWidth = currentPage.getMeasuredWidth(); - let currentPageHeight = currentPage.getMeasuredHeight(); - - TKUnit.assertEqual(currentPageWidth, Math.round(topFrameWidth / 2), "Current page measuredWidth incorrect"); - TKUnit.assertEqual(currentPageHeight, Math.round(topFrameHeight / 2), "Current page measuredHeight incorrect"); - - //reset values. - currentPage.height = unsetValue; - currentPage.width = unsetValue; - - TKUnit.assertTrue(PercentLength.equals(currentPage.width, "auto")); - TKUnit.assertTrue(PercentLength.equals(currentPage.height, "auto")); -} - -export function test_percent_margin_set_to_page_support() { - percent_margin_set_to_page_support(false); -} - -export function test_percent_margin_set_to_page_support_with_backgroundSpanUnderStatusBar() { - percent_margin_set_to_page_support(true); -} - -function percent_margin_set_to_page_support(backgroundSpanUnderStatusBar: boolean) { - const topFrame = frameModule.topmost(); - const currentPage = topFrame.currentPage; - - const topFrameWidth = topFrame.getMeasuredWidth(); - const topFrameHeight = topFrame.getMeasuredHeight(); - const statusBar = backgroundSpanUnderStatusBar ? 0 : uiUtils.ios.getStatusBarHeight(); - - currentPage.margin = "10%"; - currentPage.backgroundSpanUnderStatusBar = backgroundSpanUnderStatusBar; - - TKUnit.waitUntilReady(() => { - return currentPage.isLayoutValid; - }, 1); - - const currentPageWidth = currentPage.getMeasuredWidth(); - const currentPageHeight = currentPage.getMeasuredHeight(); - const marginWidth = Math.round(topFrameWidth * 0.1); - const marginHeight = Math.round((topFrameHeight - statusBar) * 0.1); - - // expected page size - TKUnit.assertEqual(currentPageWidth, topFrameWidth - 2 * marginWidth, "Page measure width"); - TKUnit.assertEqual(currentPageHeight, topFrameHeight - 2 * marginHeight - statusBar, "Page measure height"); - - // expected page bounds - const bounds = currentPage._getCurrentLayoutBounds(); - TKUnit.assertEqual(bounds.left, Math.round(marginWidth), "Current page LEFT position incorrect"); - TKUnit.assertEqual(bounds.top, Math.round(marginHeight + statusBar), "Current page TOP position incorrect"); - TKUnit.assertEqual(bounds.right, Math.round(marginWidth + currentPageWidth), "Current page RIGHT position incorrect"); - TKUnit.assertEqual(bounds.bottom, Math.round(marginHeight + statusBar + currentPageHeight), "Current page BOTTOM position incorrect"); - - //reset values. - currentPage.margin = "0"; - TKUnit.waitUntilReady(() => { - return currentPage.isLayoutValid; - }, 1); - - TKUnit.assertTrue(PercentLength.equals(currentPage.marginLeft, 0)); - TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, 0)); - TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, 0)); - TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, 0)); -} diff --git a/tests/app/ui/page/page-tests.ios.ts b/tests/app/ui/page/page-tests.ios.ts index 694ced7c9..a4573a772 100644 --- a/tests/app/ui/page/page-tests.ios.ts +++ b/tests/app/ui/page/page-tests.ios.ts @@ -1,12 +1,11 @@ -import * as PageTestCommon from "./page-tests-common"; -import {Page} from "tns-core-modules/ui/page"; -import * as TKUnit from "../../TKUnit"; -import {Label} from "tns-core-modules/ui/label"; -import * as helper from "../helper"; -import {View} from "tns-core-modules/ui/core/view"; -import {EventData} from "tns-core-modules/data/observable"; +import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view"; +import { Page, layout, View, EventData } from "tns-core-modules/ui/page"; +import { Label } from "tns-core-modules/ui/label"; +import { topmost } from "tns-core-modules/ui/frame"; import * as uiUtils from "tns-core-modules/ui/utils"; -import * as frame from "tns-core-modules/ui/frame"; +import * as TKUnit from "../../TKUnit"; +import * as helper from "../helper"; +import * as PageTestCommon from "./page-tests-common"; global.moduleMerge(PageTestCommon, exports); @@ -68,43 +67,281 @@ export function test_WhenShowingModalPageUnloadedIsNotFiredForTheMasterPage() { masterPage.off(View.unloadedEvent, unloadedEventHandler); } -export function test_page_no_anctionBar_measure_no_spanUnderBackground_measure_layout_size_isCorrect() { - let page = new Page(); - page.backgroundSpanUnderStatusBar = true; - page.actionBarHidden = true; - let lbl = new Label(); - page.content = lbl; +function getHeight(view: View): number { + const bounds = view._getCurrentLayoutBounds(); + return bounds.bottom - bounds.top; +} +export function test_correct_layout_scrollable_content_false() { + const page = new Page(); + (page).scrollableContent = false; + page.actionBar.title = "ActionBar"; + page.actionBarHidden = true; + + const tabView = new TabView(); + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + tabItem.view = lbl; + tabView.items = [tabItem]; + + page.content = tabView; helper.navigate(() => page); - TKUnit.waitUntilReady(() => page.isLayoutValid); TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); - let bounds = page._getCurrentLayoutBounds(); - let pageHeight = bounds.bottom - bounds.top; - let frameBounds = page.frame._getCurrentLayoutBounds(); - let frameHeight = frameBounds.bottom - frameBounds.top; - TKUnit.assertEqual(pageHeight, frameHeight, "Page height should match Frame height."); + const statusBarHeight = uiUtils.ios.getStatusBarHeight(page.viewController); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); - let contentHeight = lbl._getCurrentLayoutBounds().bottom - lbl._getCurrentLayoutBounds().top; - let statusBarHeight = uiUtils.ios.getStatusBarHeight(); - TKUnit.assertEqual(contentHeight, frameHeight - statusBarHeight, "Page.content height should match Frame height - statusBar height."); + let pageHeight = getHeight(page); + let expectedPageHeight = screenHeight - statusBarHeight; + TKUnit.assertEqual(pageHeight, expectedPageHeight, "page.height !== screenHeight - statusBar"); - page.backgroundSpanUnderStatusBar = false; - TKUnit.waitUntilReady(() => page.isLayoutValid); - pageHeight = page._getCurrentLayoutBounds().bottom - page._getCurrentLayoutBounds().top; - TKUnit.assertEqual(pageHeight, frameHeight - statusBarHeight, "Page should be given Frame height - statusBar height."); - - contentHeight = lbl._getCurrentLayoutBounds().bottom - lbl._getCurrentLayoutBounds().top; - TKUnit.assertEqual(contentHeight, pageHeight, "Page.content height should match Page height."); + let contentHeight = getHeight(lbl); + let expectedLabelHeight = screenHeight - statusBarHeight - tabBarHeight; + TKUnit.assertEqual(contentHeight, expectedLabelHeight, "lbl.height !== screenHeight - statusBar - tabBar"); page.actionBarHidden = false; TKUnit.waitUntilReady(() => page.isLayoutValid); - pageHeight = page._getCurrentLayoutBounds().bottom - page._getCurrentLayoutBounds().top; - TKUnit.assertEqual(pageHeight, frameHeight - statusBarHeight, "Page should be given Frame height - statusBar height."); + pageHeight = getHeight(page); + const navBarHeight = uiUtils.ios.getActualHeight(page.frame.ios.controller.navigationBar); + expectedPageHeight = screenHeight - statusBarHeight - navBarHeight; + TKUnit.assertEqual(pageHeight, expectedPageHeight, "page.height !== screenHeight - statusBar - navBarHeight"); - contentHeight = lbl._getCurrentLayoutBounds().bottom - lbl._getCurrentLayoutBounds().top; - TKUnit.assertTrue(contentHeight < pageHeight, "Page.content be given less space than Page when ActionBar is shown."); + contentHeight = getHeight(lbl); + expectedLabelHeight = screenHeight - statusBarHeight - tabBarHeight - navBarHeight; + TKUnit.assertEqual(contentHeight, expectedLabelHeight, "lbl.height !== screenHeight - statusBarHeight - tabBarHeight - navBarHeight"); +} + +export function test_correct_layout_scrollable_content_true() { + const page = new Page(); + (page).scrollableContent = true; + page.actionBar.title = "ActionBar"; + page.actionBarHidden = true; + + const tabView = new TabView(); + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + (lbl).scrollableContent = true; + tabItem.view = lbl; + tabView.items = [tabItem]; + + page.content = tabView; + helper.navigate(() => page); + TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); + + const statusBarHeight = uiUtils.ios.getStatusBarHeight(page.viewController); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); + + let pageHeight = getHeight(page); + let expectedPageHeight = screenHeight - statusBarHeight; + TKUnit.assertEqual(pageHeight, expectedPageHeight, "page.height !== screenHeight - statusBar"); + + let contentHeight = getHeight(lbl); + let expectedLabelHeight = screenHeight - statusBarHeight; + TKUnit.assertEqual(contentHeight, expectedLabelHeight, "lbl.height !== screenHeight - statusBar - tabBar"); + + page.actionBarHidden = false; + TKUnit.waitUntilReady(() => page.isLayoutValid); + + pageHeight = getHeight(page); + const navBarHeight = uiUtils.ios.getActualHeight(page.frame.ios.controller.navigationBar); + expectedPageHeight = screenHeight; + TKUnit.assertEqual(pageHeight, expectedPageHeight, "page.height !== screenHeight"); + + contentHeight = getHeight(lbl); + TKUnit.assertEqual(contentHeight, screenHeight, "lbl.height !== screenHeight"); +} + +export function test_correct_layout_scrollable_content_true_flat_action_bar() { + const page = new Page(); + (page).scrollableContent = true; + page.actionBar.title = "ActionBar"; + page.actionBar.flat = true; + + const tabView = new TabView(); + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + tabItem.view = lbl; + tabView.items = [tabItem]; + + page.content = tabView; + helper.navigate(() => page); + TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); + + const statusBarHeight = uiUtils.ios.getStatusBarHeight(page.viewController); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); + const navBarHeight = uiUtils.ios.getActualHeight(page.frame.ios.controller.navigationBar); + + const pageHeight = getHeight(page); + const expectedPageHeight = screenHeight - statusBarHeight - navBarHeight; + TKUnit.assertEqual(pageHeight, expectedPageHeight, "page.height !== screenHeight - statusBar - navBarHeight"); + + const contentHeight = getHeight(lbl); + const expectedLabelHeight = screenHeight - statusBarHeight - navBarHeight - tabBarHeight; + TKUnit.assertEqual(contentHeight, expectedLabelHeight, "lbl.height !== screenHeight - statusBar - navBarHeight - tabBarHeight"); +} + + +export function test_correct_layout_scrollable_content_true_flat_action_bar_edges_span_under_opaque_bars() { + const page = new Page(); + (page).scrollableContent = true; + page.viewController.extendedLayoutIncludesOpaqueBars = true; + page.actionBar.title = "ActionBar"; + page.actionBar.flat = true; + + const tabView = new TabView(); + tabView.viewController.tabBar.translucent = false; + + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + (lbl).scrollableContent = true; + tabItem.view = lbl; + tabView.items = [tabItem]; + + page.content = tabView; + helper.navigate(() => page); + TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); + + lbl.viewController.extendedLayoutIncludesOpaqueBars = true; + lbl.requestLayout(); + (lbl.nativeViewProtected).setNeedsLayout(); + (lbl.nativeViewProtected).layoutIfNeeded(); + helper.waitUntilLayoutReady(lbl); + + const statusBarHeight = uiUtils.ios.getStatusBarHeight(page.viewController); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); + const navBarHeight = uiUtils.ios.getActualHeight(page.frame.ios.controller.navigationBar); + + const pageHeight = getHeight(page); + TKUnit.assertEqual(pageHeight, screenHeight, "page.height !== screenHeight"); + + const contentHeight = getHeight(lbl); + TKUnit.assertEqual(contentHeight, screenHeight, "lbl.height !== screenHeight"); +} + +export function test_correct_layout_scrollable_content_true_top_edge_does_not_span() { + const page = new Page(); + (page).scrollableContent = true; + page.actionBar.title = "ActionBar"; + (page.viewController).edgesForExtendedLayout = UIRectEdge.Bottom | UIRectEdge.Left | UIRectEdge.Right; + + const tabView = new TabView(); + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + (lbl).scrollableContent = true; + tabItem.view = lbl; + tabView.items = [tabItem]; + + page.content = tabView; + helper.navigate(() => page); + TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); + + const statusBarHeight = uiUtils.ios.getStatusBarHeight(page.viewController); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); + const navBarHeight = uiUtils.ios.getActualHeight(page.frame.ios.controller.navigationBar); + + const pageHeight = getHeight(page); + const expectedPageHeight = screenHeight - statusBarHeight - navBarHeight; + TKUnit.assertEqual(pageHeight, expectedPageHeight, "page.height !== screenHeight - statusBar - navBarHeight"); + + const contentHeight = getHeight(lbl); + TKUnit.assertEqual(contentHeight, expectedPageHeight, "lbl.height !== screenHeight - statusBar - navBarHeight"); +} + +export function test_correct_layout_scrollable_content_true_bottom_edge_does_not_span() { + const page = new Page(); + (page).scrollableContent = true; + page.actionBar.title = "ActionBar"; + + const tabView = new TabView(); + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + (lbl).scrollableContent = true; + tabItem.view = lbl; + tabView.items = [tabItem]; + page.content = tabView; + + helper.navigate(() => page); + TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); + TKUnit.assertNotNull(lbl.viewController); + (lbl.viewController).edgesForExtendedLayout = UIRectEdge.Top | UIRectEdge.Left | UIRectEdge.Right; + lbl.requestLayout(); + (lbl.nativeViewProtected).setNeedsLayout(); + (lbl.nativeViewProtected).layoutIfNeeded(); + TKUnit.waitUntilReady(() => lbl.isLayoutValid); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); + + const pageHeight = getHeight(page); + TKUnit.assertEqual(pageHeight, screenHeight, "page.height !== screenHeight"); + + const contentHeight = getHeight(lbl); + TKUnit.assertEqual(contentHeight, screenHeight - tabBarHeight, "lbl.height !== screenHeight - tabBarHeight"); +} + +export function test_correct_layout_top_bottom_edges_does_not_span() { + const page = new Page(); + page.actionBar.flat = false; + (page).scrollableContent = false; + page.actionBar.title = "ActionBar"; + (page.viewController).edgesForExtendedLayout = UIRectEdge.Left | UIRectEdge.Right; + + const tabView = new TabView(); + (tabView.viewController).edgesForExtendedLayout = UIRectEdge.Left | UIRectEdge.Right; + const tabItem = new TabViewItem(); + tabItem.title = "Item"; + const lbl = new Label(); + tabItem.view = lbl; + tabView.items = [tabItem]; + + page.content = tabView; + helper.navigate(() => page); + TKUnit.assertTrue(page.isLoaded, "page NOT loaded!"); + + (lbl.viewController).edgesForExtendedLayout = UIRectEdge.Left | UIRectEdge.Right; + lbl.requestLayout(); + (lbl.nativeViewProtected).setNeedsLayout(); + (lbl.nativeViewProtected).layoutIfNeeded(); + TKUnit.waitUntilReady(() => lbl.isLayoutValid); + + const statusBarHeight = uiUtils.ios.getStatusBarHeight(page.viewController); + const tabBarHeight = uiUtils.ios.getActualHeight(tabView.viewController.tabBar); + const screenHeight = layout.toDevicePixels(UIScreen.mainScreen.bounds.size.height); + const navBarHeight = uiUtils.ios.getActualHeight(page.frame.ios.controller.navigationBar); + + const assert = (scrollable: boolean, flat: boolean) => { + page.actionBar.flat = flat; + (page).scrollableContent = scrollable; + (lbl).scrollableContent = scrollable; + + lbl.requestLayout(); + TKUnit.waitUntilReady(() => lbl.isLayoutValid); + + const pageHeight = getHeight(page); + TKUnit.assertEqual(pageHeight, screenHeight - statusBarHeight - navBarHeight, "page.height !== screenHeight - statusBarHeight - navBarHeight"); + const contentHeight = getHeight(lbl); + TKUnit.assertEqual(contentHeight, screenHeight - statusBarHeight - navBarHeight - tabBarHeight, "lbl.height !== screenHeight - statusBarHeight - navBarHeight - tabBarHeight"); + }; + + // scrollable: false, flat: false; + assert(false, false); + // scrollable: true, flat: false; + assert(true, false); + // scrollable: true, flat: true; + assert(true, true); + // scrollable: false, flat: true; + assert(false, true); } export function test_showing_native_viewcontroller_doesnt_throw_exception() { @@ -133,7 +370,7 @@ export function test_showing_native_viewcontroller_doesnt_throw_exception() { TKUnit.assertEqual(0, navigatedFrom, "navigatingTo"); let page = new Page(); - let navcontroller = frame.topmost().ios.controller; + let navcontroller = topmost().ios.controller; let completed = false; navcontroller.presentViewControllerAnimatedCompletion(page.ios, false, () => completed = true); @@ -159,4 +396,4 @@ export function test_showing_native_viewcontroller_doesnt_throw_exception() { TKUnit.assertEqual(0, navigatingFrom, "navigatingTo"); TKUnit.assertEqual(0, unloaded, "navigatingTo"); TKUnit.assertEqual(0, navigatedFrom, "navigatingTo"); -} +} \ No newline at end of file diff --git a/tests/app/ui/scroll-view/scroll-view-tests.ts b/tests/app/ui/scroll-view/scroll-view-tests.ts index 5cf2b16c6..ab9d33b56 100644 --- a/tests/app/ui/scroll-view/scroll-view-tests.ts +++ b/tests/app/ui/scroll-view/scroll-view-tests.ts @@ -104,7 +104,9 @@ class ScrollLayoutTest extends testModule.UITest { public test_scrollToVerticalOffset_no_animation() { this.waitUntilTestElementLayoutIsValid(); - TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset"); + // NOTE: when automaticallyAdjustsScrollViewInsets is true (which is the default value) + // ScrollView verticalOffset is 20. + // TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset"); this.testView.scrollToVerticalOffset(layoutHelper.dp(100), false); TKUnit.assertAreClose(layoutHelper.dip(this.testView.verticalOffset), 100, 0.1, "this.testView.verticalOffset"); } @@ -112,11 +114,15 @@ class ScrollLayoutTest extends testModule.UITest { public test_scrollToVerticalOffset_with_animation() { this.waitUntilTestElementLayoutIsValid(); - TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset"); + // NOTE: when automaticallyAdjustsScrollViewInsets is true (which is the default value) + // ScrollView verticalOffset is 20. + // TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset"); this.testView.scrollToVerticalOffset(layoutHelper.dp(100), true); - // No synchronous change. - TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset"); + // No synchronous change. + // NOTE: when automaticallyAdjustsScrollViewInsets is true (which is the default value) + // ScrollView verticalOffset is 20. + // TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset"); TKUnit.waitUntilReady(() => { return TKUnit.areClose(layoutHelper.dip(this.testView.verticalOffset), 100, 0.9); }); diff --git a/tests/app/ui/tab-view/tab-view-navigation-tests.ts b/tests/app/ui/tab-view/tab-view-navigation-tests.ts index ed2e1255c..6bd794669 100644 --- a/tests/app/ui/tab-view/tab-view-navigation-tests.ts +++ b/tests/app/ui/tab-view/tab-view-navigation-tests.ts @@ -39,12 +39,12 @@ function _createListView(): ListView { var button =