Skip to content

Commit

Permalink
Dialog template back.
Browse files Browse the repository at this point in the history
Added test to check dialog title is shown
  • Loading branch information
jinek committed Dec 8, 2024
1 parent 62b0f1b commit 0738aea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Title="Dialog"
x:Class="Consolonia.Gallery.Gallery.GalleryViews.SomeDialogWindow">
<Panel>
<TextBlock xml:space="preserve"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ namespace Consolonia.Gallery.Gallery.GalleryViews
{
public partial class SomeDialogWindow : DialogWindow
{
internal const string DialogTitle = "Dialog popup";

private static readonly Random Random = new();

public SomeDialogWindow(double width, double height)
{
InitializeComponent();
Title = DialogTitle;
Width = width;
Height = height;

Expand Down
2 changes: 1 addition & 1 deletion src/Consolonia.Themes/Templates/Controls/AllControls.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<MergeResourceInclude Source="/Templates/Controls/ContentControl.axaml" />
<MergeResourceInclude Source="/Templates/Controls/DataGrid.axaml" />
<MergeResourceInclude Source="/Templates/Controls/CaretControl.axaml" />
<MergeResourceInclude Source="/Templates/Controls/DialogWindow.axaml" />
<MergeResourceInclude Source="/Templates/Controls/ItemsControl.axaml" />
<MergeResourceInclude Source="/Templates/Controls/LightDismissOverlaylayer.axaml" />
<MergeResourceInclude Source="/Templates/Controls/DataValidationErrors.axaml" />
Expand All @@ -44,4 +43,5 @@
</Styles.Resources>

<StyleInclude Source="/Templates/Controls/UserControl.axaml" />
<StyleInclude Source="/Templates/Controls/DialogWindow.axaml" />
</Styles>
22 changes: 11 additions & 11 deletions src/Consolonia.Themes/Templates/Controls/DialogWindow.axaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core"
xmlns:helpers="clr-namespace:Consolonia.Themes.Templates.Controls.Helpers"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core">
<Thickness x:Key="ConsoloniaDialogWindowBorderMargin">1,0</Thickness>

<ControlTheme x:Key="{x:Type controls:DialogWindow}"
TargetType="controls:DialogWindow">
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core"
xmlns:helpers="clr-namespace:Consolonia.Themes.Templates.Controls.Helpers"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core">
<Styles.Resources>
<Thickness x:Key="ConsoloniaDialogWindowBorderMargin">1,0</Thickness>
</Styles.Resources>
<Style Selector=":is(controls|DialogWindow)">
<Setter Property="Background"
Value="{DynamicResource ThemeAlternativeBackgroundBrush}" />
<Setter Property="BorderBrush"
Expand Down Expand Up @@ -103,5 +103,5 @@
</ControlTemplate>
</Setter.Value>
</Setter>
</ControlTheme>
</ResourceDictionary>
</Style>
</Styles>
2 changes: 2 additions & 0 deletions src/Tests/Consolonia.Gallery.Tests/DialogTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using Avalonia.Input;
using Consolonia.Gallery.Gallery.GalleryViews;
using Consolonia.Gallery.Tests.Base;
using Consolonia.NUnit;
using NUnit.Framework;
Expand All @@ -16,6 +17,7 @@ public async Task PerformSingleTest()
await UITest.KeyInput(Key.Enter);
await UITest.KeyInput(Key.Tab);
await UITest.AssertHasText("One More");
await UITest.AssertHasText(SomeDialogWindow.DialogTitle);
await UITest.KeyInput(Key.Escape);
await UITest.AssertHasNoText("One More");
}
Expand Down

0 comments on commit 0738aea

Please sign in to comment.