|
|
|
@ -16,6 +16,8 @@ namespace Avalonia.Benchmarks.Themes |
|
|
|
public class ThemeBenchmark : IDisposable |
|
|
|
{ |
|
|
|
private IDisposable _app; |
|
|
|
private readonly FluentTheme _reusableFluentTheme = new FluentTheme(); |
|
|
|
private readonly SimpleTheme _reusableSimpleTheme = new SimpleTheme(); |
|
|
|
|
|
|
|
public ThemeBenchmark() |
|
|
|
{ |
|
|
|
@ -49,6 +51,26 @@ namespace Avalonia.Benchmarks.Themes |
|
|
|
}; |
|
|
|
return ((IResourceHost)UnitTestApplication.Current).TryGetResource("ThemeAccentColor", out _); |
|
|
|
} |
|
|
|
|
|
|
|
[Benchmark] |
|
|
|
[Arguments(typeof(Button))] |
|
|
|
[Arguments(typeof(TextBox))] |
|
|
|
[Arguments(typeof(DatePicker))] |
|
|
|
public object FindFluentControlTheme(Type type) |
|
|
|
{ |
|
|
|
_reusableFluentTheme.TryGetResource(type, out var theme); |
|
|
|
return theme; |
|
|
|
} |
|
|
|
|
|
|
|
[Benchmark] |
|
|
|
[Arguments(typeof(Button))] |
|
|
|
[Arguments(typeof(TextBox))] |
|
|
|
[Arguments(typeof(DatePicker))] |
|
|
|
public object FindSimpleControlTheme(Type type) |
|
|
|
{ |
|
|
|
_reusableSimpleTheme.TryGetResource(type, out var theme); |
|
|
|
return theme; |
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
|