More fixes
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Moq" Version="4.20.70" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.116.1" />
|
||||
<!-- Match main project SkiaSharp version for native library compatibility -->
|
||||
<PackageReference Include="SkiaSharp" Version="2.88.9" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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;
|
||||
@@ -42,7 +43,7 @@ public class SkiaButtonTests
|
||||
var button = new SkiaButton { Text = "Test" };
|
||||
|
||||
// Act
|
||||
var size = button.Measure(new SKSize(1000, 1000));
|
||||
var size = button.Measure(new Size(1000, 1000));
|
||||
|
||||
// Assert
|
||||
size.Width.Should().BeGreaterThan(0);
|
||||
@@ -61,7 +62,7 @@ public class SkiaButtonTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var size = button.Measure(new SKSize(1000, 1000));
|
||||
var size = button.Measure(new Size(1000, 1000));
|
||||
|
||||
// Assert - Measure returns content-based size
|
||||
size.Width.Should().BeGreaterThan(0);
|
||||
@@ -100,7 +101,7 @@ public class SkiaButtonTests
|
||||
{
|
||||
// Arrange
|
||||
var button = new SkiaButton { Text = "Test" };
|
||||
button.Bounds = new SKRect(0, 0, 100, 40);
|
||||
button.Bounds = new Rect(0, 0, 100, 40);
|
||||
|
||||
using var surface = SKSurface.Create(new SKImageInfo(200, 100));
|
||||
var canvas = surface.Canvas;
|
||||
@@ -129,7 +130,7 @@ public class SkiaButtonTests
|
||||
{
|
||||
// Arrange
|
||||
var button = new SkiaButton();
|
||||
var color = new SKColor(0, 255, 0);
|
||||
var color = Microsoft.Maui.Graphics.Color.FromRgb(0, 255, 0);
|
||||
|
||||
// Act
|
||||
button.BackgroundColor = color;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
using Xunit;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class SkiaCarouselViewTests
|
||||
|
||||
Assert.Equal(0, carousel.Position);
|
||||
Assert.False(carousel.Loop);
|
||||
Assert.Equal(0f, carousel.PeekAreaInsets);
|
||||
Assert.Equal(0.0, carousel.PeekAreaInsets);
|
||||
Assert.Equal(0, carousel.ItemCount);
|
||||
}
|
||||
|
||||
@@ -71,9 +72,9 @@ public class SkiaCarouselViewTests
|
||||
{
|
||||
var carousel = new SkiaCarouselView();
|
||||
|
||||
carousel.PeekAreaInsets = 20f;
|
||||
carousel.PeekAreaInsets = 20.0;
|
||||
|
||||
Assert.Equal(20f, carousel.PeekAreaInsets);
|
||||
Assert.Equal(20.0, carousel.PeekAreaInsets);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -180,9 +181,9 @@ public class SkiaCarouselViewTests
|
||||
{
|
||||
var carousel = new SkiaCarouselView();
|
||||
|
||||
carousel.IndicatorColor = SKColors.Gray;
|
||||
carousel.IndicatorColor = Colors.Grey;
|
||||
|
||||
Assert.Equal(SKColors.Gray, carousel.IndicatorColor);
|
||||
Assert.Equal(Colors.Grey, carousel.IndicatorColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -190,9 +191,9 @@ public class SkiaCarouselViewTests
|
||||
{
|
||||
var carousel = new SkiaCarouselView();
|
||||
|
||||
carousel.SelectedIndicatorColor = SKColors.Blue;
|
||||
carousel.SelectedIndicatorColor = Colors.Blue;
|
||||
|
||||
Assert.Equal(SKColors.Blue, carousel.SelectedIndicatorColor);
|
||||
Assert.Equal(Colors.Blue, carousel.SelectedIndicatorColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -213,7 +214,7 @@ public class SkiaCarouselViewTests
|
||||
{
|
||||
var carousel = new SkiaCarouselView();
|
||||
|
||||
Assert.Equal(0f, carousel.ItemSpacing);
|
||||
Assert.Equal(0.0, carousel.ItemSpacing);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -221,9 +222,9 @@ public class SkiaCarouselViewTests
|
||||
{
|
||||
var carousel = new SkiaCarouselView();
|
||||
|
||||
carousel.ItemSpacing = 16f;
|
||||
carousel.ItemSpacing = 16.0;
|
||||
|
||||
Assert.Equal(16f, carousel.ItemSpacing);
|
||||
Assert.Equal(16.0, carousel.ItemSpacing);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -245,7 +246,7 @@ public class SkiaCarouselViewTests
|
||||
{
|
||||
var carousel = new SkiaCarouselView();
|
||||
carousel.AddItem(new SkiaLabel { Text = "Item" });
|
||||
carousel.Arrange(new SKRect(0, 0, 300, 200));
|
||||
carousel.Arrange(new Rect(0, 0, 300, 200));
|
||||
|
||||
var hit = carousel.HitTest(150, 100);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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;
|
||||
@@ -104,7 +105,7 @@ public class SkiaEntryTests
|
||||
{
|
||||
// Arrange
|
||||
var entry = new SkiaEntry { Text = "Hello" };
|
||||
entry.Bounds = new SKRect(0, 0, 200, 40);
|
||||
entry.Bounds = new Rect(0, 0, 200, 40);
|
||||
entry.OnFocusGained();
|
||||
var originalLength = entry.Text.Length;
|
||||
|
||||
@@ -120,7 +121,7 @@ public class SkiaEntryTests
|
||||
{
|
||||
// Arrange
|
||||
var entry = new SkiaEntry { Text = "Hello" };
|
||||
entry.Bounds = new SKRect(0, 0, 200, 40);
|
||||
entry.Bounds = new Rect(0, 0, 200, 40);
|
||||
entry.OnFocusGained();
|
||||
|
||||
// Act - Verify OnKeyDown doesn't throw
|
||||
@@ -136,7 +137,7 @@ public class SkiaEntryTests
|
||||
// Arrange
|
||||
var entry = new SkiaEntry { Text = "Hello", IsReadOnly = true };
|
||||
var originalText = entry.Text;
|
||||
entry.Bounds = new SKRect(0, 0, 200, 40);
|
||||
entry.Bounds = new Rect(0, 0, 200, 40);
|
||||
entry.OnFocusGained();
|
||||
|
||||
// Act
|
||||
@@ -164,7 +165,7 @@ public class SkiaEntryTests
|
||||
{
|
||||
// Arrange
|
||||
var entry = new SkiaEntry { Text = "Test", Placeholder = "Enter..." };
|
||||
entry.Bounds = new SKRect(0, 0, 200, 40);
|
||||
entry.Bounds = new Rect(0, 0, 200, 40);
|
||||
|
||||
using var surface = SKSurface.Create(new SKImageInfo(300, 100));
|
||||
var canvas = surface.Canvas;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
using Xunit;
|
||||
|
||||
@@ -66,9 +67,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.IndicatorColor = SKColors.Gray;
|
||||
indicator.IndicatorColor = Colors.Grey;
|
||||
|
||||
Assert.Equal(SKColors.Gray, indicator.IndicatorColor);
|
||||
Assert.Equal(Colors.Grey, indicator.IndicatorColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -76,9 +77,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.SelectedIndicatorColor = SKColors.Blue;
|
||||
indicator.SelectedIndicatorColor = Colors.Blue;
|
||||
|
||||
Assert.Equal(SKColors.Blue, indicator.SelectedIndicatorColor);
|
||||
Assert.Equal(Colors.Blue, indicator.SelectedIndicatorColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -86,9 +87,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.IndicatorSize = 12f;
|
||||
indicator.IndicatorSize = 12.0;
|
||||
|
||||
Assert.Equal(12f, indicator.IndicatorSize);
|
||||
Assert.Equal(12.0, indicator.IndicatorSize);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -96,9 +97,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.SelectedIndicatorSize = 16f;
|
||||
indicator.SelectedIndicatorSize = 16.0;
|
||||
|
||||
Assert.Equal(16f, indicator.SelectedIndicatorSize);
|
||||
Assert.Equal(16.0, indicator.SelectedIndicatorSize);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -106,9 +107,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.IndicatorSpacing = 10f;
|
||||
indicator.IndicatorSpacing = 10.0;
|
||||
|
||||
Assert.Equal(10f, indicator.IndicatorSpacing);
|
||||
Assert.Equal(10.0, indicator.IndicatorSpacing);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -164,9 +165,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.BorderColor = SKColors.Black;
|
||||
indicator.BorderColor = Colors.Black;
|
||||
|
||||
Assert.Equal(SKColors.Black, indicator.BorderColor);
|
||||
Assert.Equal(Colors.Black, indicator.BorderColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -174,9 +175,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
|
||||
indicator.BorderWidth = 2f;
|
||||
indicator.BorderWidth = 2.0;
|
||||
|
||||
Assert.Equal(2f, indicator.BorderWidth);
|
||||
Assert.Equal(2.0, indicator.BorderWidth);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -232,9 +233,9 @@ public class SkiaIndicatorViewTests
|
||||
{
|
||||
var indicator = new SkiaIndicatorView();
|
||||
indicator.Count = 5;
|
||||
indicator.IndicatorSize = 10f;
|
||||
indicator.IndicatorSpacing = 8f;
|
||||
indicator.Arrange(new SKRect(0, 0, 200, 20));
|
||||
indicator.IndicatorSize = 10.0;
|
||||
indicator.IndicatorSpacing = 8.0;
|
||||
indicator.Arrange(new Rect(0, 0, 200, 20));
|
||||
|
||||
var hit = indicator.HitTest(100, 10);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
using Xunit;
|
||||
|
||||
@@ -145,9 +146,9 @@ public class SkiaMenuBarTests
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
|
||||
menuBar.BackgroundColor = SKColors.White;
|
||||
menuBar.BackgroundColor = Colors.White;
|
||||
|
||||
Assert.Equal(SKColors.White, menuBar.BackgroundColor);
|
||||
Assert.Equal(Colors.White, menuBar.BackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -155,9 +156,9 @@ public class SkiaMenuBarTests
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
|
||||
menuBar.TextColor = SKColors.Black;
|
||||
menuBar.TextColor = Colors.Black;
|
||||
|
||||
Assert.Equal(SKColors.Black, menuBar.TextColor);
|
||||
Assert.Equal(Colors.Black, menuBar.TextColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -165,9 +166,9 @@ public class SkiaMenuBarTests
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
|
||||
menuBar.HoverBackgroundColor = SKColors.LightGray;
|
||||
menuBar.HoverBackgroundColor = Colors.LightGrey;
|
||||
|
||||
Assert.Equal(SKColors.LightGray, menuBar.HoverBackgroundColor);
|
||||
Assert.Equal(Colors.LightGrey, menuBar.HoverBackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -175,9 +176,9 @@ public class SkiaMenuBarTests
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
|
||||
menuBar.ActiveBackgroundColor = SKColors.DarkGray;
|
||||
menuBar.ActiveBackgroundColor = Colors.DarkGrey;
|
||||
|
||||
Assert.Equal(SKColors.DarkGray, menuBar.ActiveBackgroundColor);
|
||||
Assert.Equal(Colors.DarkGrey, menuBar.ActiveBackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -186,7 +187,7 @@ public class SkiaMenuBarTests
|
||||
var menuBar = new SkiaMenuBar();
|
||||
menuBar.BarHeight = 30f;
|
||||
|
||||
var size = menuBar.Measure(new SKSize(800, 600));
|
||||
var size = menuBar.Measure(new Size(800, 600));
|
||||
|
||||
Assert.Equal(30f, size.Height);
|
||||
}
|
||||
@@ -196,7 +197,7 @@ public class SkiaMenuBarTests
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
|
||||
var size = menuBar.Measure(new SKSize(800, 600));
|
||||
var size = menuBar.Measure(new Size(800, 600));
|
||||
|
||||
Assert.Equal(800f, size.Width);
|
||||
}
|
||||
@@ -205,7 +206,7 @@ public class SkiaMenuBarTests
|
||||
public void HitTest_WithinBounds_ReturnsMenuBar()
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
menuBar.Arrange(new SKRect(0, 0, 800, 28));
|
||||
menuBar.Arrange(new Rect(0, 0, 800, 28));
|
||||
|
||||
var hit = menuBar.HitTest(400, 14);
|
||||
|
||||
@@ -216,7 +217,7 @@ public class SkiaMenuBarTests
|
||||
public void HitTest_OutsideBounds_ReturnsNull()
|
||||
{
|
||||
var menuBar = new SkiaMenuBar();
|
||||
menuBar.Arrange(new SKRect(0, 0, 800, 28));
|
||||
menuBar.Arrange(new Rect(0, 0, 800, 28));
|
||||
|
||||
var hit = menuBar.HitTest(400, 50);
|
||||
|
||||
@@ -266,9 +267,9 @@ public class SkiaMenuFlyoutTests
|
||||
{
|
||||
var flyout = new SkiaMenuFlyout();
|
||||
|
||||
flyout.BackgroundColor = SKColors.White;
|
||||
flyout.BackgroundColor = Colors.White;
|
||||
|
||||
Assert.Equal(SKColors.White, flyout.BackgroundColor);
|
||||
Assert.Equal(Colors.White, flyout.BackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -276,9 +277,9 @@ public class SkiaMenuFlyoutTests
|
||||
{
|
||||
var flyout = new SkiaMenuFlyout();
|
||||
|
||||
flyout.TextColor = SKColors.Black;
|
||||
flyout.TextColor = Colors.Black;
|
||||
|
||||
Assert.Equal(SKColors.Black, flyout.TextColor);
|
||||
Assert.Equal(Colors.Black, flyout.TextColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -286,9 +287,9 @@ public class SkiaMenuFlyoutTests
|
||||
{
|
||||
var flyout = new SkiaMenuFlyout();
|
||||
|
||||
flyout.DisabledTextColor = new SKColor(160, 160, 160);
|
||||
flyout.DisabledTextColor = Color.FromRgb(160, 160, 160);
|
||||
|
||||
Assert.Equal(new SKColor(160, 160, 160), flyout.DisabledTextColor);
|
||||
Assert.Equal(Color.FromRgb(160, 160, 160), flyout.DisabledTextColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -296,9 +297,9 @@ public class SkiaMenuFlyoutTests
|
||||
{
|
||||
var flyout = new SkiaMenuFlyout();
|
||||
|
||||
flyout.HoverBackgroundColor = SKColors.LightBlue;
|
||||
flyout.HoverBackgroundColor = Colors.LightBlue;
|
||||
|
||||
Assert.Equal(SKColors.LightBlue, flyout.HoverBackgroundColor);
|
||||
Assert.Equal(Colors.LightBlue, flyout.HoverBackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -306,9 +307,9 @@ public class SkiaMenuFlyoutTests
|
||||
{
|
||||
var flyout = new SkiaMenuFlyout();
|
||||
|
||||
flyout.SeparatorColor = SKColors.Gray;
|
||||
flyout.SeparatorColor = Colors.Grey;
|
||||
|
||||
Assert.Equal(SKColors.Gray, flyout.SeparatorColor);
|
||||
Assert.Equal(Colors.Grey, flyout.SeparatorColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
using Xunit;
|
||||
|
||||
@@ -87,7 +88,7 @@ public class SkiaRefreshViewTests
|
||||
{
|
||||
var refreshView = new SkiaRefreshView();
|
||||
|
||||
Assert.Equal(new SKColor(33, 150, 243), refreshView.RefreshColor);
|
||||
Assert.Equal(Color.FromRgb(33, 150, 243), refreshView.RefreshColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -95,9 +96,9 @@ public class SkiaRefreshViewTests
|
||||
{
|
||||
var refreshView = new SkiaRefreshView();
|
||||
|
||||
refreshView.RefreshColor = SKColors.Red;
|
||||
refreshView.RefreshColor = Colors.Red;
|
||||
|
||||
Assert.Equal(SKColors.Red, refreshView.RefreshColor);
|
||||
Assert.Equal(Colors.Red, refreshView.RefreshColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -105,7 +106,7 @@ public class SkiaRefreshViewTests
|
||||
{
|
||||
var refreshView = new SkiaRefreshView();
|
||||
|
||||
Assert.Equal(SKColors.White, refreshView.RefreshBackgroundColor);
|
||||
Assert.Equal(Colors.White, refreshView.RefreshBackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -113,9 +114,9 @@ public class SkiaRefreshViewTests
|
||||
{
|
||||
var refreshView = new SkiaRefreshView();
|
||||
|
||||
refreshView.RefreshBackgroundColor = SKColors.LightGray;
|
||||
refreshView.RefreshBackgroundColor = Colors.LightGrey;
|
||||
|
||||
Assert.Equal(SKColors.LightGray, refreshView.RefreshBackgroundColor);
|
||||
Assert.Equal(Colors.LightGrey, refreshView.RefreshBackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -135,7 +136,7 @@ public class SkiaRefreshViewTests
|
||||
var refreshView = new SkiaRefreshView();
|
||||
var content = new SkiaLabel { Text = "Test" };
|
||||
refreshView.Content = content;
|
||||
refreshView.Arrange(new SKRect(0, 0, 200, 400));
|
||||
refreshView.Arrange(new Rect(0, 0, 200, 400));
|
||||
|
||||
var hit = refreshView.HitTest(100, 200);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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;
|
||||
@@ -46,8 +47,8 @@ public class SkiaScrollViewTests
|
||||
content.AddChild(new SkiaButton { Text = "1", RequestedHeight = 100 });
|
||||
content.AddChild(new SkiaButton { Text = "2", RequestedHeight = 100 });
|
||||
scrollView.Content = content;
|
||||
scrollView.Measure(new SKSize(200, 100)); // Viewport smaller than content
|
||||
scrollView.Arrange(new SKRect(0, 0, 200, 100));
|
||||
scrollView.Measure(new Size(200, 100)); // Viewport smaller than content
|
||||
scrollView.Arrange(new Rect(0, 0, 200, 100));
|
||||
|
||||
// Act - Try to scroll below 0
|
||||
scrollView.ScrollY = -50;
|
||||
@@ -67,8 +68,8 @@ public class SkiaScrollViewTests
|
||||
content.AddChild(new SkiaButton { Text = $"Button {i}", RequestedHeight = 50 });
|
||||
}
|
||||
scrollView.Content = content;
|
||||
scrollView.Measure(new SKSize(200, 300));
|
||||
scrollView.Arrange(new SKRect(0, 0, 200, 300));
|
||||
scrollView.Measure(new Size(200, 300));
|
||||
scrollView.Arrange(new Rect(0, 0, 200, 300));
|
||||
|
||||
var initialScrollY = scrollView.ScrollY;
|
||||
|
||||
@@ -89,8 +90,8 @@ public class SkiaScrollViewTests
|
||||
content.AddChild(button);
|
||||
scrollView.Content = content;
|
||||
|
||||
scrollView.Measure(new SKSize(200, 200));
|
||||
scrollView.Arrange(new SKRect(0, 0, 200, 200));
|
||||
scrollView.Measure(new Size(200, 200));
|
||||
scrollView.Arrange(new Rect(0, 0, 200, 200));
|
||||
|
||||
// Act
|
||||
var hit = scrollView.HitTest(100, 25);
|
||||
@@ -111,8 +112,8 @@ public class SkiaScrollViewTests
|
||||
}
|
||||
scrollView.Content = content;
|
||||
|
||||
scrollView.Measure(new SKSize(200, 100));
|
||||
scrollView.Arrange(new SKRect(0, 0, 200, 100));
|
||||
scrollView.Measure(new Size(200, 100));
|
||||
scrollView.Arrange(new Rect(0, 0, 200, 100));
|
||||
|
||||
// Act
|
||||
scrollView.ScrollY = 50;
|
||||
@@ -129,7 +130,7 @@ public class SkiaScrollViewTests
|
||||
var content = new SkiaStackLayout();
|
||||
content.AddChild(new SkiaButton { Text = "Test" });
|
||||
scrollView.Content = content;
|
||||
scrollView.Bounds = new SKRect(0, 0, 200, 200);
|
||||
scrollView.Bounds = new Rect(0, 0, 200, 200);
|
||||
|
||||
using var surface = SKSurface.Create(new SKImageInfo(300, 300));
|
||||
var canvas = surface.Canvas;
|
||||
@@ -150,8 +151,8 @@ public class SkiaScrollViewTests
|
||||
content.AddChild(new SkiaButton { Text = $"Button {i}", RequestedHeight = 50 });
|
||||
}
|
||||
scrollView.Content = content;
|
||||
scrollView.Measure(new SKSize(200, 200));
|
||||
scrollView.Arrange(new SKRect(0, 0, 200, 200));
|
||||
scrollView.Measure(new Size(200, 200));
|
||||
scrollView.Arrange(new Rect(0, 0, 200, 200));
|
||||
|
||||
// Act - Scroll to maximum
|
||||
scrollView.ScrollY = 10000; // Very large value
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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;
|
||||
@@ -19,7 +20,7 @@ public class SkiaSliderTests
|
||||
// Assert
|
||||
slider.Value.Should().Be(0);
|
||||
slider.Minimum.Should().Be(0);
|
||||
slider.Maximum.Should().Be(100); // Default maximum is 100
|
||||
slider.Maximum.Should().Be(1.0); // MAUI Slider.Maximum default is 1.0
|
||||
slider.IsEnabled.Should().BeTrue();
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ public class SkiaSliderTests
|
||||
{
|
||||
// Arrange
|
||||
var slider = new SkiaSlider { Value = 50, Minimum = 0, Maximum = 100 };
|
||||
slider.Bounds = new SKRect(0, 0, 200, 40);
|
||||
slider.Bounds = new Rect(0, 0, 200, 40);
|
||||
|
||||
using var surface = SKSurface.Create(new SKImageInfo(300, 100));
|
||||
var canvas = surface.Canvas;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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;
|
||||
@@ -68,7 +69,7 @@ public class SkiaStackLayoutTests
|
||||
layout.AddChild(new SkiaButton { Text = "3" });
|
||||
|
||||
// Act
|
||||
var size = layout.Measure(new SKSize(200, 1000));
|
||||
var size = layout.Measure(new Size(200, 1000));
|
||||
|
||||
// Assert - Size should account for 3 children with spacing
|
||||
size.Height.Should().BeGreaterThan(0);
|
||||
@@ -89,7 +90,7 @@ public class SkiaStackLayoutTests
|
||||
layout.AddChild(new SkiaButton { Text = "3" });
|
||||
|
||||
// Act
|
||||
var size = layout.Measure(new SKSize(1000, 200));
|
||||
var size = layout.Measure(new Size(1000, 200));
|
||||
|
||||
// Assert - Size should account for 3 children with spacing
|
||||
size.Width.Should().BeGreaterThan(0);
|
||||
@@ -111,8 +112,8 @@ public class SkiaStackLayoutTests
|
||||
layout.AddChild(button2);
|
||||
|
||||
// Act
|
||||
layout.Measure(new SKSize(200, 500));
|
||||
layout.Arrange(new SKRect(0, 0, 200, 500));
|
||||
layout.Measure(new Size(200, 500));
|
||||
layout.Arrange(new Rect(0, 0, 200, 500));
|
||||
|
||||
// Assert - Button2 should be below Button1
|
||||
button2.Bounds.Top.Should().BeGreaterThan(button1.Bounds.Top);
|
||||
@@ -133,8 +134,8 @@ public class SkiaStackLayoutTests
|
||||
layout.AddChild(button2);
|
||||
|
||||
// Act
|
||||
layout.Measure(new SKSize(500, 200));
|
||||
layout.Arrange(new SKRect(0, 0, 500, 200));
|
||||
layout.Measure(new Size(500, 200));
|
||||
layout.Arrange(new Rect(0, 0, 500, 200));
|
||||
|
||||
// Assert - Button2 should be to the right of Button1
|
||||
button2.Bounds.Left.Should().BeGreaterThan(button1.Bounds.Left);
|
||||
@@ -147,14 +148,14 @@ public class SkiaStackLayoutTests
|
||||
var layout = new SkiaStackLayout
|
||||
{
|
||||
Orientation = PlatformStackOrientation.Vertical,
|
||||
Padding = new SKRect(20, 20, 20, 20)
|
||||
Padding = new Microsoft.Maui.Thickness(20, 20, 20, 20)
|
||||
};
|
||||
var button = new SkiaButton { Text = "Test" };
|
||||
layout.AddChild(button);
|
||||
|
||||
// Act
|
||||
layout.Measure(new SKSize(300, 300));
|
||||
layout.Arrange(new SKRect(0, 0, 300, 300));
|
||||
layout.Measure(new Size(300, 300));
|
||||
layout.Arrange(new Rect(0, 0, 300, 300));
|
||||
|
||||
// Assert - Padding property is set
|
||||
layout.Padding.Left.Should().Be(20);
|
||||
@@ -168,7 +169,7 @@ public class SkiaStackLayoutTests
|
||||
var layout = new SkiaStackLayout();
|
||||
layout.AddChild(new SkiaButton { Text = "1" });
|
||||
layout.AddChild(new SkiaButton { Text = "2" });
|
||||
layout.Bounds = new SKRect(0, 0, 200, 200);
|
||||
layout.Bounds = new Rect(0, 0, 200, 200);
|
||||
|
||||
using var surface = SKSurface.Create(new SKImageInfo(300, 300));
|
||||
var canvas = surface.Canvas;
|
||||
@@ -188,8 +189,8 @@ public class SkiaStackLayoutTests
|
||||
layout.AddChild(button1);
|
||||
layout.AddChild(button2);
|
||||
|
||||
layout.Measure(new SKSize(200, 200));
|
||||
layout.Arrange(new SKRect(0, 0, 200, 200));
|
||||
layout.Measure(new Size(200, 200));
|
||||
layout.Arrange(new Rect(0, 0, 200, 200));
|
||||
|
||||
// Act - Hit test within layout bounds
|
||||
var hit = layout.HitTest(100, 10);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
using Xunit;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class SkiaSwipeViewTests
|
||||
public void LeftItems_CanAddItems()
|
||||
{
|
||||
var swipeView = new SkiaSwipeView();
|
||||
var item = new SwipeItem { Text = "Delete", BackgroundColor = SKColors.Red };
|
||||
var item = new SwipeItem { Text = "Delete", BackgroundColor = Colors.Red };
|
||||
|
||||
swipeView.LeftItems.Add(item);
|
||||
|
||||
@@ -48,7 +49,7 @@ public class SkiaSwipeViewTests
|
||||
public void RightItems_CanAddItems()
|
||||
{
|
||||
var swipeView = new SkiaSwipeView();
|
||||
var item = new SwipeItem { Text = "Archive", BackgroundColor = SKColors.Blue };
|
||||
var item = new SwipeItem { Text = "Archive", BackgroundColor = Colors.Blue };
|
||||
|
||||
swipeView.RightItems.Add(item);
|
||||
|
||||
@@ -146,17 +147,17 @@ public class SkiaSwipeViewTests
|
||||
[Fact]
|
||||
public void SwipeItem_TextColor_CanBeSet()
|
||||
{
|
||||
var item = new SwipeItem { TextColor = SKColors.Yellow };
|
||||
var item = new SwipeItem { TextColor = Colors.Yellow };
|
||||
|
||||
Assert.Equal(SKColors.Yellow, item.TextColor);
|
||||
Assert.Equal(Colors.Yellow, item.TextColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SwipeItem_BackgroundColor_CanBeSet()
|
||||
{
|
||||
var item = new SwipeItem { BackgroundColor = SKColors.Green };
|
||||
var item = new SwipeItem { BackgroundColor = Colors.Green };
|
||||
|
||||
Assert.Equal(SKColors.Green, item.BackgroundColor);
|
||||
Assert.Equal(Colors.Green, item.BackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -190,7 +191,7 @@ public class SkiaSwipeViewTests
|
||||
{
|
||||
var swipeView = new SkiaSwipeView();
|
||||
swipeView.Content = new SkiaLabel { Text = "Content" };
|
||||
swipeView.Arrange(new SKRect(0, 0, 300, 50));
|
||||
swipeView.Arrange(new Rect(0, 0, 300, 50));
|
||||
|
||||
var hit = swipeView.HitTest(150, 25);
|
||||
|
||||
@@ -203,7 +204,7 @@ public class SkiaSwipeViewTests
|
||||
var swipeView = new SkiaSwipeView();
|
||||
swipeView.Content = new SkiaLabel { Text = "Test" };
|
||||
|
||||
var size = swipeView.Measure(new SKSize(300, 100));
|
||||
var size = swipeView.Measure(new Size(300, 100));
|
||||
|
||||
Assert.True(size.Width <= 300);
|
||||
Assert.True(size.Height <= 100);
|
||||
|
||||
Reference in New Issue
Block a user