diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml
index 129204a7d75c..7119eeae7db6 100644
--- a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml
+++ b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml
@@ -63,8 +63,15 @@
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml.cs b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml.cs
index 4264a112db7d..f4a5c397a6c2 100644
--- a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropBetweenLayouts.xaml.cs
@@ -12,11 +12,6 @@ public DragAndDropBetweenLayouts()
InitializeComponent();
}
- void AddEvent(string name)
- {
- events.Text += $"{name},";
- }
-
void OnDragStarting(object sender, DragStartingEventArgs e)
{
_emittedDragOver = false;
@@ -30,7 +25,7 @@ void OnDragStarting(object sender, DragStartingEventArgs e)
else
SLAllColors.Background = SolidColorBrush.LightBlue;
- AddEvent(nameof(OnDragStarting));
+ dragStartEvent.Text = "DragStarting";
dragStartRelativeSelf.Text = $"Drag Start relative to self: {(int)e.GetPosition(label).Value.X},{(int)e.GetPosition(label).Value.Y}";
dragStartRelativeScreen.Text = $"Drag Start relative to screen: {(int)e.GetPosition(null).Value.X},{(int)e.GetPosition(null).Value.Y}";
@@ -46,7 +41,7 @@ void OnDropCompleted(object sender, DropCompletedEventArgs e)
else
SLAllColors.Background = SolidColorBrush.White;
- AddEvent(nameof(OnDropCompleted));
+ dragCompletedEvent.Text = "DropCompleted";
}
void OnDragOver(object sender, DragEventArgs e)
@@ -66,7 +61,7 @@ void OnDragOver(object sender, DragEventArgs e)
if (!_emittedDragOver) // This can generate a lot of noise, only add it once
{
- AddEvent(nameof(OnDragOver));
+ dragOverEvent.Text = "DragOver";
_emittedDragOver = true;
}
@@ -89,7 +84,7 @@ void OnDragLeave(object sender, DragEventArgs e)
sl.Background = SolidColorBrush.LightBlue;
- AddEvent(nameof(OnDragLeave));
+ dragLeaveEvent.Text= "DragLeave";
}
void OnDrop(object sender, DropEventArgs e)
@@ -109,13 +104,12 @@ void OnDrop(object sender, DropEventArgs e)
{
SLAllColors.Children.Remove(color);
SLRainbow.Children.Add(color);
- AddEvent($"RainbowColorsAdd:{color.Text}");
+ ranibowColors.Text = $"RainbowColorsAdd:{color.Text}";
}
else
{
SLRainbow.Children.Remove(color);
SLAllColors.Children.Add(color);
- AddEvent($"AllColorsAdd:{color.Text}");
}
dropRelativeLayout.Text = $"Drop relative to receiving layout: {(int)e.GetPosition(sl).Value.X},{(int)e.GetPosition(sl).Value.Y}";
@@ -125,7 +119,7 @@ void OnDrop(object sender, DropEventArgs e)
SLAllColors.Background = SolidColorBrush.White;
SLRainbow.Background = SolidColorBrush.White;
- AddEvent(nameof(OnDrop));
+ dropEvent.Text = "Drop";
}
void ResetLayouts(object sender, System.EventArgs e)
@@ -166,7 +160,11 @@ Label RegenerateColorLabel(string color)
void ResetTestLabels()
{
- events.Text = "EventsLabel: ";
+ dragStartEvent.Text = "DragStartEvents: ";
+ dragOverEvent.Text = "DragOverEvents: ";
+ dragCompletedEvent.Text = "DragCompletedEvents: ";
+ ranibowColors.Text = "RainbowColorsAdd: ";
+ dropEvent.Text = "DropEvents: ";
dragStartRelativeSelf.Text = "Drag Start relative to self:";
dragStartRelativeScreen.Text = "Drag Start relative to screen:";
diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml
index f19212fd7c00..5f6a3d01ec54 100644
--- a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml
+++ b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml
@@ -17,10 +17,11 @@
-
-
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml.cs b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml.cs
index 07236a36fded..cf4e6d94d93d 100644
--- a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEventArgs.xaml.cs
@@ -8,11 +8,6 @@ public DragAndDropEventArgs()
InitializeComponent();
}
- void AddEvent(string name)
- {
- events.Text += $"{name},";
- }
-
void DragStarting(object sender, DragStartingEventArgs e)
{
_emittedDragOver = false;
@@ -20,22 +15,22 @@ void DragStarting(object sender, DragStartingEventArgs e)
{
#if IOS || MACCATALYST
if (platformArgs.Sender is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.Sender));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragInteraction is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.DragInteraction));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.DragInteraction)},";
if (platformArgs.DragSession is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.DragSession));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.DragSession)},";
#elif ANDROID
if (platformArgs.Sender is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.Sender));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.Sender)},";
if (platformArgs.MotionEvent is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.MotionEvent));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.MotionEvent)},";
#elif WINDOWS
if (platformArgs.Sender is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.Sender));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragStartingEventArgs is not null)
- AddEvent("DragStarting:" + nameof(platformArgs.DragStartingEventArgs));
- AddEvent("DragStarting:" + nameof(platformArgs.Handled));
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.DragStartingEventArgs)},";
+ dragStartEvent.Text += $"{"DragStarting:" + nameof(platformArgs.Handled)},";
#endif
}
}
@@ -46,21 +41,21 @@ void DropCompleted(object sender, DropCompletedEventArgs e)
{
#if IOS || MACCATALYST
if (platformArgs.Sender is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.Sender));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.Sender)},";
if (platformArgs.DropInteraction is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.DropInteraction));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.DropInteraction)},";
if (platformArgs.DropSession is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.DropSession));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.DropSession)},";
#elif ANDROID
if (platformArgs.Sender is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.Sender));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEvent is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.DragEvent));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.DragEvent)},";
#elif WINDOWS
if (platformArgs.Sender is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.Sender));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.Sender)},";
if (platformArgs.DropCompletedEventArgs is not null)
- AddEvent("DropCompleted:" + nameof(platformArgs.DropCompletedEventArgs));
+ dropCompletedEvent.Text += $"{"DropCompleted:" + nameof(platformArgs.DropCompletedEventArgs)},";
#endif
}
}
@@ -71,22 +66,22 @@ void DragLeave(object sender, DragEventArgs e)
{
#if IOS || MACCATALYST
if (platformArgs.Sender is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.Sender));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.Sender)},";
if (platformArgs.DropInteraction is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.DropInteraction));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.DropInteraction)},";
if (platformArgs.DropSession is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.DropSession));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.DropSession)},";
#elif ANDROID
if (platformArgs.Sender is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.Sender));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEvent is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.DragEvent));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.DragEvent)},";
#elif WINDOWS
if (platformArgs.Sender is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.Sender));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEventArgs is not null)
- AddEvent("DragLeave:" + nameof(platformArgs.DragEventArgs));
- AddEvent("DragLeave:" + nameof(platformArgs.Handled));
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.DragEventArgs)},";
+ dragLeaveEvent.Text += $"{"DragLeave:" + nameof(platformArgs.Handled)},";
#endif
}
}
@@ -99,21 +94,21 @@ void DragOver(object sender, DragEventArgs e)
{
#if IOS || MACCATALYST
if (platformArgs.Sender is not null)
- AddEvent("DragOver:" + nameof(platformArgs.Sender));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.Sender)},";
if (platformArgs.DropInteraction is not null)
- AddEvent("DragOver:" + nameof(platformArgs.DropInteraction));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.DropInteraction)},";
if (platformArgs.DropSession is not null)
- AddEvent("DragOver:" + nameof(platformArgs.DropSession));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.DropSession)},";
#elif ANDROID
if (platformArgs.Sender is not null)
- AddEvent("DragOver:" + nameof(platformArgs.Sender));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEvent is not null)
- AddEvent("DragOver:" + nameof(platformArgs.DragEvent));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.DragEvent)},";
#elif WINDOWS
if (platformArgs.Sender is not null)
- AddEvent("DragOver:" + nameof(platformArgs.Sender));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEventArgs is not null)
- AddEvent("DragOver:" + nameof(platformArgs.DragEventArgs));
+ dragOverEvent.Text += $"{"DragOver:" + nameof(platformArgs.DragEventArgs)},";
#endif
}
_emittedDragOver = true;
@@ -126,21 +121,21 @@ void Drop(object sender, DropEventArgs e)
{
#if IOS || MACCATALYST
if (platformArgs.Sender is not null)
- AddEvent("Drop:" + nameof(platformArgs.Sender));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.Sender)},";
if (platformArgs.DropInteraction is not null)
- AddEvent("Drop:" + nameof(platformArgs.DropInteraction));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.DropInteraction)},";
if (platformArgs.DropSession is not null)
- AddEvent("Drop:" + nameof(platformArgs.DropSession));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.DropSession)},";
#elif ANDROID
if (platformArgs.Sender is not null)
- AddEvent("Drop:" + nameof(platformArgs.Sender));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEvent is not null)
- AddEvent("Drop:" + nameof(platformArgs.DragEvent));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.DragEvent)},";
#elif WINDOWS
if (platformArgs.Sender is not null)
- AddEvent("Drop:" + nameof(platformArgs.Sender));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.Sender)},";
if (platformArgs.DragEventArgs is not null)
- AddEvent("Drop:" + nameof(platformArgs.DragEventArgs));
+ dropEvent.Text += $"{"Drop:" + nameof(platformArgs.DragEventArgs)},";
#endif
}
}
diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml
index 6dad934640a2..6046a6cdc621 100644
--- a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml
+++ b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml
@@ -17,10 +17,11 @@
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml.cs b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml.cs
index eed3710429c3..92974397ab6f 100644
--- a/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Elements/DragAndDropEvents.xaml.cs
@@ -8,39 +8,34 @@ public DragAndDropEvents()
InitializeComponent();
}
- void AddEvent(string name)
- {
- events.Text += $"{name},";
- }
-
void DragStarting(object sender, DragStartingEventArgs e)
{
_emittedDragOver = false;
- AddEvent(nameof(DragStarting));
+ dragStartEvent.Text = "DragStarting";
}
void DropCompleted(object sender, DropCompletedEventArgs e)
{
- AddEvent(nameof(DropCompleted));
+ dragCompletedEvent.Text = "DropCompleted";
}
void DragLeave(object sender, DragEventArgs e)
{
- AddEvent(nameof(DragLeave));
+ dragLeaveEvent.Text = "DragLeave";
}
void DragOver(object sender, DragEventArgs e)
{
if (!_emittedDragOver) // This can generate a lot of noise, only add it once
{
- AddEvent(nameof(DragOver));
+ dragOverEvent.Text = "DragOver";
_emittedDragOver = true;
}
}
void Drop(object sender, DropEventArgs e)
{
- AddEvent(nameof(Drop));
+ dropEvent.Text = "Drop";
}
}
}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs
index bb858c5a42ba..e4ec21c0a5c9 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs
@@ -32,18 +32,50 @@ public void DragEvents()
App.WaitForElement("LabelDragElement");
App.DragAndDrop("LabelDragElement", "DragTarget");
- App.WaitForElement("DragEventsLabel");
- var textAfterDrag = App.FindElement("DragEventsLabel").GetText();
- if (string.IsNullOrEmpty(textAfterDrag))
+ App.WaitForElement("DragStartEventsLabel");
+ var textAfterDragStart = App.FindElement("DragStartEventsLabel").GetText();
+
+ if (string.IsNullOrEmpty(textAfterDragStart))
{
- Assert.Fail("Text was expected");
+ Assert.Fail("Text was expected: Drag start event");
+ }
+ else
+ {
+ Assert.That(textAfterDragStart, Is.EqualTo("DragStarting"));
+ }
+
+ App.WaitForElement("DragOverEventsLabel");
+ var textAfterDragOver = App.FindElement("DragOverEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDragOver))
+ {
+ Assert.Fail("Text was expected: Drag over event");
+ }
+ else
+ {
+ Assert.That(textAfterDragOver, Is.EqualTo("DragOver"));
+ }
+
+ App.WaitForElement("DragCompletedEventsLabel");
+ var textAfterDragComplete = App.FindElement("DragCompletedEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDragComplete))
+ {
+ Assert.Fail("Text was expected: Drag complete event");
+ }
+ else
+ {
+ Assert.That(textAfterDragComplete, Is.EqualTo("DropCompleted"));
+ }
+
+ App.WaitForElement("DropEventsLabel");
+ var textAfterDrop = App.FindElement("DropEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDrop))
+ {
+ Assert.Fail("Text was expected: Drop event");
}
else
{
- ClassicAssert.True(textAfterDrag.Contains("DragStarting", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragOver", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDrop, Is.EqualTo("Drop"));
}
}
@@ -61,19 +93,61 @@ public void DragAndDropBetweenLayouts()
App.WaitForElement("Red");
App.WaitForElement("Green");
App.DragAndDrop("Red", "Green");
- App.WaitForElement("DragEventsLabel");
- var textAfterDrag = App.FindElement("DragEventsLabel").GetText();
- if (string.IsNullOrEmpty(textAfterDrag))
+ App.WaitForElement("DragStartEventsLabel");
+ var textAfterDragStart = App.FindElement("DragStartEventsLabel").GetText();
+
+ if (string.IsNullOrEmpty(textAfterDragStart))
+ {
+ Assert.Fail("Text was expected: Drag start event");
+ }
+ else
+ {
+ Assert.That(textAfterDragStart, Is.EqualTo("DragStarting"));
+ }
+
+ App.WaitForElement("DragOverEventsLabel");
+ var textAfterDragOver = App.FindElement("DragOverEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDragOver))
+ {
+ Assert.Fail("Text was expected: Drag over event");
+ }
+ else
+ {
+ Assert.That(textAfterDragOver, Is.EqualTo("DragOver"));
+ }
+
+ App.WaitForElement("DragCompletedEventsLabel");
+ var textAfterDragComplete = App.FindElement("DragCompletedEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDragComplete))
+ {
+ Assert.Fail("Text was expected: Drag complete event");
+ }
+ else
+ {
+ Assert.That(textAfterDragComplete, Is.EqualTo("DropCompleted"));
+ }
+
+ App.WaitForElement("RainBowColorsLabel");
+ var rainbowColorText = App.FindElement("RainBowColorsLabel").GetText();
+ if (string.IsNullOrEmpty(rainbowColorText))
{
Assert.Fail("Text was expected");
}
else
{
- ClassicAssert.True(textAfterDrag.Contains("DragStarting", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragOver", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("RainbowColorsAdd:Red", StringComparison.OrdinalIgnoreCase));
+ Assert.That(rainbowColorText, Is.EqualTo("RainbowColorsAdd:Red"));
+ }
+
+ App.WaitForElement("DropEventsLabel");
+ var textAfterDrop = App.FindElement("DropEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDrop))
+ {
+ Assert.Fail("Text was expected: Drop event");
+ }
+ else
+ {
+ Assert.That(textAfterDrop, Is.EqualTo("Drop"));
}
}
@@ -87,77 +161,113 @@ public void PlatformDragEventArgs()
App.WaitForElement("LabelDragElement");
App.DragAndDrop("LabelDragElement", "DragTarget");
- App.WaitForElement("DragEventsLabel");
- var textAfterDrag = App.FindElement("DragEventsLabel").GetText();
+ App.WaitForElement("DragStartEventsLabel");
+ var textAfterDragStart = App.FindElement("DragStartEventsLabel").GetText();
- if (string.IsNullOrEmpty(textAfterDrag))
+ if (string.IsNullOrEmpty(textAfterDragStart))
{
- Assert.Fail("Text was expected");
+ Assert.Fail("Text was expected: Drag start event");
}
else
{
if (Device == TestDevice.iOS || Device == TestDevice.Mac)
{
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:DragInteraction", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:DragSession", StringComparison.OrdinalIgnoreCase));
-
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:DropInteraction", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:DropSession", StringComparison.OrdinalIgnoreCase));
-
- // Until the UI test can drag over an item without placing it down
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:Sender", StringComparison.OrdinalIgnoreCase));
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:DropInteraction", StringComparison.OrdinalIgnoreCase));
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:DropSession", StringComparison.OrdinalIgnoreCase));
-
- ClassicAssert.True(textAfterDrag.Contains("DragOver:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragOver:DropInteraction", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragOver:DropSession", StringComparison.OrdinalIgnoreCase));
-
- ClassicAssert.True(textAfterDrag.Contains("Drop:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("Drop:DropInteraction", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("Drop:DropSession", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:DragInteraction", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:DragSession", StringComparison.OrdinalIgnoreCase));
}
else if (Device == TestDevice.Android)
{
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:MotionEvent", StringComparison.OrdinalIgnoreCase));
-
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:DragEvent", StringComparison.OrdinalIgnoreCase));
-
- // Until the UI test can drag over an item without placing it down
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:Sender", StringComparison.OrdinalIgnoreCase));
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:DragEvent", StringComparison.OrdinalIgnoreCase));
-
- ClassicAssert.True(textAfterDrag.Contains("DragOver:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragOver:DragEvent", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:MotionEvent", StringComparison.OrdinalIgnoreCase));
+ }
+ else
+ {
+ Assert.That(textAfterDragStart.Contains("DragStarting:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:DragStartingEventArgs", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragStart.Contains("DragStarting:Handled", StringComparison.OrdinalIgnoreCase));
+ }
+ }
- ClassicAssert.True(textAfterDrag.Contains("Drop:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("Drop:DragEvent", StringComparison.OrdinalIgnoreCase));
+ App.WaitForElement("DragOverEventsLabel");
+ var textAfterDragOver = App.FindElement("DragOverEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDragOver))
+ {
+ Assert.Fail("Text was expected: Drag over event");
+ }
+ else
+ {
+ if (Device == TestDevice.iOS || Device == TestDevice.Mac)
+ {
+ Assert.That(textAfterDragOver.Contains("DragOver:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragOver.Contains("DragOver:DropInteraction", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragOver.Contains("DragOver:DropSession", StringComparison.OrdinalIgnoreCase));
+ }
+ else if (Device == TestDevice.Android)
+ {
+ Assert.That(textAfterDragOver.Contains("DragOver:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragOver.Contains("DragOver:DragEvent", StringComparison.OrdinalIgnoreCase));
+ }
+ else
+ {
+ Assert.That(textAfterDragOver.Contains("DragOver:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDragOver.Contains("DragOver:DragEventArgs", StringComparison.OrdinalIgnoreCase));
+ }
+ }
+ App.WaitForElement("DropCompletedEventsLabel");
+ var textAfterDropComplete = App.FindElement("DropCompletedEventsLabel").GetText();
+ if (string.IsNullOrEmpty(textAfterDropComplete))
+ {
+ Assert.Fail("Text was expected: Drop complete event");
+ }
+ else
+ {
+ if (Device == TestDevice.iOS || Device == TestDevice.Mac)
+ {
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:DropInteraction", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:DropSession", StringComparison.OrdinalIgnoreCase));
+ }
+ else if (Device == TestDevice.Android)
+ {
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:DragEvent", StringComparison.OrdinalIgnoreCase));
}
else
{
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:DragStartingEventArgs", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragStarting:Handled", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDropComplete.Contains("DropCompleted:DropCompletedEventArgs", StringComparison.OrdinalIgnoreCase));
+ }
+ }
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DropCompleted:DropCompletedEventArgs", StringComparison.OrdinalIgnoreCase));
+ App.WaitForElement("DropEventsLabel");
- // Until the UI test can drag over an item without placing it down
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:Sender", StringComparison.OrdinalIgnoreCase));
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:DragEventArgs", StringComparison.OrdinalIgnoreCase));
- //ClassicAssert.True(textAfterDrag.Contains("DragLeave:Handled", StringComparison.OrdinalIgnoreCase));
+ var textAfterDrop = App.FindElement("DropEventsLabel").GetText();
- ClassicAssert.True(textAfterDrag.Contains("DragOver:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("DragOver:DragEventArgs", StringComparison.OrdinalIgnoreCase));
+ if (string.IsNullOrEmpty(textAfterDrop))
+ {
+ Assert.Fail("Text was expected: drop event");
+ }
+ else
+ {
+ if (Device == TestDevice.iOS || Device == TestDevice.Mac)
+ {
+ Assert.That(textAfterDrop.Contains("Drop:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDrop.Contains("Drop:DropInteraction", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDrop.Contains("Drop:DropSession", StringComparison.OrdinalIgnoreCase));
+ }
+ else if (Device == TestDevice.Android)
+ {
+ Assert.That(textAfterDrop.Contains("Drop:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDrop.Contains("Drop:DragEvent", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("Drop:Sender", StringComparison.OrdinalIgnoreCase));
- ClassicAssert.True(textAfterDrag.Contains("Drop:DragEventArgs", StringComparison.OrdinalIgnoreCase));
+ }
+ else
+ {
+ Assert.That(textAfterDrop.Contains("Drop:Sender", StringComparison.OrdinalIgnoreCase));
+ Assert.That(textAfterDrop.Contains("Drop:DragEventArgs", StringComparison.OrdinalIgnoreCase));
}
}
}
@@ -180,20 +290,20 @@ public void DragStartEventCoordinates()
var dragStartRelativeToScreen = GetCoordinatesFromLabel(App.FindElement("DragStartRelativeScreen").GetText());
var dragStartRelativeToLabel = GetCoordinatesFromLabel(App.FindElement("DragStartRelativeLabel").GetText());
- ClassicAssert.NotNull(dragStartRelativeToSelf);
- ClassicAssert.NotNull(dragStartRelativeToScreen);
- ClassicAssert.NotNull(dragStartRelativeToLabel);
+ Assert.That(dragStartRelativeToSelf, Is.Not.Null);
+ Assert.That(dragStartRelativeToScreen, Is.Not.Null);
+ Assert.That(dragStartRelativeToLabel, Is.Not.Null);
- ClassicAssert.True(dragStartRelativeToSelf!.Value.X > 0 && dragStartRelativeToSelf!.Value.Y > 0);
- ClassicAssert.True(dragStartRelativeToScreen!.Value.X > 0 && dragStartRelativeToScreen!.Value.Y > 0);
+ Assert.That(dragStartRelativeToSelf!.Value.X > 0 && dragStartRelativeToSelf!.Value.Y > 0);
+ Assert.That(dragStartRelativeToScreen!.Value.X > 0 && dragStartRelativeToScreen!.Value.Y > 0);
// The position of the drag relative to itself should be less than that relative to the screen
// There are other elements in the screen, plus the ContentView of the test has some margin
- ClassicAssert.True(dragStartRelativeToSelf!.Value.X < dragStartRelativeToScreen!.Value.X);
- ClassicAssert.True(dragStartRelativeToSelf!.Value.Y < dragStartRelativeToScreen!.Value.Y);
+ Assert.That(dragStartRelativeToSelf!.Value.X < dragStartRelativeToScreen!.Value.X);
+ Assert.That(dragStartRelativeToSelf!.Value.Y < dragStartRelativeToScreen!.Value.Y);
// Since the label is below the the box, the Y position of the drag relative to the label should be negative
- ClassicAssert.True(dragStartRelativeToLabel!.Value.Y < 0);
+ Assert.That(dragStartRelativeToLabel!.Value.Y < 0);
}
[Test]
@@ -215,24 +325,24 @@ public void DragEventCoordinates()
var dragRelativeToLabel = GetCoordinatesFromLabel(App.FindElement("DragRelativeLabel").GetText());
var dragStartRelativeToScreen = GetCoordinatesFromLabel(App.FindElement("DragStartRelativeScreen").GetText());
- ClassicAssert.NotNull(dragRelativeToDrop);
- ClassicAssert.NotNull(dragRelativeToScreen);
- ClassicAssert.NotNull(dragRelativeToLabel);
- ClassicAssert.NotNull(dragStartRelativeToScreen);
+ Assert.That(dragRelativeToDrop, Is.Not.Null);
+ Assert.That(dragRelativeToScreen, Is.Not.Null);
+ Assert.That(dragRelativeToLabel, Is.Not.Null);
+ Assert.That(dragStartRelativeToScreen, Is.Not.Null);
- ClassicAssert.True(dragRelativeToDrop!.Value.X > 0 && dragRelativeToDrop!.Value.Y > 0);
- ClassicAssert.True(dragRelativeToScreen!.Value.X > 0 && dragRelativeToScreen!.Value.Y > 0);
+ Assert.That(dragRelativeToDrop!.Value.X > 0 && dragRelativeToDrop!.Value.Y > 0);
+ Assert.That(dragRelativeToScreen!.Value.X > 0 && dragRelativeToScreen!.Value.Y > 0);
// The position of the drag relative to the drop location should be less than that relative to the screen
// There are other elements in the screen, plus the ContentView of the test has some margin
- ClassicAssert.True(dragRelativeToDrop!.Value.X < dragRelativeToScreen!.Value.X);
- ClassicAssert.True(dragRelativeToDrop!.Value.Y < dragRelativeToScreen!.Value.Y);
+ Assert.That(dragRelativeToDrop!.Value.X < dragRelativeToScreen!.Value.X);
+ Assert.That(dragRelativeToDrop!.Value.Y < dragRelativeToScreen!.Value.Y);
// Since the label is below the the box, the Y position of the drag relative to the label should be negative
- ClassicAssert.True(dragRelativeToLabel!.Value.Y < 0);
+ Assert.That(dragRelativeToLabel!.Value.Y < 0);
// The drag is executed left to right, so the X value should be higher than where it started
- ClassicAssert.True(dragRelativeToScreen!.Value.X > dragStartRelativeToScreen!.Value.X);
+ Assert.That(dragRelativeToScreen!.Value.X > dragStartRelativeToScreen!.Value.X);
}
[Test]
@@ -256,30 +366,30 @@ public void DropEventCoordinates()
var dragRelativeToLabel = GetCoordinatesFromLabel(App.FindElement("DragRelativeLabel").GetText());
var dragStartRelativeToScreen = GetCoordinatesFromLabel(App.FindElement("DragStartRelativeScreen").GetText());
- ClassicAssert.NotNull(dropRelativeToLayout);
- ClassicAssert.NotNull(dropRelativeToScreen);
- ClassicAssert.NotNull(dropRelativeToLabel);
+ Assert.That(dropRelativeToLayout, Is.Not.Null);
+ Assert.That(dropRelativeToScreen, Is.Not.Null);
+ Assert.That(dropRelativeToLabel, Is.Not.Null);
- ClassicAssert.NotNull(dragRelativeToLabel);
- ClassicAssert.NotNull(dragStartRelativeToScreen);
+ Assert.That(dragRelativeToLabel, Is.Not.Null);
+ Assert.That(dragStartRelativeToScreen, Is.Not.Null);
- ClassicAssert.True(dropRelativeToLayout!.Value.X > 0 && dropRelativeToLayout!.Value.Y > 0);
- ClassicAssert.True(dropRelativeToScreen!.Value.X > 0 && dropRelativeToScreen!.Value.Y > 0);
+ Assert.That(dropRelativeToLayout!.Value.X > 0 && dropRelativeToLayout!.Value.Y > 0);
+ Assert.That(dropRelativeToScreen!.Value.X > 0 && dropRelativeToScreen!.Value.Y > 0);
// The position of the drop relative the layout should be less than that relative to the screen
// There are other elements in the screen, plus the ContentView of the test has some margin
- ClassicAssert.True(dropRelativeToLayout!.Value.X < dropRelativeToScreen!.Value.X);
- ClassicAssert.True(dropRelativeToLayout!.Value.Y < dropRelativeToScreen!.Value.Y);
+ Assert.That(dropRelativeToLayout!.Value.X < dropRelativeToScreen!.Value.X);
+ Assert.That(dropRelativeToLayout!.Value.Y < dropRelativeToScreen!.Value.Y);
// Since the label is below the the box, the Y position of the drop relative to the label should be negative
- ClassicAssert.True(dropRelativeToLabel!.Value.Y < 0);
+ Assert.That(dropRelativeToLabel!.Value.Y < 0);
// The drop is executed left to right, so the X value should be higher than where it started
- ClassicAssert.True(dropRelativeToScreen!.Value.X > dragStartRelativeToScreen!.Value.X);
+ Assert.That(dropRelativeToScreen!.Value.X > dragStartRelativeToScreen!.Value.X);
// The label receiving the coordinates of the drop is below that which receives the coordinates of the drag
// Therefore, the label that receives the coordinates of the drop should have a smaller Y value (more negative)
- ClassicAssert.True(dropRelativeToLabel!.Value.Y < dragRelativeToLabel!.Value.Y);
+ Assert.That(dropRelativeToLabel!.Value.Y < dragRelativeToLabel!.Value.Y);
}
#endif
@@ -295,6 +405,9 @@ public void DropEventCoordinates()
return null;
var coordinates = labelText[(i + 1)..].Split(",");
+ if (coordinates.Length < 2)
+ return null;
+
var x = int.Parse(coordinates[0]);
var y = int.Parse(coordinates[1]);