Skip to content

Commit 07b8aa4

Browse files
committed
Refactor SmithCharts tests
1 parent e08e49e commit 07b8aa4

File tree

5 files changed

+122
-96
lines changed

5 files changed

+122
-96
lines changed

tests/Common/FSharpTestBase/FSharpTestBase.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<Compile Include="TestCharts\ChartTernaryTestCharts.fs" />
2121
<Compile Include="TestCharts\ChartCarpetTestCharts.fs" />
2222
<Compile Include="TestCharts\ChartDomainTestCharts.fs" />
23+
<Compile Include="TestCharts\ChartSmithTestCharts.fs" />
2324
</ItemGroup>
2425

2526
<ItemGroup>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module ChartSmithTestCharts
2+
3+
open Plotly.NET
4+
open Plotly.NET.TraceObjects
5+
6+
7+
module ScatterSmith =
8+
9+
let ``Simple smith scatter chart`` =
10+
Chart.ScatterSmith(
11+
real = [0.5; 1.; 2.; 3.],
12+
imag = [0.5; 1.; 2.; 3.],
13+
mode = StyleParam.Mode.Lines_Markers_Text,
14+
MultiText = ["Pretty"; "Cool"; "Plot"; "Huh?"],
15+
TextPosition = StyleParam.TextPosition.TopCenter,
16+
UseDefaults = false
17+
)
18+
19+
module PointSmith =
20+
21+
let ``Simple smith point chart`` =
22+
Chart.PointSmith(
23+
real = [0.5; 1.; 2.; 3.],
24+
imag = [0.5; 1.; 2.; 3.],
25+
UseDefaults = false
26+
)
27+
28+
module LineSmith =
29+
30+
let ``Simple smith line chart`` =
31+
Chart.LineSmith(
32+
real = [0.5; 1.; 2.; 3.],
33+
imag = [0.5; 1.; 2.; 3.],
34+
LineDash = StyleParam.DrawingStyle.DashDot,
35+
LineColor = Color.fromKeyword Purple,
36+
UseDefaults = false
37+
)
38+
39+
module BubbleSmith =
40+
41+
let ``Simple smith bubble chart`` =
42+
Chart.BubbleSmith(
43+
real = [0.5; 1.; 2.; 3.],
44+
imag = [0.5; 1.; 2.; 3.],
45+
sizes = [10;20;30;40],
46+
MultiText=["one";"two";"three";"four";"five";"six";"seven"],
47+
TextPosition=StyleParam.TextPosition.TopCenter,
48+
UseDefaults = false
49+
)

tests/CoreTests/CoreTests/CoreTests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<Compile Include="HtmlCodegen\ChartTernary.fs" />
1919
<Compile Include="HtmlCodegen\ChartCarpet.fs" />
2020
<Compile Include="HtmlCodegen\ChartDomain.fs" />
21+
<Compile Include="HtmlCodegen\ChartSmith.fs" />
2122
<!--HTMLCodegen-->
2223

2324
<Compile Include="ChartAPIs\WithAxis.fs" />
@@ -33,7 +34,6 @@
3334
<Compile Include="Traces\TraceID.fs" />
3435
<Compile Include="HtmlCodegen\SimpleTests.fs" />
3536
<Compile Include="HtmlCodegen\ChartLayout.fs" />
36-
<Compile Include="HtmlCodegen\SmithCharts.fs" />
3737
<Compile Include="HtmlCodegen\MulticategoryData.fs" />
3838
<Compile Include="Main.fs" />
3939
</ItemGroup>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
module CoreTests.HTMLCodegen.ChartSmith
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+
open TestUtils.HtmlCodegen
10+
open ChartSmithTestCharts
11+
12+
module ScatterSmith =
13+
[<Tests>]
14+
let ``ScatterSmith chart HTML codegeneration tests`` =
15+
testList "HTMLCodegen.ChartSmith" [
16+
testList "ScatterSmith" [
17+
testCase "Scatter data" ( fun () ->
18+
"""var data = [{"type":"scattersmith","mode":"lines+markers+text","imag":[0.5,1.0,2.0,3.0],"real":[0.5,1.0,2.0,3.0],"text":["Pretty","Cool","Plot","Huh?"],"textposition":"top center","marker":{},"line":{}}];"""
19+
|> chartGeneratedContains ScatterSmith.``Simple smith scatter chart``
20+
)
21+
testCase "Scatter layout" ( fun () ->
22+
emptyLayout ScatterSmith.``Simple smith scatter chart``
23+
)
24+
]
25+
]
26+
27+
28+
module PointSmith =
29+
[<Tests>]
30+
let ``PointSmith chart HTML codegeneration tests`` =
31+
testList "HTMLCodegen.ChartSmith" [
32+
testList "PointSmith" [
33+
testCase "Point data" ( fun () ->
34+
"""var data = [{"type":"scattersmith","mode":"markers","imag":[0.5,1.0,2.0,3.0],"real":[0.5,1.0,2.0,3.0],"marker":{},"line":{}}];"""
35+
|> chartGeneratedContains PointSmith.``Simple smith point chart``
36+
)
37+
testCase "Point layout" ( fun () ->
38+
emptyLayout PointSmith.``Simple smith point chart``
39+
)
40+
]
41+
]
42+
43+
module LineSmith =
44+
[<Tests>]
45+
let ``LineSmith chart HTML codegeneration tests`` =
46+
testList "HTMLCodegen.ChartSmith" [
47+
testList "LineSmith" [
48+
testCase "Line data" ( fun () ->
49+
"""var data = [{"type":"scattersmith","mode":"lines","imag":[0.5,1.0,2.0,3.0],"real":[0.5,1.0,2.0,3.0],"marker":{},"line":{"color":"rgba(128, 0, 128, 1.0)","dash":"dashdot"}}];"""
50+
|> chartGeneratedContains LineSmith.``Simple smith line chart``
51+
)
52+
testCase "Line layout" ( fun () ->
53+
emptyLayout LineSmith.``Simple smith line chart``
54+
)
55+
]
56+
]
57+
58+
module BubbleSmith =
59+
[<Tests>]
60+
let ``BubbleSmith chart HTML codegeneration tests`` =
61+
testList "HTMLCodegen.ChartSmith" [
62+
testList "BubbleSmith" [
63+
testCase "Bubble data" ( fun () ->
64+
"""var data = [{"type":"scattersmith","mode":"markers+text","imag":[0.5,1.0,2.0,3.0],"real":[0.5,1.0,2.0,3.0],"text":["one","two","three","four","five","six","seven"],"textposition":"top center","marker":{"size":[10,20,30,40]},"line":{}}];"""
65+
|> chartGeneratedContains BubbleSmith.``Simple smith bubble chart``
66+
)
67+
testCase "Bubble layout" ( fun () ->
68+
emptyLayout BubbleSmith.``Simple smith bubble chart``
69+
)
70+
]
71+
]

tests/CoreTests/CoreTests/HTMLCodegen/SmithCharts.fs

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)