Skip to content

Commit

Permalink
Test Coverage update
Browse files Browse the repository at this point in the history
  • Loading branch information
DraviaVemal committed Aug 26, 2024
1 parent 3228011 commit 49eec9f
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<OutputPath>..\bin\</OutputPath>
<Authors>DraviaVemal</Authors>
<Version>2.9.0-Alpha.5</Version>
<Version>2.9.0</Version>
<Company>DraviaVemal</Company>
<Copyright>Copyright (c) 2023 DraviaVemal
Permission is hereby granted, free of charge, to any person obtaining a copy of this
Expand Down
2 changes: 1 addition & 1 deletion Spreadsheet/Components/2007/Worksheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void SetSheetViewOptions(WorkSheetViewOption workSheetViewOption)
GetSheetView().ShowGridLines = workSheetViewOption.showGridLines;
GetSheetView().ShowRowColHeaders = workSheetViewOption.showRowColHeaders;
GetSheetView().ShowRuler = workSheetViewOption.showRuler;
GetSheetView().View = GetSheetViewValue(workSheetViewOption.workSheetViewsValues);
GetSheetView().View = GetSheetViewValue(workSheetViewOption.workSheetViewsValue);
GetSheetView().ZoomScaleNormal = workSheetViewOption.ZoomScale;
GetSheetView().ZoomScale = workSheetViewOption.ZoomScale;
}
Expand Down
2 changes: 1 addition & 1 deletion Spreadsheet/Models/2007/WorksheetModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public uint ZoomScale
/// <summary>
///
/// </summary>
public WorkSheetViewsValues workSheetViewsValues = WorkSheetViewsValues.NORMAL;
public WorkSheetViewsValues workSheetViewsValue = WorkSheetViewsValues.NORMAL;
/// <summary>
///
/// </summary>
Expand Down
148 changes: 146 additions & 2 deletions Tests/Spreadsheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ namespace OpenXMLOffice.Tests
[TestClass]
public class Spreadsheet
{
private static readonly Excel excel = new();
private static readonly Excel excel = new(new ExcelProperties
{
coreProperties = new()
{
title = "Test File",
creator = "OpenXML-Office",
subject = "Test Subject",
tags = "Test",
category = "Test Category",
description = "Describe the test file"
}
});
private static readonly string resultPath = "../../TestOutputFiles";
/// <summary>
/// Initialize excel Test
Expand Down Expand Up @@ -40,6 +51,15 @@ public static void ClassCleanup()
excel.SaveAs(string.Format("{1}/test-{0}.xlsx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), resultPath));
}
/// <summary>
///
/// </summary>
[TestMethod]
public void BlankFile()
{
Excel excel2 = new();
excel2.SaveAs(string.Format("{1}/Blank-{0}.xlsx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), resultPath));
}
/// <summary>
/// Add Sheet Test
/// </summary>
[TestMethod]
Expand Down Expand Up @@ -264,9 +284,21 @@ public void TestSheetView()
showGridLines = false,
showRowColHeaders = false,
showRuler = false,
workSheetViewsValues = WorkSheetViewsValues.PAGE_LAYOUT,
workSheetViewsValue = WorkSheetViewsValues.PAGE_LAYOUT,
ZoomScale = 110
});
excel.AddSheet("Zoom 400").SetSheetViewOptions(new()
{
ZoomScale = 500 // Should auto correct to 400
});
excel.AddSheet("Zoom 10").SetSheetViewOptions(new()
{
ZoomScale = 0 // Should auto correct to 10
});
excel.AddSheet("Page Break").SetSheetViewOptions(new()
{
workSheetViewsValue = WorkSheetViewsValues.PAGE_BREAK_PREVIEW,
});
}

/// <summary>
Expand Down Expand Up @@ -357,6 +389,28 @@ public void AddAllCharts()
cellIdEnd = "D4"
}, new AreaChartSetting<ExcelSetting>()
{
areaChartSeriesSettings = new(){
new(){
trendLines = new(){
new(){
trendLineType = TrendLineTypes.LINEAR,
trendLineName = "Dravia",
hexColor = "FF0000",
lineStye = DrawingPresetLineDashValues.LARGE_DASH
}
}
},
new(){
trendLines = new(){
new(){
trendLineType = TrendLineTypes.EXPONENTIAL,
trendLineName = "vemal",
hexColor = "FFFF00",
lineStye = DrawingPresetLineDashValues.DASH_DOT
}
}
}
},
applicationSpecificSetting = new()
{
from = new()
Expand All @@ -377,6 +431,11 @@ public void AddAllCharts()
cellIdEnd = "D4"
}, new AreaChartSetting<ExcelSetting>()
{
areaChartDataLabel = new()
{
dataLabelPosition = AreaChartDataLabel.DataLabelPositionValues.SHOW,
isBold = true
},
areaChartType = AreaChartTypes.STACKED,
applicationSpecificSetting = new()
{
Expand Down Expand Up @@ -413,6 +472,69 @@ public void AddAllCharts()
}
}
});
worksheet.AddChart(new()
{
cellIdStart = "A1",
cellIdEnd = "D4"
}, new AreaChartSetting<ExcelSetting>()
{
areaChartType = AreaChartTypes.CLUSTERED_3D,
applicationSpecificSetting = new()
{
from = new()
{
row = 5,
column = 25
},
to = new()
{
row = 20,
column = 40
}
}
});
worksheet.AddChart(new()
{
cellIdStart = "A1",
cellIdEnd = "D4"
}, new AreaChartSetting<ExcelSetting>()
{
areaChartType = AreaChartTypes.STACKED_3D,
applicationSpecificSetting = new()
{
from = new()
{
row = 21,
column = 25
},
to = new()
{
row = 41,
column = 40
}
}
});
worksheet.AddChart(new()
{
cellIdStart = "A1",
cellIdEnd = "D4"
}, new AreaChartSetting<ExcelSetting>()
{
areaChartType = AreaChartTypes.PERCENT_STACKED_3D,
applicationSpecificSetting = new()
{
from = new()
{
row = 42,
column = 25
},
to = new()
{
row = 62,
column = 40
}
}
});
row = 0;
worksheet = excel.AddSheet("Bar Chart");
CommonMethod.CreateDataCellPayload().ToList().ForEach(rowData =>
Expand Down Expand Up @@ -844,6 +966,28 @@ public void AddAllCharts()
cellIdEnd = "F4"
}, new ScatterChartSetting<ExcelSetting>()
{
scatterChartSeriesSettings = new(){
new(){
trendLines = new(){
new(){
trendLineType = TrendLineTypes.LINEAR,
trendLineName = "Dravia",
hexColor = "FF0000",
lineStye = DrawingPresetLineDashValues.LARGE_DASH
}
}
},
new(){
trendLines = new(){
new(){
trendLineType = TrendLineTypes.EXPONENTIAL,
trendLineName = "vemal",
hexColor = "FFFF00",
lineStye = DrawingPresetLineDashValues.DASH_DOT
}
}
}
},
scatterChartType = ScatterChartTypes.BUBBLE,
applicationSpecificSetting = new()
{
Expand Down

0 comments on commit 49eec9f

Please sign in to comment.