| 1 | package detectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.17 testing/" |
| 5 | |
| 6 | "github.com/makiuchi-d/gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/" |
| 7 | ) |
| 8 | |
| 9 | func TestNewWhiteRectangleDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/TestNewWhiteRectangleDetector().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 10 | img, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewBitMatrix().(20, 20) |
| 11 | |
| 12 | _, e := NewWhiteRectangleDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetector().(img, 10, 3, 3) |
| 13 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 14 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NewWhiteRectangleDetector must be NotFoundException, %T", e) |
| 15 | } |
| 16 | |
| 17 | detector, e := NewWhiteRectangleDetectorFromImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetectorFromImage().(img) |
| 18 | if e != nil { |
| 19 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NewWhiteRectangleDetectorFromImage returns error, %v", e) |
| 20 | } |
| 21 | if detector.imagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#image. != img { |
| 22 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("image != img, %p, %p", detector.imagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#image., img) |
| 23 | } |
| 24 | if detector.widthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#width. != 20 || detector.heightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#height. != 20 { |
| 25 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("width,height = %v,%v, expect 20, 20", detector.widthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#width., detector.heightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#height.) |
| 26 | } |
| 27 | if detector.leftInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#leftInit. != 5 || detector.rightInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#rightInit. != 15 || detector.upInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#upInit. != 5 || detector.downInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#downInit. != 15 { |
| 28 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("init = %v,%v,%v,%v, expect 5,15,5,15", |
| 29 | detector.leftInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#leftInit., detector.rightInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#rightInit., detector.upInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#upInit., detector.downInitscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#downInit.) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | func TestWhiterectangledetector_getBlackPointOnSegmentscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/TestWhiterectangledetector_getBlackPointOnSegment().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 34 | img, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewBitMatrix().(20, 20) |
| 35 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(10, 10) |
| 36 | detector, _ := NewWhiteRectangleDetectorFromImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetectorFromImage().(img) |
| 37 | |
| 38 | p := detector.getBlackPointOnSegmentscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#getBlackPointOnSegment().(5, 8, 15, 12) |
| 39 | if p == nil { |
| 40 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getBlackPointOnSegment returns nil") |
| 41 | } |
| 42 | if x, y := p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.(); x != 10 || y != 10 { |
| 43 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getBlackPointOnSegment = %v,%v, expect 10,10", x, y) |
| 44 | } |
| 45 | |
| 46 | p = detector.getBlackPointOnSegmentscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#getBlackPointOnSegment().(5, 8, 15, 10) |
| 47 | if p != nil { |
| 48 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getBlackPointOnSegment must be nil, %v", p) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestWhiterectangledetector_centerEdgesscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/TestWhiterectangledetector_centerEdges().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 53 | img, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewBitMatrix().(25, 25) |
| 54 | decoder, _ := NewWhiteRectangleDetectorFromImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetectorFromImage().(img) |
| 55 | |
| 56 | t0 := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(15, 3) |
| 57 | z0 := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(3, 5) |
| 58 | x0 := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(20, 10) |
| 59 | y0 := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(5, 20) |
| 60 | |
| 61 | edges := decoder.centerEdgesscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#centerEdges().(y0, z0, x0, t0) |
| 62 | |
| 63 | if p := edges[0]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 14 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 4 { |
| 64 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[0] = (%v,%v), expect (14,4)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 65 | } |
| 66 | if p := edges[1]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 4 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 6 { |
| 67 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[1] = (%v,%v), expect (4,6)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 68 | } |
| 69 | if p := edges[2]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 19 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 9 { |
| 70 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[2] = (%v,%v), expect (19,9)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 71 | } |
| 72 | if p := edges[3]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 6 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 19 { |
| 73 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[3] = (%v,%v), expect (6,19)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 74 | } |
| 75 | |
| 76 | t0 = gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(5, 3) |
| 77 | z0 = gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(3, 15) |
| 78 | x0 = gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(20, 5) |
| 79 | y0 = gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewResultPoint().(15, 20) |
| 80 | |
| 81 | edges = decoder.centerEdgesscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#centerEdges().(y0, z0, x0, t0) |
| 82 | |
| 83 | if p := edges[0]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 6 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 4 { |
| 84 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[0] = (%v,%v), expect (6,4)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 85 | } |
| 86 | if p := edges[1]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 4 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 14 { |
| 87 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[1] = (%v,%v), expect (4,14)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 88 | } |
| 89 | if p := edges[2]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 19 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 6 { |
| 90 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[2] = (%v,%v), expect (19,6)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 91 | } |
| 92 | if p := edges[3]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 14 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 19 { |
| 93 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("edges[3] = (%v,%v), expect (14,19)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func TestWhiterectangledetector_containsBlackPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/TestWhiterectangledetector_containsBlackPoint().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 98 | img, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewBitMatrix().(20, 20) |
| 99 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(10, 10) |
| 100 | detector, _ := NewWhiteRectangleDetectorFromImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetectorFromImage().(img) |
| 101 | |
| 102 | if !detector.containsBlackPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#containsBlackPoint().(5, 15, 10, true) { |
| 103 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("containsBlackPoint(5, 15, 10, true) must be true") |
| 104 | } |
| 105 | |
| 106 | if !detector.containsBlackPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#containsBlackPoint().(5, 15, 10, false) { |
| 107 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("containsBlackPoint(5, 15, 10, false) must be true") |
| 108 | } |
| 109 | |
| 110 | if detector.containsBlackPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#containsBlackPoint().(5, 15, 5, true) { |
| 111 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("containsBlackPoint(5, 15, 5, true) must be false") |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | func TestWhiterectangledetector_Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/TestWhiterectangledetector_Detect().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 116 | img, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewBitMatrix().(20, 20) |
| 117 | detector, _ := NewWhiteRectangleDetectorFromImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetectorFromImage().(img) |
| 118 | |
| 119 | _, e := detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 120 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 121 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 122 | } |
| 123 | |
| 124 | // right |
| 125 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(18, 10) |
| 126 | |
| 127 | _, e = detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 128 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 129 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 130 | } |
| 131 | |
| 132 | // bottom |
| 133 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(14, 18) |
| 134 | |
| 135 | _, e = detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 136 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 137 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 138 | } |
| 139 | |
| 140 | // left |
| 141 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(3, 15) |
| 142 | |
| 143 | _, e = detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 144 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 145 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 146 | } |
| 147 | |
| 148 | // up |
| 149 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(8, 3) |
| 150 | |
| 151 | points, e := detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 152 | if e != nil { |
| 153 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect returns error, %v", e) |
| 154 | } |
| 155 | |
| 156 | // t |
| 157 | if p := points[0]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 9 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 4 { |
| 158 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect points[0] = (%v,%v), expect (9,4)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 159 | } |
| 160 | // z |
| 161 | if p := points[1]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 4 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 14 { |
| 162 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect points[1] = (%v,%v), expect (4,14)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 163 | } |
| 164 | // x |
| 165 | if p := points[2]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 17 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 11 { |
| 166 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect points[2] = (%v,%v), expect (17,11)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 167 | } |
| 168 | // y |
| 169 | if p := points[3]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 13 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 17 { |
| 170 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect points[3] = (%v,%v), expect (13,17)", p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()) |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | func TestWhiterectangledetector_DetectFailscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/TestWhiterectangledetector_DetectFail().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 175 | img, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NewBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NewBitMatrix().(20, 20) |
| 176 | detector, _ := NewWhiteRectangleDetectorFromImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/NewWhiteRectangleDetectorFromImage().(img) |
| 177 | |
| 178 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(5, 5) |
| 179 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(15, 15) |
| 180 | |
| 181 | // z not found |
| 182 | _, e := detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 183 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 184 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 185 | } |
| 186 | |
| 187 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(7, 12) |
| 188 | |
| 189 | // x not found |
| 190 | _, e = detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 191 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 192 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 193 | } |
| 194 | |
| 195 | img.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 196 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(5, 15) |
| 197 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(15, 5) |
| 198 | |
| 199 | // t not found |
| 200 | _, e = detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 201 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 202 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 203 | } |
| 204 | |
| 205 | // y not found |
| 206 | img.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(6, 6) |
| 207 | _, e = detector.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common/detector`/WhiteRectangleDetector#Detect().() |
| 208 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.NotFoundExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/NotFoundException#); !ok { |
| 209 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be NotFoundException, %T", e) |
| 210 | } |
| 211 | } |