diff --git a/qr/encoder_test.go b/qr/encoder_test.go index d56f139..9304faf 100644 --- a/qr/encoder_test.go +++ b/qr/encoder_test.go @@ -1,6 +1,10 @@ package qr import ( + "fmt" + "github.com/boombuler/barcode" + "image/png" + "os" "testing" ) @@ -52,3 +56,20 @@ func Test_Encode(t *testing.T) { } } } + +func ExampleEncode() { + f, _ := os.Create("qrcode.png") + defer f.Close() + + qrcode, err := Encode("hello world", L, Auto) + if err != nil { + fmt.Println(err) + } else { + qrcode, err = barcode.Scale(qrcode, 100, 100) + if err != nil { + fmt.Println(err) + } else { + png.Encode(f, qrcode) + } + } +}