Files
Explorer-Workbench/tests/Explorer.Application.Tests/MarqueeRangeTests.cs

30 lines
922 B
C#

using Explorer.Application;
namespace Explorer.Application.Tests;
public class MarqueeRangeTests
{
[Fact]
public void Stack_selects_rows_the_band_touches()
{
Assert.Equal([0, 1, 2], MarqueeRange.Stack(10, 70, 10, 24));
Assert.Equal([1], MarqueeRange.Stack(24, 30, 10, 24));
Assert.Equal([0], MarqueeRange.Stack(10, 10.2, 10, 24));
}
[Fact]
public void Wrap_selects_tiles_the_band_covers()
{
// 3 columns, 40x40 cells. Band over the first two tiles of row 0 and the first of row 1.
var hits = MarqueeRange.Wrap(5, 5, 55, 45, count: 8, columns: 3, itemWidth: 40, itemHeight: 40);
Assert.Equal([0, 1, 3, 4], hits);
}
[Fact]
public void Wrap_ignores_cells_past_the_item_count()
{
var hits = MarqueeRange.Wrap(0, 0, 120, 40, count: 2, columns: 3, itemWidth: 40, itemHeight: 40);
Assert.Equal([0, 1], hits);
}
}