mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-12-04 17:29:24 -05:00
On a linear scale topped by the cells at the torch, nearly the whole sheet drew in the coolest blue. Color rises logarithmically from 10 °C to the 99.5th percentile of the cut's peaks, held between 100 and 1000 °C, and label the colors with a bar down the plate view's right edge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using OpenNest.Desktop.Interaction;
|
|
using Xunit;
|
|
|
|
namespace OpenNest.Desktop.Tests.Interaction;
|
|
|
|
public class HeatColorScaleTests
|
|
{
|
|
[Fact]
|
|
public void EqualRatiosOfRiseAreEqualStepsOfColor()
|
|
{
|
|
Assert.Equal(0f, HeatColorScale.Fraction(10, 1000));
|
|
Assert.Equal(0.5f, HeatColorScale.Fraction(100, 1000), 5);
|
|
Assert.Equal(1f, HeatColorScale.Fraction(1000, 1000));
|
|
Assert.Equal(1f, HeatColorScale.Fraction(3756, 1000));
|
|
Assert.Equal(0f, HeatColorScale.Fraction(0, 1000));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0f, 100f)]
|
|
[InlineData(450f, 450f)]
|
|
[InlineData(2070f, 1000f)]
|
|
public void TheTopIsHeldWithinTheLimits(float rise, float top) =>
|
|
Assert.Equal(top, HeatColorScale.Top(rise));
|
|
|
|
[Fact]
|
|
public void TheMarksRunFromTheFloorToTheTop()
|
|
{
|
|
Assert.Equal(new float[] { 10, 30, 100, 300, 1000 }, HeatColorScale.Ticks(1000));
|
|
// 300 would sit on top of 330's own label.
|
|
Assert.Equal(new float[] { 10, 30, 100, 330 }, HeatColorScale.Ticks(330));
|
|
}
|
|
}
|