Debian Codegraph @

debian/patches/use_local_image_for_test.patch

raw symbols SCIP
1 From: Maytham Alsudany <[email protected]>
2 Bug-Debian: https://bugs.debian.org/1068497
3 Forwarded: no
4 Subject: Use local image for test
5
6 --- a/decode_encode_test.go
7 +++ b/decode_encode_test.go
8 @@ -8,7 +8,6 @@
9 "image/jpeg"
10 "io/ioutil"
11 "log"
12 - "net/http"
13 "os"
14 "os/exec"
15 "testing"
16 @@ -16,7 +15,6 @@
17
18 const (
19 // a random 683x1024 441kb image
20 - imageUrl = "https://farm1.staticflickr.com/47/139138903_3d9600174d_b_d.jpg"
21 localFileName = "test.jpg"
22 saveResized = false
23 )
24 @@ -30,12 +28,6 @@
25 )
26
27 func init() {
28 - // download test file if doesn't exist
29 - if !PathExists(localFileName) {
30 - d := httpDl(imageUrl)
31 - err := ioutil.WriteFile(localFileName, d, 0644)
32 - panicIfErr(err)
33 - }
34 d, err := ioutil.ReadFile(localFileName)
35 if err != nil {
36 log.Fatalf("ReadFile() failed with %q\n", err)
37 @@ -53,15 +45,6 @@
38 imgCmyk = convertAndLoad("cmyk")
39 }
40
41 -func httpDl(uri string) []byte {
42 - res, err := http.Get(uri)
43 - panicIfErr(err)
44 - d, err := ioutil.ReadAll(res.Body)
45 - res.Body.Close()
46 - panicIfErr(err)
47 - return d
48 -}
49 -
50 // treats any error (e.g. lack of access due to permissions) as non-existence
51 func PathExists(path string) bool {
52 _, err := os.Stat(path)