public void ParseColorStopList2() { var text = "rgb(153, 116, 186) 0%, rgb(194, 234, 9) 20%".AsSpan(); ColorStop stop; int read; stop = ColorStop.Read(text, out read); Assert.Equal(21, read); Assert.Equal(0, stop.Position); stop = ColorStop.Read(text.Slice(read + 2), out read); Assert.Equal(20, read); Assert.Equal(0.2, stop.Position); }
public void ParseColorStopList() { var text = "#00a 90%, #000 91%, #fff 92%".AsSpan(); int read; var stop1 = ColorStop.Read(text, out read); Assert.Equal(8, read); var stop2 = ColorStop.Read(text.Slice(read + 2), out read); Assert.Equal(8, read); Assert.Equal(Rgba32.Parse("#00a"), (Rgba32)stop1.Color); Assert.Equal(0.9, stop1.Position); Assert.Equal(Rgba32.Parse("#000"), (Rgba32)stop2.Color); }