summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-10-11 14:36:42 -0700
committerRui Marinho <me@ruimarinho.net>2016-10-11 22:36:42 +0100
commit7870aefc688f20cc7ad2e6251a9f3a26d6601d1d (patch)
treed5c13bed56fabaaa31a13a8f12fd0eaf27bfdbe5
parent9f167ffd1bb9608255ae76b2c6b5353a956073dd (diff)
downloadxamarin-forms-7870aefc688f20cc7ad2e6251a9f3a26d6601d1d.tar.gz
xamarin-forms-7870aefc688f20cc7ad2e6251a9f3a26d6601d1d.tar.bz2
xamarin-forms-7870aefc688f20cc7ad2e6251a9f3a26d6601d1d.zip
Add reproduction for 41153 (#428)
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41153.cs99
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 100 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41153.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41153.cs
new file mode 100644
index 00000000..7c8a162a
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41153.cs
@@ -0,0 +1,99 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows.Input;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 41153, "jobject must not be IntPtr.Zero with TabbedPage and ToolbarItems")]
+ public class Bugzilla41153 : TestTabbedPage
+ {
+ MyViewModel _Vm = new MyViewModel();
+ const string Tab1 = "Tab 1";
+ const string Tab1Content = "On Tab 1";
+ const string Tab2 = "Tab 2";
+ const string Tab3 = "Tab 3";
+ const string Tab3Content = "On Tab 3";
+ const string ToolbarItemText = "Toolbar Item";
+ const string Success = "Success";
+
+ [Preserve(AllMembers = true)]
+ class MyViewModel : INotifyPropertyChanged
+ {
+ string _toolBarItemText;
+ public string ToolbarItemText
+ {
+ get
+ {
+ return _toolBarItemText;
+ }
+ set
+ {
+ _toolBarItemText = value;
+ OnPropertyChanged();
+ }
+ }
+
+ ICommand _toolBarItemCommand;
+ public ICommand ToolbarItemCommand
+ {
+ get
+ {
+ if (_toolBarItemCommand == null)
+ {
+ _toolBarItemCommand = new Command(() =>
+ {
+ ToolbarItemText = Success;
+ });
+ }
+
+ return _toolBarItemCommand;
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ protected override void Init()
+ {
+ var page1 = new ContentPage { Content = new Label { Text = Tab1Content }, BindingContext = _Vm };
+ var toolBarItem = new ToolbarItem();
+ toolBarItem.SetBinding(ToolbarItem.CommandProperty, nameof(MyViewModel.ToolbarItemCommand));
+ toolBarItem.SetBinding(ToolbarItem.TextProperty, nameof(MyViewModel.ToolbarItemText));
+ page1.ToolbarItems.Add(toolBarItem);
+ var page2 = new ContentPage();
+ var page3 = new ContentPage { Content = new Label { Text = Tab3Content } };
+ Children.Add(new NavigationPage(page1) { Title = Tab1 });
+ Children.Add(new NavigationPage(page2) { Title = Tab2 });
+ Children.Add(new NavigationPage(page3) { Title = Tab3 });
+ _Vm.ToolbarItemText = ToolbarItemText;
+ }
+
+#if UITEST
+ [Test]
+ public void Bugzilla41153Test()
+ {
+ RunningApp.WaitForElement(q => q.Marked(Tab1Content));
+ RunningApp.Tap(q => q.Marked(Tab2));
+ RunningApp.Tap(q => q.Marked(Tab3));
+ RunningApp.WaitForElement(q => q.Marked(Tab3Content));
+ RunningApp.Tap(q => q.Marked(Tab1));
+ RunningApp.WaitForElement(q => q.Marked(Tab1Content));
+ RunningApp.Tap(q => q.Marked(ToolbarItemText));
+ RunningApp.WaitForElement(q => q.Marked(Success));
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 5e188ba8..a23c7cd0 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -189,6 +189,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43161.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39768.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41271.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41153.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />