Skip to content

Commit 941e797

Browse files
committed
Add test for issue xamarin#14350
1 parent 78d9f87 commit 941e797

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
mc:Ignorable="d"
7+
Title="Test 14350"
8+
x:Class="Xamarin.Forms.Controls.Issues.Issue14350">
9+
10+
<RefreshView IsRefreshing="{Binding IsRefreshing}" Command="{Binding Refresh}" IsEnabled="{Binding IsRefreshAllowed}">
11+
<ScrollView>
12+
<StackLayout>
13+
<Label Text="Test for issue #14350" />
14+
<Label Text="Refreshing ..." IsVisible="{Binding IsRefreshing}" BackgroundColor="Orange"/>
15+
<Label Text="Enable refresh:" IsVisible="{Binding IsRefreshAllowed}" TextColor="Green"/>
16+
<StackLayout>
17+
<StackLayout Orientation="Horizontal">
18+
<Label Text="Refresh enabled:" HorizontalOptions="FillAndExpand"/>
19+
<Switch IsToggled="{Binding IsRefreshAllowed}" />
20+
</StackLayout>
21+
</StackLayout>
22+
<StackLayout>
23+
<Label Text="Test steps (Android):" />
24+
<Label Text="1. Swipe to refresh" />
25+
<Label Text="2. Refresh/busy indicator appears at the top" />
26+
<Label Text="3. Refresh/busy indicator should remain visible until content changes (refresh is finished).
27+
due to issue #14350 the indicator vanishes too early if Command.CanExecute toggles (in this test after 1 second)." />
28+
<Label Text="4. Repeat steps 1 to 3 multiple times" />
29+
</StackLayout>
30+
</StackLayout>
31+
</ScrollView>
32+
</RefreshView>
33+
</ContentPage>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.ComponentModel;
2+
3+
using Xamarin.Forms;
4+
using Xamarin.Forms.CustomAttributes;
5+
using Xamarin.Forms.Internals;
6+
7+
namespace Xamarin.Forms.Controls.Issues
8+
{
9+
// Learn more about making custom code visible in the Xamarin.Forms previewer
10+
// by visiting https://aka.ms/xamarinforms-previewer
11+
[DesignTimeVisible(false)]
12+
[Preserve(AllMembers = true)]
13+
[Issue(IssueTracker.Github, 14350,
14+
"[Bug] RefreshView to completes instantly when using AsyncCommand or Command with CanExecute functionality",
15+
PlatformAffected.Android)]
16+
public partial class Issue14350 : ContentPage
17+
{
18+
public Issue14350()
19+
{
20+
#if APP
21+
InitializeComponent();
22+
BindingContext = new ViewModelIssue8384();
23+
#endif
24+
}
25+
}
26+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8384.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public bool Allow
5555

5656
private List<string> _items;
5757
private bool _isRefreshing;
58+
private bool _isRefreshAllowed = true;
5859
private MyCommand _refresh;
5960

6061
static readonly List<string> FIRST_LIST = new List<string>() {
@@ -78,6 +79,19 @@ public bool IsRefreshing
7879
}
7980
}
8081

82+
public bool IsRefreshAllowed
83+
{
84+
get
85+
{
86+
return _isRefreshAllowed;
87+
}
88+
set
89+
{
90+
_isRefreshAllowed = value;
91+
OnPropertyChanged("IsRefreshAllowed");
92+
}
93+
}
94+
8195
public ViewModelIssue8384()
8296
{
8397
Items = FIRST_LIST;

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,7 @@
17951795
<Compile Include="$(MSBuildThisFileDirectory)Issue11795.xaml.cs" />
17961796
<Compile Include="$(MSBuildThisFileDirectory)Issue14528.cs" />
17971797
<Compile Include="$(MSBuildThisFileDirectory)Issue14286.xaml.cs" />
1798+
<Compile Include="$(MSBuildThisFileDirectory)Issue14350.xaml.cs" />
17981799
<Compile Include="$(MSBuildThisFileDirectory)Issue14613.xaml.cs" />
17991800
<Compile Include="$(MSBuildThisFileDirectory)Issue13930.xaml.cs" />
18001801
<Compile Include="$(MSBuildThisFileDirectory)Issue11211.xaml.cs" />
@@ -2282,6 +2283,9 @@
22822283
</EmbeddedResource>
22832284
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue14286.xaml">
22842285
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
2286+
</EmbeddedResource>
2287+
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue14350.xaml">
2288+
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
22852289
</EmbeddedResource>
22862290
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue14613.xaml">
22872291
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>

0 commit comments

Comments
 (0)