Skip to content

Commit 9cea9f2

Browse files
committed
refactor html codegen tests
1 parent f0c327b commit 9cea9f2

42 files changed

Lines changed: 363 additions & 656 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Plotly.NET.sln

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ImageExportTests", "tests\E
166166
EndProject
167167
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpTests", "tests\ExtensionLibsTests\CSharpTests\CSharpTests.csproj", "{1170E3A9-D83E-40B0-8D51-20485C76BE88}"
168168
EndProject
169+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{6CFE1FBD-0999-4704-9F79-8A3D31580477}"
170+
EndProject
171+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpTestBase", "tests\Common\CSharpTestBase\CSharpTestBase.csproj", "{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}"
172+
EndProject
173+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpTestBase", "tests\Common\FSharpTestBase\FSharpTestBase.fsproj", "{18F778B2-3409-4309-8C9B-596109072481}"
174+
EndProject
169175
Global
170176
GlobalSection(SolutionConfigurationPlatforms) = preSolution
171177
Debug|Any CPU = Debug|Any CPU
@@ -245,6 +251,18 @@ Global
245251
{1170E3A9-D83E-40B0-8D51-20485C76BE88}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
246252
{1170E3A9-D83E-40B0-8D51-20485C76BE88}.Release|Any CPU.ActiveCfg = Release|Any CPU
247253
{1170E3A9-D83E-40B0-8D51-20485C76BE88}.Release|Any CPU.Build.0 = Release|Any CPU
254+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
255+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
256+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
257+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
258+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
259+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED}.Release|Any CPU.Build.0 = Release|Any CPU
260+
{18F778B2-3409-4309-8C9B-596109072481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
261+
{18F778B2-3409-4309-8C9B-596109072481}.Debug|Any CPU.Build.0 = Debug|Any CPU
262+
{18F778B2-3409-4309-8C9B-596109072481}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
263+
{18F778B2-3409-4309-8C9B-596109072481}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
264+
{18F778B2-3409-4309-8C9B-596109072481}.Release|Any CPU.ActiveCfg = Release|Any CPU
265+
{18F778B2-3409-4309-8C9B-596109072481}.Release|Any CPU.Build.0 = Release|Any CPU
248266
EndGlobalSection
249267
GlobalSection(SolutionProperties) = preSolution
250268
HideSolutionNode = FALSE
@@ -269,6 +287,9 @@ Global
269287
{32E187BB-D1D4-4864-A021-55A7A08E17EC} = {023425D8-B375-45ED-A29A-A3ED00C0E2BC}
270288
{A3693DD1-4D34-4B10-B310-07A4C7433F7D} = {02886FBB-DB32-4BBB-A93C-E13EBF453ACC}
271289
{1170E3A9-D83E-40B0-8D51-20485C76BE88} = {02886FBB-DB32-4BBB-A93C-E13EBF453ACC}
290+
{6CFE1FBD-0999-4704-9F79-8A3D31580477} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
291+
{9B73CE85-9F85-42DB-8CEC-7A49B70189ED} = {6CFE1FBD-0999-4704-9F79-8A3D31580477}
292+
{18F778B2-3409-4309-8C9B-596109072481} = {6CFE1FBD-0999-4704-9F79-8A3D31580477}
272293
EndGlobalSection
273294
GlobalSection(ExtensibilityGlobals) = postSolution
274295
SolutionGuid = {7177F1E1-341C-48AB-9864-6B525FFF7633}

build/ProjectInfo.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ let pkgDir = "pkg"
6262
/// binaries are built using this configuration.
6363
let configuration = "Release"
6464

65+
// test base projects (need to be built first)
66+
let FSharpTestBaseProject = ProjectInfo.create("FSharpTestBase", "tests/Common/FSharpTestBase/FSharpTestBase.fsproj")
67+
let CSharpTestBaseProject = ProjectInfo.create("CSharpTestBase", "tests/Common/CSharpTestBase/CSharpTestBase.csproj")
68+
69+
let testBaseProjects = [
70+
FSharpTestBaseProject
71+
CSharpTestBaseProject
72+
]
73+
6574
// test projects (.NET)
6675
let CoreTestProject = ProjectInfo.create("CoreTests", "tests/CoreTests/CoreTests/CoreTests.fsproj")
6776
let CSharpInteroperabilityTestProject = ProjectInfo.create("CSharpInteroperabilityTests", "tests/CoreTests/CSharpInteroperabilityTests/CSharpInteroperabilityTests.csproj")

build/TestTasks.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ let createTestBuildTask (name: string) (deps: BuildTask.TaskInfo list) (projects
1919
)
2020
}
2121

22-
let buildTestsAll = createTestBuildTask "BuildTestsAll" [clean; build] (testProjectsCore @ testProjectsExtensionsLibs @ testProjectsNetFX)
22+
let buildTestsAll = createTestBuildTask "BuildTestsAll" [clean; build] (testBaseProjects @ testProjectsCore @ testProjectsExtensionsLibs @ testProjectsNetFX)
2323

24-
let buildTestsAllNoNetFX = createTestBuildTask "BuildTestsAllNoNetFX" [clean; build] (testProjectsCore @ testProjectsExtensionsLibs)
24+
let buildTestsAllNoNetFX = createTestBuildTask "BuildTestsAllNoNetFX" [clean; build] (testBaseProjects @ testProjectsCore @ testProjectsExtensionsLibs)
2525

26-
let buildTestsCore = createTestBuildTask "BuildTestsCore" [clean; build] testProjectsCore
26+
let buildTestsCore = createTestBuildTask "BuildTestsCore" [clean; build] (testBaseProjects @ testProjectsCore)
2727

28-
let buildTestsNetFX = createTestBuildTask "BuildTestsNetFX" [clean; build] testProjectsNetFX
28+
let buildTestsNetFX = createTestBuildTask "BuildTestsNetFX" [clean; build] (testBaseProjects @ testProjectsNetFX)
2929

30-
let buildTestsExtensionsLibs = createTestBuildTask "BuildTestsExtensionsLibs" [clean; build] testProjectsExtensionsLibs
30+
let buildTestsExtensionsLibs = createTestBuildTask "BuildTestsExtensionsLibs" [clean; build] (testBaseProjects @ testProjectsExtensionsLibs)
3131

3232

3333
let createRunTestTask (name: string) (deps: BuildTask.TaskInfo list) (projects: ProjectInfo list) =

tests/Common/FSharpTestBase/FSharpTestBase.fsproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<Compile Include="Library.fs" />
9+
<Compile Include="TestCharts\Chart2DTestCharts.fs" />
10+
</ItemGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\..\..\src\Plotly.NET\Plotly.NET.fsproj" />
1014
</ItemGroup>
1115

1216
</Project>

tests/Common/FSharpTestBase/Library.fs

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

tests/CoreTests/CoreTests/TestCharts/Chart2D/Point.fs renamed to tests/Common/FSharpTestBase/TestCharts/Chart2DTestCharts.fs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
namespace Plotly.NET.Tests.TestCharts.Chart2D
1+
module Chart2DTestCharts
22

33
open Plotly.NET
4-
open Plotly.NET.LayoutObjects
5-
open Plotly.NET.TraceObjects
6-
open Plotly.NET.GenericChart
7-
open Plotly.NET.StyleParam
8-
9-
/// Test charts created with Chart2D.Chart.Point
10-
module Point =
114

5+
module Point =
6+
127
let ``Point chart with full plotly.js reference`` =
138
let xData = [0. .. 10.]
149
let yData = [0. .. 10.]
@@ -57,4 +52,28 @@ module Point =
5752
MultiText=labels,
5853
TextPosition=StyleParam.TextPosition.TopRight,
5954
UseDefaults = false
60-
)
55+
)
56+
57+
module Line =
58+
59+
let ``Simple line chart`` = Chart.Line([ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ], UseDefaults = false)
60+
61+
let ``Line chart with line styling`` =
62+
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
63+
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
64+
Chart.Line(
65+
x = x,
66+
y = y,
67+
Name="line",
68+
ShowMarkers=true,
69+
MarkerSymbol=StyleParam.MarkerSymbol.Square,
70+
UseDefaults = false
71+
)
72+
|> Chart.withLineStyle(Width=2.,Dash=StyleParam.DrawingStyle.Dot)
73+
74+
module Spline =
75+
76+
let ``Simple spline chart`` =
77+
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
78+
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
79+
Chart.Spline(x = x, y = y, Name="spline", UseDefaults = false)

tests/CoreTests/CoreTests/CoreTests.fsproj

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
<Compile Include="TestUtils.fs" />
1414
<!--Test charts-->
1515
<Compile Include="TestCharts\Chart2D\Scatter.fs" />
16-
<Compile Include="TestCharts\Chart2D\Point.fs" />
17-
<Compile Include="TestCharts\Chart2D\Line.fs" />
18-
<Compile Include="TestCharts\Chart2D\Spline.fs" />
1916
<Compile Include="TestCharts\Chart2D\Bubble.fs" />
2017
<Compile Include="TestCharts\Chart2D\Range.fs" />
2118
<Compile Include="TestCharts\Chart2D\Area.fs" />
@@ -93,36 +90,8 @@
9390
<Compile Include="TestCharts\ChartSmith\PointSmith.fs" />
9491
<Compile Include="TestCharts\ChartSmith\LineSmith.fs" />
9592
<Compile Include="TestCharts\ChartSmith\BubbleSmith.fs" />
93+
<Compile Include="HTMLCodegen\Chart2D.fs" />
9694
<!--HTMLCodegen-->
97-
<Compile Include="HTMLCodegen\Chart2D\Scatter.fs" />
98-
<Compile Include="HTMLCodegen\Chart2D\Point.fs" />
99-
<Compile Include="HTMLCodegen\Chart2D\Line.fs" />
100-
<Compile Include="HTMLCodegen\Chart2D\Spline.fs" />
101-
<Compile Include="HTMLCodegen\Chart2D\Bubble.fs" />
102-
<Compile Include="HTMLCodegen\Chart2D\Range.fs" />
103-
<Compile Include="HTMLCodegen\Chart2D\Area.fs" />
104-
<Compile Include="HTMLCodegen\Chart2D\SplineArea.fs" />
105-
<Compile Include="HTMLCodegen\Chart2D\StackedArea.fs" />
106-
<Compile Include="HTMLCodegen\Chart2D\Funnel.fs" />
107-
<Compile Include="HTMLCodegen\Chart2D\StackedFunnel.fs" />
108-
<Compile Include="HTMLCodegen\Chart2D\Waterfall.fs" />
109-
<Compile Include="HTMLCodegen\Chart2D\Bar.fs" />
110-
<Compile Include="HTMLCodegen\Chart2D\StackedBar.fs" />
111-
<Compile Include="HTMLCodegen\Chart2D\Column.fs" />
112-
<Compile Include="HTMLCodegen\Chart2D\StackedColumn.fs" />
113-
<Compile Include="HTMLCodegen\Chart2D\Histogram.fs" />
114-
<Compile Include="HTMLCodegen\Chart2D\Histogram2D.fs" />
115-
<Compile Include="HTMLCodegen\Chart2D\BoxPlot.fs" />
116-
<Compile Include="HTMLCodegen\Chart2D\Violin.fs" />
117-
<Compile Include="HTMLCodegen\Chart2D\Histogram2DContour.fs" />
118-
<Compile Include="HTMLCodegen\Chart2D\Heatmap.fs" />
119-
<Compile Include="HTMLCodegen\Chart2D\AnnotatedHeatmap.fs" />
120-
<Compile Include="HTMLCodegen\Chart2D\Image.fs" />
121-
<Compile Include="HTMLCodegen\Chart2D\Contour.fs" />
122-
<Compile Include="HTMLCodegen\Chart2D\OHLC.fs" />
123-
<Compile Include="HTMLCodegen\Chart2D\Candlestick.fs" />
124-
<Compile Include="HTMLCodegen\Chart2D\Splom.fs" />
125-
<Compile Include="HTMLCodegen\Chart2D\PointDensity.fs" />
12695
<Compile Include="HTMLCodegen\Chart3D\Scatter3D.fs" />
12796
<Compile Include="HTMLCodegen\Chart3D\Point3D.fs" />
12897
<Compile Include="HTMLCodegen\Chart3D\Line3D.fs" />
@@ -214,5 +183,6 @@
214183

215184
<ItemGroup>
216185
<ProjectReference Include="..\..\..\src\Plotly.NET\Plotly.NET.fsproj" />
186+
<ProjectReference Include="..\..\Common\FSharpTestBase\FSharpTestBase.fsproj" />
217187
</ItemGroup>
218188
</Project>

0 commit comments

Comments
 (0)