-
Notifications
You must be signed in to change notification settings - Fork 308
Expand file tree
/
Copy pathPresetShapeDefinitionTests.cs
More file actions
78 lines (65 loc) · 2.85 KB
/
Copy pathPresetShapeDefinitionTests.cs
File metadata and controls
78 lines (65 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using EPPlus.DrawingRenderer;
using EPPlus.DrawingRenderer.ShapeDefinitions;
using OfficeOpenXml;
using OfficeOpenXml.Drawing;
namespace TestProject1
{
[TestClass]
public sealed class PresetShapeDefinitionTests
{
[TestMethod]
public async Task LoadPreset()
{
var psd = PresetShapeDefinitions.ShapeDefinitions;
Assert.AreEqual(187, psd.Count);
ExcelPackage.License.SetNonCommercialOrganization("EPPlus Project");
using (var p = new ExcelPackage())
{
var ws = p.Workbook.Worksheets.Add("Sheet1");
var shape = ws.Drawings.AddShape("Rect1", OfficeOpenXml.Drawing.eShapeStyle.Rect);
PresetShapeDefinitions.ShapeDefinitions[(ShapeStyle)shape.Style].Calculate(shape._width, shape._height, shape.TextBody.TextAutofit == eTextAutofit.ShapeAutofit, null, null);
await p.SaveAsAsync("c:\\temp\\rect.xlsx");
}
}
[TestMethod]
public void MathMultiplyTest()
{
ExcelPackage.License.SetNonCommercialPersonal("EPPLUS");
var shDef = PresetShapeDefinitions.ShapeDefinitions[ShapeStyle.MathMultiply];
using (var p = new ExcelPackage())
{
var ws = p.Workbook.Worksheets.Add("ws");
var shape = ws.Drawings.AddShape("mMult", eShapeStyle.MathMultiply);
shDef.Calculate(shape._width, shape._height, shape.TextBody.TextAutofit == eTextAutofit.ShapeAutofit, null, null);
}
}
[TestMethod]
public void CurvedDownArrow()
{
ExcelPackage.License.SetNonCommercialPersonal("EPPLUS");
var shDef = PresetShapeDefinitions.ShapeDefinitions[ShapeStyle.CurvedDownArrow];
using (var p = new ExcelPackage())
{
var ws = p.Workbook.Worksheets.Add("ws");
var shape = ws.Drawings.AddShape("mMult", eShapeStyle.CurvedDownArrow);
shape.SetSize(100, 100);
shDef.Calculate(shape._width, shape._height, shape.TextBody.TextAutofit == eTextAutofit.ShapeAutofit, null, null);
//shDef._calculatedValues
}
}
[TestMethod]
public void BlockArc()
{
ExcelPackage.License.SetNonCommercialPersonal("EPPLUS");
var shDef = PresetShapeDefinitions.ShapeDefinitions[ShapeStyle.BlockArc];
using (var p = new ExcelPackage())
{
var ws = p.Workbook.Worksheets.Add("ws");
var shape = ws.Drawings.AddShape("mMult", eShapeStyle.BlockArc);
shape.SetSize(100, 100);
shDef.Calculate(shape._width, shape._height, shape.TextBody.TextAutofit == eTextAutofit.ShapeAutofit, null, null);
//shDef._calculatedValues
}
}
}
}