зеркало из https://github.com/DeGsoft/maui-linux.git
* Add missing call to ReloadData on INCC Reset; fixes #5793 * Automated test for INCC Reset
This commit is contained in:
Родитель
bfd4ed0f04
Коммит
6147647f69
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.Forms.Core.UITests;
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
#if UITEST
|
||||
[Category(UITestCategories.CollectionView)]
|
||||
#endif
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 5793, "[CollectionView/ListView] Not listening for Reset command",
|
||||
PlatformAffected.iOS | PlatformAffected.Android)]
|
||||
class Issue5793 : TestNavigationPage
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
#if APP
|
||||
Device.SetFlags(new List<string>(Device.Flags ?? new List<string>()) { "CollectionView_Experimental" });
|
||||
|
||||
PushAsync(new GalleryPages.CollectionViewGalleries.ObservableCollectionResetGallery());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UITEST
|
||||
[Test]
|
||||
public void Reset()
|
||||
{
|
||||
RunningApp.WaitForElement("Reset");
|
||||
|
||||
// Verify the item is there
|
||||
RunningApp.WaitForElement("cover1.jpg, 0");
|
||||
|
||||
// Clear the collection
|
||||
RunningApp.Tap("Reset");
|
||||
|
||||
// Verify the item is gone
|
||||
RunningApp.WaitForNoElement("cover1.jpg, 0");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -462,6 +462,7 @@
|
|||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue5535.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue5793.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)LegacyComponents\NonAppCompatSwitch.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MapsModalCrash.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ModalActivityIndicatorTest.cs" />
|
||||
|
|
|
@ -77,12 +77,7 @@ namespace Xamarin.Forms.Controls.GalleryPages.CollectionViewGalleries
|
|||
|
||||
public void TestReset()
|
||||
{
|
||||
var random = new Random();
|
||||
var randomized = GetRange(0, Count).Select(item => new { Item = item, Index = random.Next(100000) })
|
||||
.OrderBy(x => x.Index).Select(x => x.Item).ToList();
|
||||
|
||||
RemoveRange(0, Count);
|
||||
InsertRange(0, randomized);
|
||||
|
||||
var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);
|
||||
OnNotifyCollectionChanged(this, args);
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
Move(args);
|
||||
break;
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
_collectionView.ReloadData();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
|
Загрузка…
Ссылка в новой задаче