Skip to content

Commit 635700f

Browse files
committed
Init
1 parent edeba89 commit 635700f

File tree

9 files changed

+101
-118
lines changed

9 files changed

+101
-118
lines changed

src/Files.App.Controls/BladeView/BladeView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@
125125
FontSize="14"
126126
Foreground="{TemplateBinding CloseButtonForeground}"
127127
Style="{StaticResource ButtonRevealStyle}"
128-
Visibility="{TemplateBinding CloseButtonVisibility}"
129-
TabIndex="0" />
128+
TabIndex="0"
129+
Visibility="{TemplateBinding CloseButtonVisibility}" />
130130
</Grid>
131131
</ControlTemplate>
132132
</Setter.Value>

tests/Files.App.UITests/Files.App.UITests.csproj

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19+
<Manifest Include="$(ApplicationManifest)" />
1920
<Content Include="Assets\*.png" />
2021
</ItemGroup>
2122

2223
<ItemGroup>
2324
<ProjectReference Include="..\..\src\Files.App.Controls\Files.App.Controls.csproj" />
24-
</ItemGroup>
25-
26-
<ItemGroup>
2725
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
2826
<PackageReference Include="Microsoft.WindowsAppSDK" />
29-
<Manifest Include="$(ApplicationManifest)" />
3027
</ItemGroup>
3128

3229
<!-- Allows the Single-project MSIX Packaging Tools extension to be activated for this project even if the Windows App SDK Nuget package has not yet been restored. -->
@@ -37,13 +34,5 @@
3734
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
3835
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
3936
</PropertyGroup>
40-
<ItemGroup>
41-
<None Remove="Views\ToolbarPage.xaml" />
42-
</ItemGroup>
43-
<ItemGroup>
44-
<Page Update="Views\ToolbarPage.xaml">
45-
<Generator>MSBuild:Compile</Generator>
46-
</Page>
47-
</ItemGroup>
4837

4938
</Project>

tests/Files.App.UITests/MainWindow.xaml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
Grid.Row="0"
2727
HorizontalAlignment="Stretch">
2828
<Grid.ColumnDefinitions>
29-
<ColumnDefinition x:Name="TitleIcon" Width="48" />
30-
<ColumnDefinition x:Name="TitleText" Width="Auto" />
29+
<ColumnDefinition x:Name="TitleIconArea" Width="48" />
30+
<ColumnDefinition x:Name="TitleTextArea" Width="Auto" />
3131
<ColumnDefinition Width="*" />
32+
<ColumnDefinition x:Name="AppThemeChangeToggleButtonArea" Width="Auto" />
33+
<ColumnDefinition x:Name="ReservedCaptionButtonsArea" Width="160" />
3234
</Grid.ColumnDefinitions>
3335

3436
<controls:ThemedIcon
@@ -57,6 +59,18 @@
5759
Style="{ThemeResource CaptionTextBlockStyle}"
5860
Text="Files UI Tests" />
5961

62+
<!-- IsChecked: true for light, false for dark. -->
63+
<ToggleButton
64+
x:Name="AppThemeChangeToggleButton"
65+
Grid.Column="3"
66+
Height="32"
67+
Click="AppThemeChangeToggleButton_Click">
68+
<FontIcon
69+
x:Name="AppThemeGlyph"
70+
FontSize="14"
71+
Glyph="&#xE708;" />
72+
</ToggleButton>
73+
6074
</Grid>
6175

6276
<NavigationView
@@ -76,6 +90,7 @@
7690
<NavigationViewItem Content="ThemedIcon" Tag="ThemedIconPage" />
7791
<NavigationViewItem Content="Toolbar" Tag="ToolbarPage" />
7892
<NavigationViewItem Content="Storage Controls" Tag="StorageControlsPage" />
93+
<NavigationViewItem Content="Omnibar" Tag="OmnibarPage" />
7994
</NavigationViewItem.MenuItems>
8095
</NavigationViewItem>
8196
</NavigationView.MenuItems>
@@ -86,28 +101,6 @@
86101
</ScrollViewer>
87102
</NavigationView.Content>
88103

89-
<NavigationView.PaneFooter>
90-
<Grid
91-
Margin="8,2"
92-
Padding="12,8"
93-
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
94-
CornerRadius="4"
95-
Visibility="{Binding MainNavigationView.IsPaneOpen, Mode=OneWay}">
96-
<TextBlock VerticalAlignment="Center" Text="Theme mode:" />
97-
<ComboBox
98-
x:Name="ThemeModeSelectorCombBox"
99-
HorizontalAlignment="Right"
100-
SelectedIndex="0"
101-
SelectionChanged="ThemeModeSelectorCombBox_SelectionChanged">
102-
<ComboBox.Items>
103-
<ComboBoxItem Content="Default" />
104-
<ComboBoxItem Content="Light" />
105-
<ComboBoxItem Content="Dark" />
106-
</ComboBox.Items>
107-
</ComboBox>
108-
</Grid>
109-
</NavigationView.PaneFooter>
110-
111104
</NavigationView>
112105
</Grid>
113106

tests/Files.App.UITests/MainWindow.xaml.cs

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using Files.App.UITests.Views;
55
using Microsoft.UI.Xaml;
66
using Microsoft.UI.Xaml.Controls;
7+
using Microsoft.UI.Xaml.Controls.Primitives;
8+
using System;
79

810
namespace Files.App.UITests
911
{
@@ -17,46 +19,55 @@ private MainWindow()
1719
InitializeComponent();
1820

1921
ExtendsContentIntoTitleBar = true;
20-
2122
MainFrame.Navigate(typeof(MainPage));
23+
24+
// Set the toggle state for theme change button
25+
if (Content is FrameworkElement element)
26+
{
27+
if (element.ActualTheme is ElementTheme.Light)
28+
{
29+
AppThemeChangeToggleButton.IsChecked = true;
30+
AppThemeGlyph.Glyph = "\uE706"; // Sun
31+
}
32+
else
33+
{
34+
AppThemeChangeToggleButton.IsChecked = false;
35+
AppThemeGlyph.Glyph = "\uE708"; // Moon
36+
}
37+
}
2238
}
2339

2440
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
2541
{
2642
if (args.SelectedItem is not NavigationViewItem item || item.Tag is not string tag)
2743
return;
2844

29-
switch (tag)
30-
{
31-
case "ThemedIconPage":
32-
MainFrame.Navigate(typeof(ThemedIconPage));
33-
break;
34-
case "ToolbarPage":
35-
MainFrame.Navigate(typeof(ToolbarPage));
36-
break;
37-
case "StorageControlsPage":
38-
MainFrame.Navigate(typeof(StorageControlsPage));
39-
break;
40-
}
45+
MainFrame.Navigate(
46+
tag switch
47+
{
48+
nameof(ThemedIconPage) => typeof(ThemedIconPage),
49+
nameof(ToolbarPage) => typeof(ToolbarPage),
50+
nameof(StorageControlsPage) => typeof(StorageControlsPage),
51+
nameof(OmnibarPage) => typeof(OmnibarPage),
52+
_ => throw new InvalidOperationException("There's no applicable page associated with the given key."),
53+
});
4154
}
4255

43-
private void ThemeModeSelectorCombBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
56+
private void AppThemeChangeToggleButton_Click(object sender, RoutedEventArgs e)
4457
{
45-
if (sender is not ComboBox comboBox ||
58+
if (sender is not ToggleButton toggleButton ||
4659
Content is not FrameworkElement element)
4760
return;
4861

49-
switch (comboBox.SelectedIndex)
62+
if (toggleButton.IsChecked is true)
63+
{
64+
element.RequestedTheme = ElementTheme.Light;
65+
AppThemeGlyph.Glyph = "\uE706"; // Sun
66+
}
67+
else
5068
{
51-
case 0:
52-
element.RequestedTheme = ElementTheme.Default;
53-
break;
54-
case 1:
55-
element.RequestedTheme = ElementTheme.Light;
56-
break;
57-
case 2:
58-
element.RequestedTheme = ElementTheme.Dark;
59-
break;
69+
element.RequestedTheme = ElementTheme.Dark;
70+
AppThemeGlyph.Glyph = "\uE708"; // Moon
6071
}
6172
}
6273
}

tests/Files.App.UITests/Views/MainPage.xaml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,13 @@
99
mc:Ignorable="d">
1010

1111
<Grid>
12-
<Grid.RowDefinitions>
13-
<RowDefinition Height="Auto" />
14-
<RowDefinition Height="*" />
15-
</Grid.RowDefinitions>
1612

1713
<TextBlock
1814
Grid.Row="0"
1915
Margin="24"
2016
HorizontalAlignment="Center"
2117
VerticalAlignment="Center"
22-
Text="All Samples here to test UI accessibility." />
23-
24-
<GridView
25-
Grid.Row="1"
26-
HorizontalAlignment="Center"
27-
VerticalAlignment="Center">
28-
<GridViewItem Margin="12">
29-
<Button Padding="24">
30-
<Button.Content>
31-
<StackPanel Orientation="Vertical" Spacing="12">
32-
<FontIcon Glyph="&#xE76E;" />
33-
<TextBlock Text="ThemedIcon" />
34-
</StackPanel>
35-
</Button.Content>
36-
</Button>
37-
</GridViewItem>
38-
39-
<GridViewItem Margin="12">
40-
<Button Padding="24">
41-
<Button.Content>
42-
<StackPanel Orientation="Vertical" Spacing="12">
43-
<FontIcon Glyph="&#xF16A;" />
44-
<TextBlock Text="Storage Controls" />
45-
</StackPanel>
46-
</Button.Content>
47-
</Button>
48-
</GridViewItem>
49-
</GridView>
18+
Text="All Samples here to test UI accessibility.&#10;Select a page from the sidebar to test it." />
5019

5120
</Grid>
5221
</Page>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!-- Copyright (c) Files Community. Licensed under the MIT License. -->
2+
<Page
3+
x:Class="Files.App.UITests.Views.OmnibarPage"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="using:Files.App.UITests.Views"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
mc:Ignorable="d">
10+
11+
<Grid Padding="36" RowSpacing="24">
12+
<Grid.RowDefinitions>
13+
<RowDefinition Height="Auto" />
14+
<RowDefinition Height="*" />
15+
</Grid.RowDefinitions>
16+
17+
<StackPanel Spacing="8">
18+
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="Omnibar" />
19+
<TextBlock
20+
Foreground="{ThemeResource TextFillColorTertiaryBrush}"
21+
Style="{StaticResource CaptionTextBlockStyle}"
22+
Text="Files.App.Controls" />
23+
</StackPanel>
24+
25+
</Grid>
26+
</Page>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Files Community
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.UI.Xaml;
5+
using Microsoft.UI.Xaml.Controls;
6+
7+
namespace Files.App.UITests.Views
8+
{
9+
public sealed partial class OmnibarPage : Page
10+
{
11+
public OmnibarPage()
12+
{
13+
InitializeComponent();
14+
}
15+
}
16+
}

tests/Files.App.UITests/Views/ToolbarPage.xaml.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,14 @@
33

44
using Microsoft.UI.Xaml;
55
using Microsoft.UI.Xaml.Controls;
6-
using Microsoft.UI.Xaml.Controls.Primitives;
7-
using Microsoft.UI.Xaml.Data;
8-
using Microsoft.UI.Xaml.Input;
9-
using Microsoft.UI.Xaml.Media;
10-
using Microsoft.UI.Xaml.Navigation;
11-
using System;
12-
using System.Collections.Generic;
13-
using System.IO;
14-
using System.Linq;
15-
using System.Runtime.InteropServices.WindowsRuntime;
16-
using Windows.Foundation;
17-
using Windows.Foundation.Collections;
18-
196

207
namespace Files.App.UITests.Views
218
{
22-
/// <summary>
23-
/// An empty page that can be used on its own or navigated to within a Frame.
24-
/// </summary>
259
public sealed partial class ToolbarPage : Page
2610
{
2711
public ToolbarPage()
2812
{
29-
this.InitializeComponent();
13+
InitializeComponent();
3014
}
3115
}
3216
}

tests/Files.App.UITests/app.manifest

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55

66
<application xmlns="urn:schemas-microsoft-com:asm.v3">
77
<windowsSettings>
8-
<!--
9-
The combination of below two tags have the following effect:
10-
1) Per-Monitor for >= Windows 10 Anniversary Update
11-
2) System < Windows 10 Anniversary Update
12-
-->
138
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
149
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
1510
</windowsSettings>
1611
</application>
1712

18-
</assembly>
13+
</assembly>

0 commit comments

Comments
 (0)