public void EmitsCorrectlyWhenPresentedOnBackPressed() { var detail = new BackButtonPage(); var master = new BackButtonPage { Title = "Master" }; var mdp = new MasterDetailPage { Detail = detail, Master = master, IsPresented = true, IsPlatformEnabled = true, Platform = new UnitPlatform() }; ((IMasterDetailPageController)mdp).BackButtonPressed += (sender, args) => { args.Handled = mdp.IsPresented; mdp.IsPresented = false; }; var detailEmitted = false; var masterEmitted = false; detail.BackPressed += (sender, args) => detailEmitted = true; master.BackPressed += (sender, args) => masterEmitted = true; var result = mdp.SendBackButtonPressed(); Assert.True(masterEmitted); Assert.False(detailEmitted); Assert.True(result); }
public void EmitsCorrectlyWhenPresentedOnBackPressed() { var detail = new BackButtonPage(); var Flyout = new BackButtonPage { Title = "Flyout" }; var mdp = new FlyoutPage { Detail = detail, Flyout = Flyout, IsPresented = true, IsPlatformEnabled = true, }; ((IFlyoutPageController)mdp).BackButtonPressed += (sender, args) => { args.Handled = mdp.IsPresented; mdp.IsPresented = false; }; var detailEmitted = false; var FlyoutEmitted = false; detail.BackPressed += (sender, args) => detailEmitted = true; Flyout.BackPressed += (sender, args) => FlyoutEmitted = true; var result = mdp.SendBackButtonPressed(); Assert.True(FlyoutEmitted); Assert.False(detailEmitted); Assert.True(result); }
public void SendsBackEventToPresentedMasterFirst() { var detail = new BackButtonPage() { Handle = true }; var master = new BackButtonPage() { Title = "Master" }; var mdp = new MasterDetailPage() { Detail = detail, Master = master, IsPresented = true, IsPlatformEnabled = true, }; ((IMasterDetailPageController)mdp).BackButtonPressed += (sender, args) => { args.Handled = mdp.IsPresented; mdp.IsPresented = false; }; var detailEmitted = false; var masterEmitted = false; detail.BackPressed += (sender, args) => detailEmitted = true; master.BackPressed += (sender, args) => masterEmitted = true; var result = mdp.SendBackButtonPressed(); Assert.True(masterEmitted); Assert.False(detailEmitted); Assert.True(result); }
public void SendsBackButtonEventToCurrentPage() { var current = new BackButtonPage(); var navPage = new NavigationPage(current); var emitted = false; current.BackPressed += (sender, args) => emitted = true; navPage.SendBackButtonPressed(); Assert.True(emitted); }
public void DoesNotSendBackEventToNonCurrentPage() { var current = new BackButtonPage(); var navPage = new NavigationPage(current); navPage.PushAsync(new ContentPage()); var emitted = false; current.BackPressed += (sender, args) => emitted = true; navPage.SendBackButtonPressed(); Assert.False(emitted); }
public async Task DoesNotNavigatesBackWhenBackButtonPressedIfHandled() { var root = new BackButtonPage { Title = "Root" }; var second = new BackButtonPage() { Handle = true }; var navPage = new NavigationPage(root); await navPage.PushAsync(second); navPage.SendBackButtonPressed(); Assert.AreEqual(second, navPage.CurrentPage); }
public async void DoesNotNavigatesBackWhenBackButtonPressedIfHandled () { var root = new BackButtonPage { Title = "Root" }; var second = new BackButtonPage () {Handle = true}; var navPage = new NavigationPage (root); await navPage.PushAsync (second); navPage.SendBackButtonPressed (); Assert.AreEqual (second, navPage.CurrentPage); }
public void DoesNotSendBackEventToNonCurrentPage () { var current = new BackButtonPage (); var navPage = new NavigationPage (current); navPage.PushAsync (new ContentPage ()); var emitted = false; current.BackPressed += (sender, args) => emitted = true; navPage.SendBackButtonPressed (); Assert.False (emitted); }
public void SendsBackButtonEventToCurrentPage () { var current = new BackButtonPage (); var navPage = new NavigationPage (current); var emitted = false; current.BackPressed += (sender, args) => emitted = true; navPage.SendBackButtonPressed (); Assert.True (emitted); }
public void EmitsCorrectlyWhenPresentedOnBackPressed () { var detail = new BackButtonPage (); var master = new BackButtonPage { Title = "Master" }; var mdp = new MasterDetailPage { Detail = detail, Master = master, IsPresented = true, IsPlatformEnabled = true, Platform = new UnitPlatform () }; ((IMasterDetailPageController)mdp).BackButtonPressed += (sender, args) => { args.Handled = mdp.IsPresented; mdp.IsPresented = false; }; var detailEmitted = false; var masterEmitted = false; detail.BackPressed += (sender, args) => detailEmitted = true; master.BackPressed += (sender, args) => masterEmitted = true; var result = mdp.SendBackButtonPressed (); Assert.True (masterEmitted); Assert.False (detailEmitted); Assert.True (result); }