All checks were successful
CI / Build (Linux) (push) Successful in 18s
Add comprehensive test coverage for 20+ Skia controls including ActivityIndicator, Border, CheckBox, CollectionView, DatePicker, Editor, Grid, Image, ImageButton, Label, NavigationPage, Page, Picker, ProgressBar, RadioButton, SearchBar, Stepper, Switch, and TimePicker. Include tests for TextRenderingHelper utility methods covering color conversion, font style mapping, and font family resolution.
69 lines
1.7 KiB
C#
69 lines
1.7 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
using FluentAssertions;
|
|
using Microsoft.Maui.Graphics;
|
|
using Microsoft.Maui.Platform;
|
|
using SkiaSharp;
|
|
using Xunit;
|
|
|
|
namespace Microsoft.Maui.Controls.Linux.Tests.Views;
|
|
|
|
public class SkiaNavigationPageTests
|
|
{
|
|
[Fact]
|
|
public void Constructor_SetsDefaultValues()
|
|
{
|
|
// Arrange & Act
|
|
var navPage = new SkiaNavigationPage();
|
|
|
|
// Assert
|
|
navPage.CurrentPage.Should().BeNull();
|
|
navPage.IsVisible.Should().BeTrue();
|
|
navPage.IsEnabled.Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void BarBackgroundColor_WhenSet_UpdatesProperty()
|
|
{
|
|
// Arrange
|
|
var navPage = new SkiaNavigationPage();
|
|
var color = Microsoft.Maui.Graphics.Colors.DarkBlue;
|
|
|
|
// Act
|
|
navPage.BarBackgroundColor = color;
|
|
|
|
// Assert
|
|
navPage.BarBackgroundColor.Should().Be(color);
|
|
}
|
|
|
|
[Fact]
|
|
public void BarTextColor_WhenSet_UpdatesProperty()
|
|
{
|
|
// Arrange
|
|
var navPage = new SkiaNavigationPage();
|
|
var color = Microsoft.Maui.Graphics.Colors.Yellow;
|
|
|
|
// Act
|
|
navPage.BarTextColor = color;
|
|
|
|
// Assert
|
|
navPage.BarTextColor.Should().Be(color);
|
|
}
|
|
|
|
[Fact]
|
|
public void Draw_DoesNotThrow()
|
|
{
|
|
// Arrange
|
|
var navPage = new SkiaNavigationPage();
|
|
navPage.Bounds = new Rect(0, 0, 400, 600);
|
|
|
|
using var surface = SKSurface.Create(new SKImageInfo(400, 600));
|
|
var canvas = surface.Canvas;
|
|
|
|
// Act & Assert
|
|
var exception = Record.Exception(() => navPage.Draw(canvas));
|
|
exception.Should().BeNull();
|
|
}
|
|
}
|