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.
- Loading branch information
Showing
12 changed files
with
269 additions
and
35 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue3000.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,125 @@ | ||
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 | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 3000, "Horizontal ScrollView breaks scrolling when flowdirection is set to rtl")] | ||
#if UITEST | ||
[NUnit.Framework.Category(UITestCategories.ScrollView)] | ||
#endif | ||
public class Issue3000 : TestContentPage | ||
{ | ||
const string kSuccess = "Success"; | ||
|
||
protected override void Init() | ||
{ | ||
ScrollView view = new ScrollView(); | ||
StackLayout parent = new StackLayout(); | ||
Label instructions = new Label() { Text = "Scroll X should not be zero Scroll Y should be zero" }; | ||
Label scrollPositions = new Label(); | ||
Label outcome = new Label(); | ||
|
||
parent.Children.Add(instructions); | ||
parent.Children.Add(scrollPositions); | ||
parent.Children.Add(outcome); | ||
|
||
view.Scrolled += (_, __) => | ||
{ | ||
if (outcome.Text == kSuccess) | ||
{ | ||
return; | ||
} | ||
scrollPositions.Text = $"ScrollX: {view.ScrollX} ScrollY: {view.ScrollY}"; | ||
if (view.ScrollY == 0 && view.ScrollX > 0) | ||
{ | ||
outcome.Text = kSuccess; | ||
} | ||
else | ||
{ | ||
outcome.Text = "Fail"; | ||
} | ||
}; | ||
|
||
view.Orientation = ScrollOrientation.Both; | ||
|
||
StackLayout layout = new StackLayout(); | ||
layout.Orientation = StackOrientation.Horizontal; | ||
layout.Children.Add(new Label() { Text = "LEFT" }); | ||
for (int i = 0; i < 80; i++) | ||
layout.Children.Add(new Image() { BackgroundColor = Color.Pink, Source = "coffee.png" }); | ||
layout.Children.Add(new Label() { Text = "RIGHT" }); | ||
|
||
|
||
|
||
StackLayout layoutDown = new StackLayout(); | ||
for (int i = 0; i < 80; i++) | ||
layoutDown.Children.Add(new Image() { BackgroundColor = Color.Pink, Source = "coffee.png" }); | ||
|
||
view.FlowDirection = FlowDirection.RightToLeft; | ||
parent.Children.Insert(0, new Button() | ||
{ | ||
Text = "click me please", | ||
Command = new Command(() => | ||
{ | ||
if (view.FlowDirection == FlowDirection.LeftToRight) | ||
{ | ||
view.FlowDirection = FlowDirection.RightToLeft; | ||
} | ||
else | ||
{ | ||
view.FlowDirection = FlowDirection.LeftToRight; | ||
} | ||
}) | ||
}); | ||
|
||
parent.Children.Insert(0, new Button() | ||
{ | ||
Text = "reset this view", | ||
Command = new Command(() => | ||
{ | ||
Application.Current.MainPage = new Issue3000(); | ||
}) | ||
}); | ||
|
||
parent.Children.Insert(0, new Label() | ||
{ | ||
Text = "right to left text", | ||
}); | ||
|
||
parent.Children.Insert(0, new Label() | ||
{ | ||
Text = "left to right text" | ||
}); | ||
|
||
view.Content = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
layout, layoutDown | ||
} | ||
}; | ||
|
||
parent.Children.Add(view); | ||
Content = parent; | ||
} | ||
|
||
|
||
#if UITEST | ||
[Test] | ||
public void RtlScrollViewStartsScrollToRight() | ||
{ | ||
RunningApp.WaitForElement(kSuccess); | ||
} | ||
#endif | ||
|
||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.