-
Notifications
You must be signed in to change notification settings - Fork 690
UI test for #1986 #2088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
UI test for #1986 #2088
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f9c0ed2
add tests for #1986
beto-rodriguez 40fa58b
Update tests/SharedUITests/AvaloniaTests.cs
beto-rodriguez 02e509f
Update tests/SharedUITests/AvaloniaTests.cs
beto-rodriguez 43ee8f8
fix waituntilchartrenders
beto-rodriguez c497d24
use delay instead.
beto-rodriguez e8d5fdf
remove load test
beto-rodriguez 4a82d9e
update TabControlScrollViewerRendersAfterTabSwitch test
beto-rodriguez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
samples/AvaloniaSample/VisualTest/VirtualizationTest/View.axaml
This file contains hidden or 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,44 @@ | ||
| <UserControl | ||
| x:Class="AvaloniaSample.VisualTest.VirtualizationTest.View" | ||
| xmlns="https://github.com/avaloniaui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"> | ||
|
|
||
| <TabControl x:Name="tabs"> | ||
| <TabItem Header="page 1"> | ||
| <ScrollViewer> | ||
| <StackPanel Orientation="Vertical"> | ||
| <Rectangle Height="3000" Width="100" Fill="Red"/> | ||
| <lvc:CartesianChart x:Name="chart1" Height="300"> | ||
| <lvc:CartesianChart.Series> | ||
| <lvc:XamlLineSeries | ||
| SeriesName="Mary" | ||
| Values="{lvc:Values FromString='5, 10, 8, 4'}"/> | ||
| <lvc:XamlColumnSeries | ||
| SeriesName="Ana" | ||
| Values="{lvc:Values FromString='4, 7, 3, 8'}"/> | ||
| </lvc:CartesianChart.Series> | ||
| </lvc:CartesianChart> | ||
| </StackPanel> | ||
| </ScrollViewer> | ||
| </TabItem> | ||
| <TabItem Header="page 2"> | ||
| <ScrollViewer> | ||
| <StackPanel Orientation="Vertical"> | ||
| <Rectangle Height="3000" Width="100" Fill="Red"/> | ||
| <lvc:CartesianChart x:Name="chart2" Height="300"> | ||
| <lvc:CartesianChart.Series> | ||
| <lvc:XamlLineSeries | ||
| SeriesName="Mary" | ||
| Values="{lvc:Values FromString='5, 10, 8, 4'}"/> | ||
| <lvc:XamlColumnSeries | ||
| SeriesName="Ana" | ||
| Values="{lvc:Values FromString='4, 7, 3, 8'}"/> | ||
| </lvc:CartesianChart.Series> | ||
| </lvc:CartesianChart> | ||
| </StackPanel> | ||
| </ScrollViewer> | ||
| </TabItem> | ||
| </TabControl> | ||
|
|
||
| </UserControl> |
24 changes: 24 additions & 0 deletions
24
samples/AvaloniaSample/VisualTest/VirtualizationTest/View.axaml.cs
This file contains hidden or 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,24 @@ | ||
| using Avalonia.Controls; | ||
| using Avalonia.Markup.Xaml; | ||
| using LiveChartsCore.SkiaSharpView.Avalonia; | ||
|
|
||
| namespace AvaloniaSample.VisualTest.VirtualizationTest; | ||
|
|
||
| public partial class View : UserControl | ||
| { | ||
| public View() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| public CartesianChart Chart1 => this.Find<CartesianChart>("chart1")!; | ||
| public CartesianChart Chart2 => this.Find<CartesianChart>("chart2")!; | ||
| public void OpenTab1() => this.Find<TabControl>("tabs")!.SelectedIndex = 0; | ||
| public void OpenTab2() => this.Find<TabControl>("tabs")!.SelectedIndex = 1; | ||
| public void ScrollToChart() => ((ScrollViewer)this.Find<TabControl>("tabs")!.SelectedContent!).ScrollToEnd(); | ||
|
|
||
| private void InitializeComponent() | ||
| { | ||
| AvaloniaXamlLoader.Load(this); | ||
| } | ||
| } |
This file contains hidden or 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,37 @@ | ||
| #if AVALONIA_UI_TESTING | ||
|
|
||
| using Factos; | ||
| using SharedUITests.Helpers; | ||
| using Xunit; | ||
|
|
||
| namespace SharedUITests; | ||
|
|
||
| public class AvaloniaTests | ||
| { | ||
| public AppController App => AppController.Current; | ||
|
|
||
| // based on: | ||
| // https://github.com/Live-Charts/LiveCharts2/issues/1986 | ||
| // ensure charts load when avalonia virtualization is on. | ||
| [AppTestMethod] | ||
| public async Task TabControlScrollViewerRendersAfterTabSwitch() | ||
| { | ||
| var sut = await App.NavigateTo<Samples.VisualTest.VirtualizationTest.View>(); | ||
|
|
||
| // open the second tab, scroll to end and ensure the chart is loaded. | ||
| sut.OpenTab2(); | ||
| await Task.Delay(1000); | ||
| sut.ScrollToChart(); | ||
| await Task.Delay(1000); | ||
| Assert.ChartIsLoaded(sut.Chart2); | ||
|
|
||
| // now open the first tab, scroll to end and ensure the chart is loaded. | ||
| sut.OpenTab1(); | ||
| await Task.Delay(1000); | ||
| sut.ScrollToChart(); | ||
| await Task.Delay(1000); | ||
| Assert.ChartIsLoaded(sut.Chart1); | ||
|
beto-rodriguez marked this conversation as resolved.
beto-rodriguez marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
| #endif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.