Skip to content
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

Added Label control functionality tests #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Win11ThemeSampleApp/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
Title="MainWindow" Height="450" Width="800">
<Grid>
<StackPanel Orientation="Vertical">
<Label Content="Demo label" Height="30" Width="100" IsEnabled="False" >
<Label.ToolTip>
<ToolTip>
<TextBlock>
Demo help text
</TextBlock>
</ToolTip>
</Label.ToolTip>
</Label>

<Button Content="Click Me" Appearance="Light"/>
<CheckBox Content="Test Checkbox"/>
<RadioButton>Hello World</RadioButton>
Expand Down
32 changes: 32 additions & 0 deletions Win11ThemeTest/LabelTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using FlaUI.Core;
using FlaUI.Core.AutomationElements;
using FlaUI.Core.Definitions;
using FlaUI.UIA3;

namespace Win11ThemeTest
{
public class LabelTest
{
[SetUp]
public void Setup()
{
}

[Test]
public void LabelControlTest()
{
var app = FlaUI.Core.Application.Launch(@"..\\..\\..\\..\\Win11ThemeSampleApp\\bin\\x64\\Debug\\net9.0-windows\\win-x64\\Win11ThemeSampleApp.exe");
using (var automation = new UIA3Automation())
{
var window = app.GetMainWindow(automation);
var label = window.FindFirstDescendant(cf => cf.ByName("Demo label")).AsLabel();

Assert.That(label.ActualHeight, Is.EqualTo(30));
Assert.That(label.ActualWidth, Is.EqualTo(100));
Assert.That(label.Text, Is.EqualTo("Demo label"));
Assert.False(label.IsEnabled);
Assert.That(label.HelpText, Is.EqualTo("Demo help text"));
}
}
}
}