Skip to content

Commit 5452be4

Browse files
committed
Add Some TraceStyle tests
1 parent 6560df0 commit 5452be4

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/Plotly.NET.Tests/Plotly.NET.Tests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<Compile Include="CommonAbstractions\Colors.fs" />
1313
<Compile Include="LayoutObjects\Slider.fs" />
1414
<Compile Include="LayoutObjects\LinearAxis.fs" />
15+
<Compile Include="Traces\TraceStyle.fs" />
1516
<Compile Include="Traces\TraceID.fs" />
1617
<Compile Include="HtmlCodegen\SimpleTests.fs" />
1718
<Compile Include="HtmlCodegen\ChartLayout.fs" />
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module Tests.LayoutObjects.TraceStyle
2+
3+
open Expecto
4+
open Plotly.NET
5+
open Plotly.NET.LayoutObjects
6+
open Plotly.NET.TraceObjects
7+
open Plotly.NET.GenericChart
8+
9+
let createEmptyTrace() = Trace2D.initScatter(id)
10+
11+
[<Tests>]
12+
let ``TraceStyle tests`` =
13+
testList "Traces.TraceStyle" [
14+
testCase "SetMarker" (fun _ ->
15+
Expect.equal
16+
(createEmptyTrace() |> TraceStyle.SetMarker(Marker.init(Color=Color.fromKeyword Red, Opacity = 0.)))
17+
(Trace2D.initScatter(Trace2DStyle.Scatter(Marker = Marker.init(Color=Color.fromKeyword Red, Opacity = 0.))))
18+
"TraceStyle.SetMarker did not produce the correct trace object"
19+
)
20+
testCase "Marker" (fun _ ->
21+
Expect.equal
22+
(createEmptyTrace() |> TraceStyle.Marker(Color=Color.fromKeyword Red, Opacity = 0.))
23+
(Trace2D.initScatter(Trace2DStyle.Scatter(Marker = Marker.init(Color=Color.fromKeyword Red, Opacity = 0.))))
24+
"TraceStyle.Marker did not produce the correct trace object"
25+
)
26+
testCase "SetLine" (fun _ ->
27+
Expect.equal
28+
(createEmptyTrace() |> TraceStyle.SetLine(Line.init(Color=Color.fromKeyword Red, Width = 0.)))
29+
(Trace2D.initScatter(Trace2DStyle.Scatter(Line = Line.init(Color=Color.fromKeyword Red, Width = 0.))))
30+
"TraceStyle.SetLine did not produce the correct trace object"
31+
)
32+
testCase "Line" (fun _ ->
33+
Expect.equal
34+
(createEmptyTrace() |> TraceStyle.Line(Color=Color.fromKeyword Red, Width = 0.))
35+
(Trace2D.initScatter(Trace2DStyle.Scatter(Line = Line.init(Color=Color.fromKeyword Red, Width = 0.))))
36+
"TraceStyle.Line did not produce the correct trace object"
37+
)
38+
]

0 commit comments

Comments
 (0)