Browse Source

Fix benchmarks build

pull/8166/head
Max Katz 3 years ago
parent
commit
a0d22499cd
  1. 2
      src/Avalonia.Base/Controls/ResourceDictionary.cs
  2. 22
      tests/Avalonia.Benchmarks/Themes/ThemeBenchmark.cs

2
src/Avalonia.Base/Controls/ResourceDictionary.cs

@ -192,7 +192,7 @@ namespace Avalonia.Controls
if (_themeDictionary is not null)
{
IResourceProvider? themeResourceProvider;
if (theme is not null)
if (theme is not null && theme != ThemeVariant.Default)
{
if (_themeDictionary.TryGetValue(theme, out themeResourceProvider)
&& themeResourceProvider.TryGetResource(key, theme, out value))

22
tests/Avalonia.Benchmarks/Themes/ThemeBenchmark.cs

@ -29,26 +29,16 @@ namespace Avalonia.Benchmarks.Themes
}
[Benchmark]
[Arguments(FluentThemeMode.Dark)]
[Arguments(FluentThemeMode.Light)]
public bool InitFluentTheme(FluentThemeMode mode)
public bool InitFluentTheme()
{
UnitTestApplication.Current.Styles[0] = new FluentTheme()
{
Mode = mode
};
UnitTestApplication.Current.Styles[0] = new FluentTheme();
return ((IResourceHost)UnitTestApplication.Current).TryGetResource("SystemAccentColor", out _);
}
[Benchmark]
[Arguments(SimpleThemeMode.Dark)]
[Arguments(SimpleThemeMode.Light)]
public bool InitSimpleTheme(SimpleThemeMode mode)
public bool InitSimpleTheme()
{
UnitTestApplication.Current.Styles[0] = new SimpleTheme()
{
Mode = mode
};
UnitTestApplication.Current.Styles[0] = new SimpleTheme();
return ((IResourceHost)UnitTestApplication.Current).TryGetResource("ThemeAccentColor", out _);
}
@ -58,7 +48,7 @@ namespace Avalonia.Benchmarks.Themes
[Arguments(typeof(DatePicker))]
public object FindFluentControlTheme(Type type)
{
_reusableFluentTheme.TryGetResource(type, out var theme);
_reusableFluentTheme.TryGetResource(type, ThemeVariant.Default, out var theme);
return theme;
}
@ -68,7 +58,7 @@ namespace Avalonia.Benchmarks.Themes
[Arguments(typeof(DatePicker))]
public object FindSimpleControlTheme(Type type)
{
_reusableSimpleTheme.TryGetResource(type, out var theme);
_reusableSimpleTheme.TryGetResource(type, ThemeVariant.Default, out var theme);
return theme;
}

Loading…
Cancel
Save