aboutsummaryrefslogtreecommitdiff
path: root/pic/pic_test.go
AgeCommit message (Collapse)Author
2024-09-15pic: perbaikan path imporShulhan
Bagian kode yang mengimpor "tour" harusnya mengacu ke modul ini.
2020-05-08pic: don't make a string copy when writing imageDmitri Shuralyov
Previously, the entire image was encoded into a buffer, then encoded to a base64 string, which was concatenated with another string, and written to stdout in one swoop. We can do this more efficiently by writing the PNG image to a base64 encoder directly, and using buffered I/O to batch writes to stdout into moderately-sized chunks. As an added bonus, though really the main motivation for doing this optimization now, this helps avoid triggering the golang/go#38751 issue on the Go Playground. Switch to the best compression level instead of the default, reducing encoded image size at the cost of extra computation. Playground snippets need to be transferred over the network and kept in storage, so it should be a favorable trade-off. This CL was based on CL 232177. For golang/go#38751. Change-Id: I565fe538aa15910caaff98be156ac64b0d35fff4 Co-authored-by: Alexander Rakoczy <alex@golang.org> Reviewed-on: https://go-review.googlesource.com/c/tour/+/232867 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
2020-05-08pic: add a testDmitri Shuralyov
It's hard to write a normal test because ShowImage writes to os.Stdout unconditionally. Add an example test instead. Change-Id: I52e02908e94aa212a05c058edb4f504851b5bb8d Reviewed-on: https://go-review.googlesource.com/c/tour/+/232866 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>