This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
48e434b
commit cbd89a3
Showing
4 changed files
with
202 additions
and
5 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue13616.xaml
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,75 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<local:TestContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Title="Test 13616" xmlns:local="using:Xamarin.Forms.Controls" | ||
x:Class="Xamarin.Forms.Controls.Issues.Issue13616"> | ||
<StackLayout> | ||
<Label | ||
Padding="12" | ||
BackgroundColor="Black" | ||
TextColor="White" | ||
Text="Tap the Button to add a new Item, without exceptions, the test has passed."/> | ||
<StackLayout Padding="20,40,20,20"> | ||
<Button | ||
AutomationId="AddItemButtonId" | ||
Text="Add new Item" | ||
CornerRadius="10" | ||
Command="{Binding AddCardCommand}" | ||
HeightRequest="40" | ||
WidthRequest="200" | ||
HorizontalOptions="CenterAndExpand"/> | ||
<CarouselView | ||
x:Name="carouselView" | ||
AutomationId="CarouselViewId" | ||
HorizontalScrollBarVisibility="Never" | ||
ItemsSource="{Binding Items}" | ||
PeekAreaInsets="15" | ||
Loop="False" | ||
HeightRequest="250" | ||
VerticalOptions="Start"> | ||
<CarouselView.ItemsLayout> | ||
<LinearItemsLayout | ||
Orientation="Horizontal" | ||
SnapPointsAlignment="Center" | ||
SnapPointsType="MandatorySingle" | ||
ItemSpacing="6"/> | ||
</CarouselView.ItemsLayout> | ||
<CarouselView.ItemTemplate> | ||
<DataTemplate> | ||
<Frame | ||
HeightRequest="250" | ||
CornerRadius="10" | ||
HasShadow="False" | ||
Padding="0" | ||
IsClippedToBounds="True" | ||
Margin="10"> | ||
<Grid | ||
BackgroundColor="{Binding Color}"> | ||
<Grid Margin="20"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<Label | ||
Grid.Row="0" | ||
Margin="0,0,0,20" | ||
Text="{Binding Name}" | ||
TextColor="Black" /> | ||
<Label | ||
Grid.Row="1" | ||
Margin="0,0,0,20" | ||
Text="{Binding Desc}" | ||
TextColor="Black" /> | ||
</Grid> | ||
</Grid> | ||
</Frame> | ||
</DataTemplate> | ||
</CarouselView.ItemTemplate> | ||
</CarouselView> | ||
</StackLayout> | ||
</StackLayout> | ||
</local:TestContentPage> |
115 changes: 115 additions & 0 deletions
115
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue13616.xaml.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,115 @@ | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Windows.Input; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.CarouselView)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 13616, | ||
"[Bug] After updating XF 5.0.0.1931 getting Java.Lang.IllegalArgumentException: Invalid target position at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod", | ||
PlatformAffected.Android)] | ||
public partial class Issue13616 : TestContentPage | ||
{ | ||
public Issue13616() | ||
{ | ||
#if APP | ||
InitializeComponent(); | ||
BindingContext = new Issue13616ViewModel(); | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
} | ||
|
||
#if UITEST && __ANDROID__ | ||
[Test] | ||
public void Issue13616Test() | ||
{ | ||
RunningApp.WaitForElement("AddItemButtonId"); | ||
RunningApp.Tap("AddItemButtonId"); | ||
RunningApp.WaitForElement("CarouselViewId"); | ||
} | ||
#endif | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class Issue13616Model | ||
{ | ||
public string Name { get; set; } | ||
public string Desc { get; set; } | ||
public Color Color { get; set; } | ||
public double Scale { get; set; } | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class Issue13616ViewModel : BindableObject | ||
{ | ||
int _i = 4; | ||
ObservableCollection<Issue13616Model> _myList { get; set; } = new ObservableCollection<Issue13616Model>(); | ||
|
||
public Issue13616ViewModel() | ||
{ | ||
Items = new ObservableCollection<Issue13616Model> | ||
{ | ||
new Issue13616Model | ||
{ | ||
Name = "Card 1", | ||
Desc = "Card Holder Name 1", | ||
Color = Color.Yellow | ||
}, | ||
new Issue13616Model | ||
{ | ||
Name = "Card 2", | ||
Desc = "Card Holder Name 2", | ||
Color = Color.Orange | ||
}, | ||
new Issue13616Model | ||
{ | ||
Name = "Card 3", | ||
Desc = "Card Holder Name 3", | ||
Color = Color.Red | ||
} | ||
}; | ||
} | ||
|
||
public ObservableCollection<Issue13616Model> Items | ||
{ | ||
get | ||
{ | ||
return _myList; | ||
} | ||
set | ||
{ | ||
_myList = value; | ||
OnPropertyChanged(nameof(Items)); | ||
} | ||
} | ||
|
||
public ICommand AddCardCommand { get { return new Command(AddCard); } } | ||
|
||
void AddCard() | ||
{ | ||
var tempList = Items.ToList(); | ||
tempList.Add(new Issue13616Model | ||
{ | ||
Name = "Card " + _i, | ||
Desc = "Card Holder Name " + _i, | ||
Color = Color.Blue | ||
}); | ||
Items = new ObservableCollection<Issue13616Model>(tempList); | ||
_i++; | ||
} | ||
} | ||
} |
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
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