forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
1,816 additions
and
867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8262.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Text; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
using System.Linq; | ||
|
||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 8262, "[Android] ImageRenderer still being accessed after control destroyed", | ||
PlatformAffected.Android)] | ||
#if UITEST | ||
[NUnit.Framework.Category(UITestCategories.LifeCycle)] | ||
[NUnit.Framework.Category(UITestCategories.CollectionView)] | ||
#endif | ||
public class Issue8262 : TestContentPage | ||
{ | ||
public View WithBounds(View v, double x, double y, double w, double h) | ||
{ | ||
AbsoluteLayout.SetLayoutBounds(v, new Rectangle(x, y, w, h)); | ||
return v; | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
IEnumerable<View> Select((string groupHeader, IEnumerable<int> items) t) | ||
{ | ||
yield return new AbsoluteLayout | ||
{ | ||
Children = { | ||
WithBounds(new Label { | ||
Text = t.groupHeader, HorizontalTextAlignment = TextAlignment.Center, | ||
TextColor = Color.FromUint(0xff5a5a5a), FontSize = 10 | ||
}, 0, 21.1, 310, AbsoluteLayout.AutoSize) }, | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
VerticalOptions = LayoutOptions.Start, | ||
HeightRequest = 46 | ||
}; | ||
foreach (var item in t.items) | ||
{ | ||
yield return new AbsoluteLayout | ||
{ | ||
Children = { | ||
|
||
WithBounds(new Image { Source = ImageSource.FromResource("Xamarin.Forms.Controls.GalleryPages.crimson.jpg", System.Reflection.Assembly.GetCallingAssembly()) }, 23.6, 14.5, 14.9, 20.7), | ||
|
||
WithBounds(new Label { Text = item.ToString(), TextColor = Color.FromUint(0xff5a5a5a), FontSize = 10 }, 58, 18.2, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize) | ||
}, | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
VerticalOptions = LayoutOptions.Start, | ||
HeightRequest = 49.7 | ||
}; | ||
} | ||
} | ||
|
||
Content = new AbsoluteLayout | ||
{ | ||
Children = { | ||
new CollectionView { | ||
ItemsSource = | ||
new (string, Func<int, bool>)[] { | ||
("odd", i => i % 2 == 1), | ||
("even", i => i % 2 == 0), | ||
("triple", i => i % 3 == 0), | ||
("fives", i => i % 5 == 0) } | ||
.Select(t => (t.Item1, Enumerable.Range(1, 100).Where(t.Item2))) | ||
.SelectMany(Select), | ||
ItemTemplate = new DataTemplate(() => { | ||
var template = new ContentView(); | ||
template.SetBinding(ContentView.ContentProperty, "."); | ||
return template; | ||
}), | ||
ItemsLayout = LinearItemsLayout.Vertical, | ||
ItemSizingStrategy = ItemSizingStrategy.MeasureFirstItem, | ||
AutomationId = "ScrollMe" | ||
} | ||
} | ||
}; | ||
} | ||
|
||
#if UITEST | ||
[Test] | ||
public void ScrollingQuicklyOnCollectionViewDoesntCrashOnDestroyedImage() | ||
{ | ||
RunningApp.WaitForElement("ScrollMe"); | ||
RunningApp.ScrollDown("ScrollMe", ScrollStrategy.Gesture, swipeSpeed: 20000); | ||
RunningApp.ScrollUp("ScrollMe", ScrollStrategy.Gesture, swipeSpeed: 20000); | ||
RunningApp.ScrollDown("ScrollMe", ScrollStrategy.Gesture, swipeSpeed: 20000); | ||
RunningApp.ScrollUp("ScrollMe", ScrollStrategy.Gesture, swipeSpeed: 20000); | ||
RunningApp.ScrollDown("ScrollMe", ScrollStrategy.Gesture, swipeSpeed: 20000); | ||
RunningApp.WaitForElement("ScrollMe"); | ||
} | ||
#endif | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8461.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
|
||
#if UITEST | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 8461, "[Bug] [iOS] [Shell] \"Nav Stack consistency error\"", | ||
PlatformAffected.iOS)] | ||
#if UITEST | ||
[NUnit.Framework.Category(UITestCategories.Shell)] | ||
[NUnit.Framework.Category(UITestCategories.Navigation)] | ||
#endif | ||
public class Issue8461 : TestShell | ||
{ | ||
const string ButtonId = "PageButtonId"; | ||
const string LayoutId = "LayoutId"; | ||
|
||
protected override void Init() | ||
{ | ||
var page1 = CreateContentPage("page 1"); | ||
var page2 = new ContentPage() { Title = "page 2" }; | ||
|
||
var pushPageBtn = new Button(); | ||
pushPageBtn.Text = "Push Page"; | ||
pushPageBtn.AutomationId = ButtonId; | ||
pushPageBtn.Clicked += (sender, args) => | ||
{ | ||
Navigation.PushAsync(page2); | ||
}; | ||
|
||
page1.Content = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
pushPageBtn | ||
} | ||
}; | ||
|
||
var instructions = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Label() | ||
{ | ||
Text = "1. Swipe left to dismiss this page, but cancel the gesture before it completes" | ||
}, | ||
new Label() | ||
{ | ||
Text = "2. Swipe left to dismiss this page again, crashes immediately" | ||
} | ||
} | ||
}; | ||
|
||
Grid.SetColumn(instructions, 1); | ||
|
||
page2.Content = new Grid() | ||
{ | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
VerticalOptions = LayoutOptions.FillAndExpand, | ||
|
||
ColumnDefinitions = new ColumnDefinitionCollection() | ||
{ | ||
new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }, | ||
new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }, | ||
}, | ||
|
||
Children = | ||
{ | ||
// Use this BoxView to achor our swipe to left of the screen | ||
new BoxView() | ||
{ | ||
AutomationId = LayoutId, | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
VerticalOptions = LayoutOptions.FillAndExpand, | ||
BackgroundColor = Color.Red | ||
}, | ||
instructions | ||
} | ||
}; | ||
} | ||
|
||
#if UITEST && __IOS__ | ||
[Test] | ||
public void ShellSwipeToDismiss() | ||
{ | ||
var pushButton = RunningApp.WaitForElement(ButtonId); | ||
Assert.AreEqual(1, pushButton.Length); | ||
|
||
RunningApp.Tap(ButtonId); | ||
|
||
var page2Layout = RunningApp.WaitForElement(LayoutId); | ||
Assert.AreEqual(1, page2Layout.Length); | ||
// Swipe in from left across 1/2 of screen width | ||
RunningApp.SwipeLeftToRight(LayoutId, 0.99, 500, false); | ||
// Swipe in from left across full screen width | ||
RunningApp.SwipeLeftToRight(0.99, 500); | ||
|
||
pushButton = RunningApp.WaitForElement(ButtonId); | ||
Assert.AreEqual(1, pushButton.Length); | ||
} | ||
#endif | ||
|
||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8644.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.ComponentModel; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 8644, "WPF Entry crashes when IsPassword=true", PlatformAffected.WPF)] | ||
public class Issue8644 : TestContentPage | ||
{ | ||
public class BinCon : INotifyPropertyChanged | ||
{ | ||
public event PropertyChangedEventHandler PropertyChanged; | ||
string _title; | ||
public string Title | ||
{ | ||
get => _title; | ||
set | ||
{ | ||
_title = value?.Length > 4 ? value.Substring(0, 4) : value; | ||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Title))); | ||
} | ||
} | ||
|
||
} | ||
protected override void Init() | ||
{ | ||
var bc = new BinCon(); | ||
var e1 = new Entry | ||
{ | ||
BindingContext = bc, | ||
Margin = new Thickness(50), | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
IsPassword = true, | ||
}; | ||
e1.SetBinding(Entry.TextProperty, nameof(BinCon.Title)); | ||
|
||
// Label just to show current Entry text, not needed for test | ||
var lbl = new Label { BindingContext = bc }; | ||
lbl.SetBinding(Label.TextProperty, nameof(BinCon.Title)); | ||
var stack = new StackLayout | ||
{ | ||
|
||
Children = { | ||
new Label { Text = "Type more than 4 symbols" }, | ||
e1, | ||
lbl, | ||
} | ||
}; | ||
|
||
Content = stack; | ||
} | ||
} | ||
} |
Oops, something went wrong.