Skip to content

Commit

Permalink
fix(dragdrop): Add missing file for ListView drag and drop support
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb authored and Dr.Rx committed Dec 14, 2020
1 parent e53bfaa commit 2252868
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if false
using System;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
Expand All @@ -18,46 +17,46 @@ public class DragDrop_ListViewReorder_Automated : SampleControlUITestBase
private static readonly string[] _items = new[] {"#FF0018", "#FFA52C", "#FFFF41", "#008018", "#0000F9", "#86007D"};
private const int _itemHeight = 100;

private static float Item(IAppRect sut, int index) => sut.Y + (index * _itemHeight) - 25;
private static float Item(IAppRect sut, int index) => sut.Y + (index * _itemHeight) + 25;

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_Down() => Test_Reorder(1, 3);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_Up() => Test_Reorder(3, 1);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_First() => Test_Reorder(0, 2);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_Last() => Test_Reorder(5, 2);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_To_First() => Test_Reorder(1, 0);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_To_Last() => Test_Reorder(3, 5);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_First_To_Last() => Test_Reorder(0, 5);

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android | Platform.iOS)]
[ActivePlatforms(Platform.Browser)]
public void When_Reorder_Last_To_First() => Test_Reorder(0, 5);

public void Test_Reorder(int from, int to)
Expand All @@ -81,4 +80,3 @@ public void Test_Reorder(int from, int to)
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ partial class ItemsStackPanelLayout

protected override Line CreateLine(GeneratorDirection fillDirection, double extentOffset, double availableBreadth, Uno.UI.IndexPath nextVisibleItem)
{
if (ShouldInsertReorderingView(extentOffset))
{
nextVisibleItem = GetReorderingIndex().Value;
}

var item = GetFlatItemIndex(nextVisibleItem);
var view = Generator.DequeueViewForItem(item);

Expand Down

0 comments on commit 2252868

Please sign in to comment.