diff --git a/pkg/pdf/pdf_test.go b/pkg/pdf/pdf_test.go index cf15c0a1..8fd0eaf1 100644 --- a/pkg/pdf/pdf_test.go +++ b/pkg/pdf/pdf_test.go @@ -322,7 +322,7 @@ func TestPdfMaroto_Text(t *testing.T) { "One text inside one column, inside a row, without props", func(t *testing.T, text *mocks.Text) { text.AssertNumberOfCalls(t, "Add", 1) - text.AssertCalled(t, "Add", "Text1", internal.Cell{0.0, 0.0, 80.0, 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) + text.AssertCalled(t, "Add", "Text1", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) }, func(m pdf.Maroto) { m.Row(40, func() { @@ -336,8 +336,8 @@ func TestPdfMaroto_Text(t *testing.T) { "Two different text inside one colum, inside one row", func(t *testing.T, text *mocks.Text) { text.AssertNumberOfCalls(t, "Add", 2) - text.AssertCalled(t, "Add", "Text2", internal.Cell{0.0, 0.0, 80.0, 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) - text.AssertCalled(t, "Add", "Text3", internal.Cell{0.0, 5.0, 80.0, 0.0}, props.Text{Family: consts.Courier, Style: consts.BoldItalic, Align: consts.Center, Top: 5.0, Extrapolate: false, Size: 9.5}) + text.AssertCalled(t, "Add", "Text2", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) + text.AssertCalled(t, "Add", "Text3", internal.Cell{X: 0.0, Y: 5.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Courier, Style: consts.BoldItalic, Align: consts.Center, Top: 5.0, Extrapolate: false, Size: 9.5}) }, func(m pdf.Maroto) { m.Row(40, func() { @@ -358,8 +358,8 @@ func TestPdfMaroto_Text(t *testing.T) { "Two different text with different columns, inside one row", func(t *testing.T, text *mocks.Text) { text.AssertNumberOfCalls(t, "Add", 2) - text.AssertCalled(t, "Add", "Text4", internal.Cell{0.0, 0.0, 80.0, 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) - text.AssertCalled(t, "Add", "Text5", internal.Cell{80.0, 4.4, 80.0, 0.0}, props.Text{Family: consts.Helvetica, Style: consts.Italic, Align: consts.Center, Top: 4.4, Extrapolate: false, Size: 8.5}) + text.AssertCalled(t, "Add", "Text4", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) + text.AssertCalled(t, "Add", "Text5", internal.Cell{X: 80.0, Y: 4.4, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Helvetica, Style: consts.Italic, Align: consts.Center, Top: 4.4, Extrapolate: false, Size: 8.5}) }, func(m pdf.Maroto) { m.Row(40, func() { @@ -382,8 +382,8 @@ func TestPdfMaroto_Text(t *testing.T) { "Two different text with different columns, inside one row", func(t *testing.T, text *mocks.Text) { text.AssertNumberOfCalls(t, "Add", 2) - text.AssertCalled(t, "Add", "Text6", internal.Cell{0.0, 0.0, 80.0, 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) - text.AssertCalled(t, "Add", "Text7", internal.Cell{0.0, 40.0, 80.0, 0.0}, props.Text{Family: consts.Courier, Style: consts.BoldItalic, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 9.5}) + text.AssertCalled(t, "Add", "Text6", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Arial, Style: consts.Normal, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 10.0}) + text.AssertCalled(t, "Add", "Text7", internal.Cell{X: 0.0, Y: 40.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Courier, Style: consts.BoldItalic, Align: consts.Left, Top: 0.0, Extrapolate: false, Size: 9.5}) }, func(m pdf.Maroto) { m.Row(40, func() { @@ -406,7 +406,7 @@ func TestPdfMaroto_Text(t *testing.T) { "When top is greater than row height", func(t *testing.T, text *mocks.Text) { text.AssertNumberOfCalls(t, "Add", 1) - text.AssertCalled(t, "Add", "Text8", internal.Cell{0.0, 40.0, 80.0, 0.0}, props.Text{Family: consts.Arial, Align: consts.Left, Top: 40.0, Extrapolate: false, Size: 10.0}) + text.AssertCalled(t, "Add", "Text8", internal.Cell{X: 0.0, Y: 40.0, Width: 80.0, Height: 0.0}, props.Text{Family: consts.Arial, Align: consts.Left, Top: 40.0, Extrapolate: false, Size: 10.0}) }, func(m pdf.Maroto) { m.Row(40, func() { @@ -452,7 +452,7 @@ func TestPdfMaroto_FileImage(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromFile", 1) - image.AssertCalled(t, "AddFromFile", "Image1", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image1", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 100.0, @@ -476,13 +476,13 @@ func TestPdfMaroto_FileImage(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromFile", 2) - image.AssertCalled(t, "AddFromFile", "Image2", internal.Cell{0.0, 4.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image2", internal.Cell{X: 0.0, Y: 4.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 2, Top: 4, Percent: 40, Center: false, }) - image.AssertCalled(t, "AddFromFile", "Image3", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image3", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 40, @@ -514,13 +514,13 @@ func TestPdfMaroto_FileImage(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromFile", 2) - image.AssertCalled(t, "AddFromFile", "Image4", internal.Cell{0.0, 4.5, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image4", internal.Cell{X: 0.0, Y: 4.5, Width: 80.0, Height: 20.0}, props.Rect{ Left: 4, Top: 4.5, Percent: 55, Center: false, }) - image.AssertCalled(t, "AddFromFile", "Image5", internal.Cell{80.0, 0.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image5", internal.Cell{X: 80.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 53, @@ -554,13 +554,13 @@ func TestPdfMaroto_FileImage(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromFile", 2) - image.AssertCalled(t, "AddFromFile", "Image6", internal.Cell{0.0, 8.5, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image6", internal.Cell{X: 0.0, Y: 8.5, Width: 80.0, Height: 20.0}, props.Rect{ Left: 7, Top: 8.5, Percent: 66, Center: false, }) - image.AssertCalled(t, "AddFromFile", "Image7", internal.Cell{0.0, 20.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromFile", "Image7", internal.Cell{X: 0.0, Y: 20.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 98, @@ -622,7 +622,7 @@ func TestPdfMaroto_Base64Image(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromBase64", 1) - image.AssertCalled(t, "AddFromBase64", "Image1", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image1", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 100, @@ -646,13 +646,13 @@ func TestPdfMaroto_Base64Image(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromBase64", 2) - image.AssertCalled(t, "AddFromBase64", "Image2", internal.Cell{0.0, 4.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image2", internal.Cell{X: 0.0, Y: 4.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 2, Top: 4, Percent: 40, Center: false, }, consts.Png) - image.AssertCalled(t, "AddFromBase64", "Image3", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image3", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 40, @@ -684,13 +684,13 @@ func TestPdfMaroto_Base64Image(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromBase64", 2) - image.AssertCalled(t, "AddFromBase64", "Image4", internal.Cell{0.0, 4.5, 40.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image4", internal.Cell{X: 0.0, Y: 4.5, Width: 40.0, Height: 20.0}, props.Rect{ Left: 4, Top: 4.5, Percent: 55, Center: false, }, consts.Png) - image.AssertCalled(t, "AddFromBase64", "Image5", internal.Cell{40.0, 0.0, 40.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image5", internal.Cell{X: 40.0, Y: 0.0, Width: 40.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 53, @@ -724,13 +724,13 @@ func TestPdfMaroto_Base64Image(t *testing.T) { }, func(t *testing.T, image *mocks.Image) { image.AssertNumberOfCalls(t, "AddFromBase64", 2) - image.AssertCalled(t, "AddFromBase64", "Image6", internal.Cell{0.0, 8.5, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image6", internal.Cell{X: 0.0, Y: 8.5, Width: 80.0, Height: 20.0}, props.Rect{ Left: 7, Top: 8.5, Percent: 66, Center: false, }, consts.Png) - image.AssertCalled(t, "AddFromBase64", "Image7", internal.Cell{0.0, 20.0, 80.0, 20.0}, props.Rect{ + image.AssertCalled(t, "AddFromBase64", "Image7", internal.Cell{X: 0.0, Y: 20.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 0, Top: 0, Percent: 98, @@ -792,7 +792,7 @@ func TestPdfMaroto_QrCode(t *testing.T) { }, func(t *testing.T, code *mocks.Code) { code.AssertNumberOfCalls(t, "AddQr", 1) - code.AssertCalled(t, "AddQr", "Code1", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Rect{Percent: 100, Center: false}) + code.AssertCalled(t, "AddQr", "Code1", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{Percent: 100, Center: false}) }, func(m pdf.Maroto) { m.Row(20, func() { @@ -811,12 +811,12 @@ func TestPdfMaroto_QrCode(t *testing.T) { }, func(t *testing.T, code *mocks.Code) { code.AssertNumberOfCalls(t, "AddQr", 2) - code.AssertCalled(t, "AddQr", "Code2", internal.Cell{0.0, 4.0, 80.0, 20.0}, props.Rect{ + code.AssertCalled(t, "AddQr", "Code2", internal.Cell{X: 0.0, Y: 4.0, Width: 80.0, Height: 20.0}, props.Rect{ Left: 2.0, Top: 4.0, Percent: 40.0, }) - code.AssertCalled(t, "AddQr", "Code3", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Rect{ + code.AssertCalled(t, "AddQr", "Code3", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Rect{ Percent: 40.0, Center: true, }) @@ -846,12 +846,12 @@ func TestPdfMaroto_QrCode(t *testing.T) { }, func(t *testing.T, code *mocks.Code) { code.AssertNumberOfCalls(t, "AddQr", 2) - code.AssertCalled(t, "AddQr", "Code4", internal.Cell{0.0, 4.5, 40.0, 20.0}, props.Rect{ + code.AssertCalled(t, "AddQr", "Code4", internal.Cell{X: 0.0, Y: 4.5, Width: 40.0, Height: 20.0}, props.Rect{ Left: 4.0, Top: 4.5, Percent: 55.0, }) - code.AssertCalled(t, "AddQr", "Code5", internal.Cell{40.0, 0.0, 40.0, 20.0}, props.Rect{ + code.AssertCalled(t, "AddQr", "Code5", internal.Cell{X: 40.0, Y: 0.0, Width: 40.0, Height: 20.0}, props.Rect{ Percent: 53.0, Center: true, }) @@ -883,12 +883,12 @@ func TestPdfMaroto_QrCode(t *testing.T) { }, func(t *testing.T, code *mocks.Code) { code.AssertNumberOfCalls(t, "AddQr", 2) - code.AssertCalled(t, "AddQr", "Code6", internal.Cell{0.0, 8.5, 80.0, 20.0}, props.Rect{ + code.AssertCalled(t, "AddQr", "Code6", internal.Cell{X: 0.0, Y: 8.5, Width: 80.0, Height: 20.0}, props.Rect{ Left: 7.0, Top: 8.5, Percent: 66.0, }) - code.AssertCalled(t, "AddQr", "Code7", internal.Cell{0.0, 20.0, 80.0, 20.0}, props.Rect{ + code.AssertCalled(t, "AddQr", "Code7", internal.Cell{X: 0.0, Y: 20.0, Width: 80.0, Height: 20.0}, props.Rect{ Percent: 98.0, Center: true, }) @@ -948,7 +948,7 @@ func TestPdfMaroto_Barcode(t *testing.T) { }, func(t *testing.T, code *mocks.Code) { code.AssertNumberOfCalls(t, "AddBar", 1) - code.AssertCalled(t, "AddBar", "Code1", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Barcode{Percent: 100, Center: false, Proportion: props.Proportion{Width: 1, Height: 0.2}}) + code.AssertCalled(t, "AddBar", "Code1", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Barcode{Percent: 100, Center: false, Proportion: props.Proportion{Width: 1, Height: 0.2}}) }, func(m pdf.Maroto) { m.Row(20, func() { @@ -967,13 +967,13 @@ func TestPdfMaroto_Barcode(t *testing.T) { }, func(t *testing.T, code *mocks.Code) { code.AssertNumberOfCalls(t, "AddBar", 2) - code.AssertCalled(t, "AddBar", "Code2", internal.Cell{0.0, 4.0, 80.0, 20.0}, props.Barcode{ + code.AssertCalled(t, "AddBar", "Code2", internal.Cell{X: 0.0, Y: 4.0, Width: 80.0, Height: 20.0}, props.Barcode{ Left: 2.0, Top: 4.0, Percent: 40.0, Proportion: props.Proportion{Width: 1, Height: 0.2}, }) - code.AssertCalled(t, "AddBar", "Code3", internal.Cell{0.0, 0.0, 80.0, 20.0}, props.Barcode{ + code.AssertCalled(t, "AddBar", "Code3", internal.Cell{X: 0.0, Y: 0.0, Width: 80.0, Height: 20.0}, props.Barcode{ Percent: 40.0, Center: true, Proportion: props.Proportion{Width: 1, Height: 0.2},