Forge
csharp4405de34
1using CascadeIDE.Views.Chat.Skia;
2using SkiaSharp;
3using Xunit;
4
5namespace CascadeIDE.Tests;
6
7public sealed class SkiaIntercomTopicNavigatorHitTests
8{
9 [Fact]
10 public void MapRowBoundsToPanel_matches_listTop_minus_scroll()
11 {
12 const float left = 0f;
13 const float top = 72f;
14 const float height = 400f;
15 const float scrollOffset = 12f;
16
17 var panel = SkiaIntercomTopicNavigator.ComputePanelLayout(left, top, height, rowCount: 3);
18 var rowInListSpace = new SKRect(left + SkiaIntercomTopicNavigator.Pad, 0f, left + SkiaIntercomTopicNavigator.PanelWidth - SkiaIntercomTopicNavigator.Pad, SkiaIntercomTopicNavigator.RowHeight);
19
20 var mapped = SkiaIntercomTopicNavigator.MapRowBoundsToPanel(rowInListSpace, panel, scrollOffset);
21
22 Assert.Equal(panel.ListTop - scrollOffset, mapped.Top, precision: 3);
23 Assert.Equal(panel.SearchBounds.Bottom + SkiaIntercomTopicNavigator.Pad - scrollOffset, mapped.Top, precision: 3);
24 }
25
26 [Fact]
27 public void ComputePanelLayout_listTop_is_below_search_field()
28 {
29 const float top = 40f;
30 var panel = SkiaIntercomTopicNavigator.ComputePanelLayout(0f, top, 300f, rowCount: 1);
31
32 Assert.Equal(top + SkiaIntercomTopicNavigator.Pad + SkiaIntercomTopicNavigator.SearchHeight + SkiaIntercomTopicNavigator.Pad, panel.ListTop, precision: 3);
33 Assert.Equal(panel.SearchBounds.Bottom + SkiaIntercomTopicNavigator.Pad, panel.ListTop, precision: 3);
34 }
35}
36
View only · write via MCP/CIDE