example

package
v2.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package example provides some helper routines for the test packages of gofpdf and its various contributed packages located beneath the contrib directory.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filename

func Filename(baseStr string) string

Filename returns a qualified filename in which the example PDF directory path is prepended and the suffix ".pdf" is appended to the specified filename.

Example

ExampleFilename tests the Filename() and Summary() functions.

package main

import (
	"errors"

	"github.com/jung-kurt/gofpdf/internal/example"
)

func main() {
	fileStr := example.Filename("example")
	example.Summary(errors.New("printer on fire"), fileStr)
}
Output:

printer on fire

func FontDir

func FontDir() string

FontDir returns the path to the font directory.

func FontFile

func FontFile(fileStr string) string

FontFile returns a qualified filename in which the path to the font directory is prepended to the specified filename.

func ImageFile

func ImageFile(fileStr string) string

ImageFile returns a qualified filename in which the path to the image directory is prepended to the specified filename.

func PdfDir

func PdfDir() string

PdfDir returns the path to the PDF output directory.

func PdfFile

func PdfFile(fileStr string) string

PdfFile returns a qualified filename in which the path to the PDF output directory is prepended to the specified filename.

func Summary

func Summary(err error, fileStr string)

Summary generates a predictable report for use by test examples. If the specified error is nil, the filename delimiters are normalized and the filename printed to standard output with a success message. If the specified error is not nil, its String() value is printed to standard output.

func SummaryCompare

func SummaryCompare(err error, fileStr string)

SummaryCompare generates a predictable report for use by test examples. If the specified error is nil, the generated file is compared with a reference copy for byte-for-byte equality. If the files match, then the filename delimiters are normalized and the filename printed to standard output with a success message. If the files do not match, this condition is reported on standard output. If the specified error is not nil, its String() value is printed to standard output.

func TextFile

func TextFile(fileStr string) string

TextFile returns a qualified filename in which the path to the text directory is prepended to the specified filename.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL