summaryrefslogtreecommitdiff
path: root/sheet_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-07-07 00:17:15 +0800
committerGitHub <noreply@github.com>2019-07-07 00:17:15 +0800
commit14d490c83d9744e635c88bca9018994dfe8981af (patch)
treecbbb733b3ad9f16980393d14060a6babd7911d1b /sheet_test.go
parente14d2febc880f5dc0a8352f9f57af5ac3a9d37f5 (diff)
Add unit test for SetPageLayout
Diffstat (limited to 'sheet_test.go')
-rw-r--r--sheet_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/sheet_test.go b/sheet_test.go
index 3a7f579..ef795ad 100644
--- a/sheet_test.go
+++ b/sheet_test.go
@@ -23,6 +23,8 @@ func ExampleFile_SetPageLayout() {
if err := f.SetPageLayout(
"Sheet1",
excelize.PageLayoutPaperSize(10),
+ excelize.FitToHeight(2),
+ excelize.FitToWidth(2),
); err != nil {
panic(err)
}
@@ -34,6 +36,8 @@ func ExampleFile_GetPageLayout() {
var (
orientation excelize.PageLayoutOrientation
paperSize excelize.PageLayoutPaperSize
+ fitToHeight excelize.FitToHeight
+ fitToWidth excelize.FitToWidth
)
if err := f.GetPageLayout("Sheet1", &orientation); err != nil {
panic(err)
@@ -41,13 +45,24 @@ func ExampleFile_GetPageLayout() {
if err := f.GetPageLayout("Sheet1", &paperSize); err != nil {
panic(err)
}
+ if err := f.GetPageLayout("Sheet1", &fitToHeight); err != nil {
+ panic(err)
+ }
+
+ if err := f.GetPageLayout("Sheet1", &fitToWidth); err != nil {
+ panic(err)
+ }
fmt.Println("Defaults:")
fmt.Printf("- orientation: %q\n", orientation)
fmt.Printf("- paper size: %d\n", paperSize)
+ fmt.Printf("- fit to height: %d\n", fitToHeight)
+ fmt.Printf("- fit to width: %d\n", fitToWidth)
// Output:
// Defaults:
// - orientation: "portrait"
// - paper size: 1
+ // - fit to height: 1
+ // - fit to width: 1
}
func TestPageLayoutOption(t *testing.T) {
@@ -59,6 +74,8 @@ func TestPageLayoutOption(t *testing.T) {
}{
{new(excelize.PageLayoutOrientation), excelize.PageLayoutOrientation(excelize.OrientationLandscape)},
{new(excelize.PageLayoutPaperSize), excelize.PageLayoutPaperSize(10)},
+ {new(excelize.FitToHeight), excelize.FitToHeight(2)},
+ {new(excelize.FitToWidth), excelize.FitToWidth(2)},
}
for i, test := range testData {