-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8232 from AvaloniaUI/feature/window-integration-t…
…ests Feature/window integration tests
- Loading branch information
Showing
18 changed files
with
659 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Window xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="IntegrationTestApp.ShowWindowTest" | ||
Name="SecondaryWindow" | ||
Title="Show Window Test"> | ||
<Grid ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto"> | ||
<Label Grid.Column="0" Grid.Row="1">Client Size</Label> | ||
<TextBox Name="ClientSize" Grid.Column="1" Grid.Row="1" IsReadOnly="True"/> | ||
|
||
<Label Grid.Column="0" Grid.Row="2">Frame Size</Label> | ||
<TextBox Name="FrameSize" Grid.Column="1" Grid.Row="2" IsReadOnly="True"/> | ||
|
||
<Label Grid.Column="0" Grid.Row="3">Position</Label> | ||
<TextBox Name="Position" Grid.Column="1" Grid.Row="3" IsReadOnly="True"/> | ||
|
||
<Label Grid.Column="0" Grid.Row="4">Owner Rect</Label> | ||
<TextBox Name="OwnerRect" Grid.Column="1" Grid.Row="4" IsReadOnly="True"/> | ||
|
||
<Label Grid.Column="0" Grid.Row="5">Screen Rect</Label> | ||
<TextBox Name="ScreenRect" Grid.Column="1" Grid.Row="5" IsReadOnly="True"/> | ||
|
||
<Label Grid.Column="0" Grid.Row="6">Scaling</Label> | ||
<TextBox Name="Scaling" Grid.Column="1" Grid.Row="6" IsReadOnly="True"/> | ||
</Grid> | ||
</Window> |
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,38 @@ | ||
using System; | ||
using Avalonia.Controls; | ||
using Avalonia.Interactivity; | ||
using Avalonia.Markup.Xaml; | ||
using Avalonia.Rendering; | ||
|
||
namespace IntegrationTestApp | ||
{ | ||
public class ShowWindowTest : Window | ||
{ | ||
public ShowWindowTest() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
protected override void OnOpened(EventArgs e) | ||
{ | ||
base.OnOpened(e); | ||
this.GetControl<TextBox>("ClientSize").Text = $"{Width}, {Height}"; | ||
this.GetControl<TextBox>("FrameSize").Text = $"{FrameSize}"; | ||
this.GetControl<TextBox>("Position").Text = $"{Position}"; | ||
this.GetControl<TextBox>("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; | ||
this.GetControl<TextBox>("Scaling").Text = $"{PlatformImpl?.DesktopScaling}"; | ||
|
||
if (Owner is not null) | ||
{ | ||
var ownerRect = this.GetControl<TextBox>("OwnerRect"); | ||
var owner = (Window)Owner; | ||
ownerRect.Text = $"{owner.Position}, {owner.FrameSize}"; | ||
} | ||
} | ||
} | ||
} |
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.