| 1 | package detectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/ |
| 2 | |
| 3 | import ( |
| 4 | "mathscip-go gomod github.com/golang/go/src go1.17 math/" |
| 5 | "reflectscip-go gomod github.com/golang/go/src go1.17 reflect/" |
| 6 | "testingscip-go gomod github.com/golang/go/src go1.17 testing/" |
| 7 | |
| 8 | "github.com/makiuchi-d/gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/" |
| 9 | ) |
| 10 | |
| 11 | func makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image *gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.BitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#, x, y int) { |
| 12 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x-2, y-2, 5, 5) |
| 13 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, x-1, y-1, 3, 3) |
| 14 | image.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(x, y) |
| 15 | } |
| 16 | |
| 17 | func makeAlignPattern3scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern3().(image *gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.BitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#, x, y int) { |
| 18 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x-7, y-7, 15, 15) |
| 19 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, x-4, y-4, 9, 9) |
| 20 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x-1, y-1, 3, 3) |
| 21 | } |
| 22 | func makePattern3scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern3().(image *gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.BitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#, x, y int) { |
| 23 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x-10, y-10, 21, 21) |
| 24 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, x-7, y-7, 15, 15) |
| 25 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x-4, y-4, 9, 9) |
| 26 | } |
| 27 | |
| 28 | func TestNewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestNewDetector().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 29 | image, _ := 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().(10, 10) |
| 30 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 31 | |
| 32 | if r := d.GetImagescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#GetImage().(); r != image { |
| 33 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("GetImage returns %p, expect %p", r, image) |
| 34 | } |
| 35 | |
| 36 | if r := d.GetResultPointCallbackscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#GetResultPointCallback().(); r != nil { |
| 37 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("GetResultPointCallback must be nil") |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func TestDetector_findAlingmentInReagionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_findAlingmentInReagion().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 42 | image, _ := 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().(10, 10) |
| 43 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 44 | |
| 45 | _, e := d.findAlignmentInRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#findAlignmentInRegion().(5, 10, 10, 3) |
| 46 | 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 { |
| 47 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("findAlignmentInRegion must be NotFoundException") |
| 48 | } |
| 49 | |
| 50 | image, _ = 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, 10) |
| 51 | d = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 52 | _, e = d.findAlignmentInRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#findAlignmentInRegion().(5, 10, 10, 3) |
| 53 | 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 { |
| 54 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("findAlignmentInRegion must be NotFoundException") |
| 55 | } |
| 56 | |
| 57 | image, _ = 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().(40, 40) |
| 58 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(5, 5, 30, 30) |
| 59 | |
| 60 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, 7, 7, 6, 6) |
| 61 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 9, 2, 2) |
| 62 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, 28, 20, 6, 6) |
| 63 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(30, 22, 2, 2) |
| 64 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, 15, 28, 6, 6) |
| 65 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(17, 30, 2, 2) |
| 66 | |
| 67 | d = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 68 | ap, e := d.findAlignmentInRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#findAlignmentInRegion().(2, 28, 30, 8) |
| 69 | |
| 70 | if e != nil { |
| 71 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("findAlignmentInRegion returns error: %v", e) |
| 72 | } |
| 73 | |
| 74 | ex := NewAlignmentPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewAlignmentPattern().(31, 23, 2) |
| 75 | if ap.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != ex.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() || ap.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != ex.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() || ap.estimatedModuleSizescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/AlignmentPattern#estimatedModuleSize. != ex.estimatedModuleSizescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/AlignmentPattern#estimatedModuleSize. { |
| 76 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("findAlignmentInRegion returns %v, expect %v", ap, ex) |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | func TestDetector_sizeOfBlackWhiteBlackRunscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_sizeOfBlackWhiteBlackRun().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 81 | image, _ := 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) |
| 82 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 83 | |
| 84 | s := d.sizeOfBlackWhiteBlackRunscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRun().(5, 3, 18, 10) |
| 85 | if !mathscip-go gomod github.com/golang/go/src go1.17 math/.IsNaNscip-go gomod github.com/golang/go/src go1.17 math/IsNaN().(s) { |
| 86 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size must be NaN, %v", s) |
| 87 | } |
| 88 | |
| 89 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 0, 4, 20) |
| 90 | s = d.sizeOfBlackWhiteBlackRunscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRun().(5, 3, 17, 12) |
| 91 | if s != 10 { |
| 92 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size must be 10, %v", s) |
| 93 | } |
| 94 | |
| 95 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 96 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(0, 10, 20, 4) |
| 97 | s = d.sizeOfBlackWhiteBlackRunscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRun().(12, 17, 3, 5) |
| 98 | if s != 10 { |
| 99 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size must be 10, %v", s) |
| 100 | } |
| 101 | |
| 102 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 103 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(5, 3, 1, 1) |
| 104 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(16, 11, 2, 2) |
| 105 | s = d.sizeOfBlackWhiteBlackRunscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRun().(5, 3, 16, 12) |
| 106 | if s != 15 { |
| 107 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size must be 15, %v", s) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func TestDetector_sizeOfBlackWhiteBlackRunBothWaysscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_sizeOfBlackWhiteBlackRunBothWays().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 112 | image, _ := 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().(30, 30) |
| 113 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 114 | |
| 115 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(16, 0, 3, 30) |
| 116 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(12, 0, 3, 30) |
| 117 | s := d.sizeOfBlackWhiteBlackRunBothWaysscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRunBothWays().(15, 15, 27, 24) // otherTo=(3,6) |
| 118 | if s != 9 { |
| 119 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 9", s) |
| 120 | } |
| 121 | |
| 122 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 123 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(16-10, 0, 3, 30) |
| 124 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(12-10, 0, 3, 30) |
| 125 | s = d.sizeOfBlackWhiteBlackRunBothWaysscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRunBothWays().(15-10, 15-10, 27-10, 24-10) |
| 126 | if s != 9 { |
| 127 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 9", s) |
| 128 | } |
| 129 | |
| 130 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 131 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(16+10, 0, 3, 30) |
| 132 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(12+10, 0, 3, 30) |
| 133 | s = d.sizeOfBlackWhiteBlackRunBothWaysscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRunBothWays().(15+10, 15+10, 3+10, 6+10) |
| 134 | if s != 9 { |
| 135 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 9", s) |
| 136 | } |
| 137 | |
| 138 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 139 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(0, 16-5, 30, 3) |
| 140 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(0, 12-5, 30, 3) |
| 141 | s = d.sizeOfBlackWhiteBlackRunBothWaysscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRunBothWays().(15-5, 15-5, 24-5, 27-5) |
| 142 | if s != 9 { |
| 143 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 9", s) |
| 144 | } |
| 145 | |
| 146 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 147 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(0, 16+5, 30, 3) |
| 148 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(0, 12+5, 30, 3) |
| 149 | s = d.sizeOfBlackWhiteBlackRunBothWaysscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#sizeOfBlackWhiteBlackRunBothWays().(15+5, 15+5, 6+5, 3+5) |
| 150 | if s != 9 { |
| 151 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 9", s) |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | func TestDetector_calculateModuleSizeOneWayscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_calculateModuleSizeOneWay().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 156 | image, _ := 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().(100, 100) |
| 157 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 20, 3) |
| 158 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 80, 20, 3) |
| 159 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 160 | |
| 161 | p1 := 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, 20) |
| 162 | p2 := 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().(80, 20) |
| 163 | |
| 164 | s := d.calculateModuleSizeOneWayscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#calculateModuleSizeOneWay().(p1, p2) |
| 165 | if s != 3 { |
| 166 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 3", s) |
| 167 | } |
| 168 | |
| 169 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 170 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 20, 4) |
| 171 | s = d.calculateModuleSizeOneWayscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#calculateModuleSizeOneWay().(p1, p2) |
| 172 | if s != 4 { |
| 173 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 4", s) |
| 174 | } |
| 175 | |
| 176 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 177 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 80, 2) |
| 178 | p2 = 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, 80) |
| 179 | s = d.calculateModuleSizeOneWayscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#calculateModuleSizeOneWay().(p1, p2) |
| 180 | if s != 2 { |
| 181 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 2", s) |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | func TestDetector_calculateModuleSizescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_calculateModuleSize().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 186 | image, _ := 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().(100, 100) |
| 187 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 20, 4) |
| 188 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 80, 5) |
| 189 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 80, 20, 3) |
| 190 | |
| 191 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 192 | topLeft := 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, 20) |
| 193 | topRight := 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().(80, 20) |
| 194 | bottomLeft := 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, 80) |
| 195 | |
| 196 | s := d.calculateModuleSizescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#calculateModuleSize().(topLeft, topRight, bottomLeft) |
| 197 | if s != 4 { |
| 198 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("size = %v, expect 4", s) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | func TestDetector_computeDimensionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_computeDimension().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 203 | image, _ := 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().(100, 100) |
| 204 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 205 | topLeft := 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, 20) |
| 206 | topRight := 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().(80, 20) |
| 207 | bottomLeft := 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, 80) // dimension %4 = 1 |
| 208 | |
| 209 | r, e := d.computeDimensionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#computeDimension().(topLeft, topRight, bottomLeft, 2) |
| 210 | if e != nil { |
| 211 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension returns error, %v", e) |
| 212 | } |
| 213 | if r != 37 { |
| 214 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension returns %v, expect 37", r) |
| 215 | } |
| 216 | |
| 217 | bottomLeft = 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, 75) // dimension %4 = 0 |
| 218 | r, e = d.computeDimensionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#computeDimension().(topLeft, topRight, bottomLeft, 2) |
| 219 | if e != nil { |
| 220 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension returns error, %v", e) |
| 221 | } |
| 222 | if r != 37 { |
| 223 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension returns %v, expect 37", r) |
| 224 | } |
| 225 | |
| 226 | bottomLeft = 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, 85) // dimension %4 = 2 |
| 227 | r, e = d.computeDimensionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#computeDimension().(topLeft, topRight, bottomLeft, 2) |
| 228 | if e != nil { |
| 229 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension returns error, %v", e) |
| 230 | } |
| 231 | if r != 37 { |
| 232 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension returns %v, expect 37", r) |
| 233 | } |
| 234 | |
| 235 | bottomLeft = 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, 72) // dimension %4 = 3 |
| 236 | _, e = d.computeDimensionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#computeDimension().(topLeft, topRight, bottomLeft, 2) |
| 237 | if e == nil { |
| 238 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension must be error") |
| 239 | } |
| 240 | 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 { |
| 241 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("computeDimension must be NotFoundException, %v", e) |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | func TestDetector_createTransformscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_createTransform().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 246 | |
| 247 | topLeft := 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, 20) |
| 248 | topRight := 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, 80) |
| 249 | bottomLeft := 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().(80, 20) |
| 250 | alignmentPattern := NewAlignmentPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewAlignmentPattern().(75, 75, 1) |
| 251 | |
| 252 | transform := Detector_createTransformscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector_createTransform().(topLeft, topRight, bottomLeft, alignmentPattern, 1) |
| 253 | v := reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.17 reflect/ValueOf().(transform).Elemscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Elem().() |
| 254 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a11").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -31.5 { |
| 255 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a11 = %v, expect -31.5", r) |
| 256 | } |
| 257 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a21").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -328.5 { |
| 258 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a21 = %v, expect -328.5", r) |
| 259 | } |
| 260 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a31").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 1665 { |
| 261 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a31 = %v, expect 1665", r) |
| 262 | } |
| 263 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a12").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -328.5 { |
| 264 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a12 = %v, expect -328.5", r) |
| 265 | } |
| 266 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a22").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -31.5 { |
| 267 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a22 = %v, expect -31.5", r) |
| 268 | } |
| 269 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a32").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 1665 { |
| 270 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a32 = %v, expect 1665", r) |
| 271 | } |
| 272 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a13").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -1.575 { |
| 273 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a13 = %v, expect -1.575", r) |
| 274 | } |
| 275 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a23").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -1.575 { |
| 276 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a23 = %v, expect -1.575", r) |
| 277 | } |
| 278 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a33").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 31.275 { |
| 279 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a33 = %v, expect 31.275", r) |
| 280 | } |
| 281 | |
| 282 | topLeft = 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, 50) |
| 283 | topRight = 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().(50, 20) |
| 284 | bottomLeft = 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().(50, 80) |
| 285 | transform = Detector_createTransformscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector_createTransform().(topLeft, topRight, bottomLeft, nil, 2) |
| 286 | |
| 287 | v = reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.17 reflect/ValueOf().(transform).Elemscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Elem().() |
| 288 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a11").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -150 { |
| 289 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a11 = %v, expect -150", r) |
| 290 | } |
| 291 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a21").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -150 { |
| 292 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a21 = %v, expect -150", r) |
| 293 | } |
| 294 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a31").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 1550 { |
| 295 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a31 = %v, expect 1550", r) |
| 296 | } |
| 297 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a12").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 150 { |
| 298 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a12 = %v, expect 150", r) |
| 299 | } |
| 300 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a22").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != -150 { |
| 301 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a22 = %v, expect -150", r) |
| 302 | } |
| 303 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a32").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 1250 { |
| 304 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a32 = %v, expect 1250", r) |
| 305 | } |
| 306 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a13").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 0 { |
| 307 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a13 = %v, expect 0", r) |
| 308 | } |
| 309 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a23").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 0 { |
| 310 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a23 = %v, expect 0", r) |
| 311 | } |
| 312 | if r := v.FieldByNamescip-go gomod github.com/golang/go/src go1.17 reflect/Value#FieldByName().("a33").Floatscip-go gomod github.com/golang/go/src go1.17 reflect/Value#Float().(); r != 25 { |
| 313 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("transform.a33 = %v, expect 25", r) |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | func TestDetector_ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_ProcessFinderPatternInfo().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 318 | image, _ := 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().(300, 300) |
| 319 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 320 | |
| 321 | // too small patterns |
| 322 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(18, 18, 5, 5) |
| 323 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, 19, 19, 3, 3) |
| 324 | image.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(20, 20) |
| 325 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(28, 18, 5, 5) |
| 326 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, 29, 19, 3, 3) |
| 327 | image.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(30, 20) |
| 328 | image.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(18, 28, 5, 5) |
| 329 | unsetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/unsetRegion().(image, 19, 29, 3, 3) |
| 330 | image.Setscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Set().(20, 30) |
| 331 | info := FinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#{ |
| 332 | topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft.: NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(20, 20, 1), |
| 333 | topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight.: NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(30, 20, 1), |
| 334 | bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft.: NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(20, 30, 1), |
| 335 | } |
| 336 | _, e := d.ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#ProcessFinderPatternInfo().(&info) |
| 337 | if e == nil { |
| 338 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be error") |
| 339 | } |
| 340 | 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 { |
| 341 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be NotFoundException, %v", e) |
| 342 | } |
| 343 | // dimension error |
| 344 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 345 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 20, 1) |
| 346 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 80, 1) |
| 347 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 72, 20, 1) |
| 348 | info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(20, 80, 1) |
| 349 | info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(72, 20, 1) |
| 350 | _, e = d.ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#ProcessFinderPatternInfo().(&info) |
| 351 | if e == nil { |
| 352 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be error") |
| 353 | } |
| 354 | 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 { |
| 355 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be NotFoundException, %v", e) |
| 356 | } |
| 357 | |
| 358 | // version error |
| 359 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 360 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 20, 1) |
| 361 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 270, 1) |
| 362 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 270, 20, 1) |
| 363 | info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(20, 270, 1) |
| 364 | info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(270, 20, 1) |
| 365 | _, e = d.ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#ProcessFinderPatternInfo().(&info) |
| 366 | if e == nil { |
| 367 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be error") |
| 368 | } |
| 369 | if _, ok := e.(gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.FormatExceptionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/FormatException#); !ok { |
| 370 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be FormatException, %v", e) |
| 371 | } |
| 372 | |
| 373 | // no alignment patterns |
| 374 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 375 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 20, 1) |
| 376 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 35, 20, 1) |
| 377 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 20, 35, 1) |
| 378 | info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(20, 20, 1) |
| 379 | info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(35, 20, 1) |
| 380 | info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(20, 35, 1) |
| 381 | r, e := d.ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#ProcessFinderPatternInfo().(&info) |
| 382 | if e != nil { |
| 383 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo returns error, %v", e) |
| 384 | } |
| 385 | if c := len(r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()); c != 3 { |
| 386 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points has %v members, expect 3", c) |
| 387 | } |
| 388 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[0]; p != info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. { |
| 389 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[0] is not bottomLeft (%p, %p)", p, info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft.) |
| 390 | } |
| 391 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[1]; p != info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft. { |
| 392 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[0] is not topLeft (%p, %p)", p, info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft.) |
| 393 | } |
| 394 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[2]; p != info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. { |
| 395 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[0] is not topRight (%p, %p)", p, info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight.) |
| 396 | } |
| 397 | |
| 398 | // with alignment patterns |
| 399 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 400 | // version 7 pattern |
| 401 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 13, 13, 1) |
| 402 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 13+38, 13, 1) |
| 403 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 13, 13+38, 1) |
| 404 | info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(13, 13, 1) |
| 405 | info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(13+38, 13, 1) |
| 406 | info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(13, 13+38, 1) |
| 407 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+6, 10+22) |
| 408 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+22, 10+6) |
| 409 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+22, 10+22) |
| 410 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+22, 10+38) |
| 411 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+38, 10+22) |
| 412 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+38, 10+38) |
| 413 | r, e = d.ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#ProcessFinderPatternInfo().(&info) |
| 414 | if e != nil { |
| 415 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo returns error, %v", e) |
| 416 | } |
| 417 | if c := len(r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()); c != 4 { |
| 418 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points has %v members, expect 4", c) |
| 419 | } |
| 420 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[0]; p != info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. { |
| 421 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[0] is not bottomLeft (%p, %p)", p, info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft.) |
| 422 | } |
| 423 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[1]; p != info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft. { |
| 424 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[1] is not topLeft (%p, %p)", p, info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft.) |
| 425 | } |
| 426 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[2]; p != info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. { |
| 427 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[2] is not topRight (%p, %p)", p, info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight.) |
| 428 | } |
| 429 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[3]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 48.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 48.5 { |
| 430 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("alignmentPattern is (%v,%v), expect (48.5,48.5)", 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.()) |
| 431 | } |
| 432 | |
| 433 | // grid sampler fail |
| 434 | image.Clearscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Clear().() |
| 435 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 290, 20, 1) |
| 436 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 250, 60, 1) |
| 437 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 290, 100, 1) |
| 438 | info.topLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(250, 60, 1) |
| 439 | info.topRightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#topRight. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(290, 20, 1) |
| 440 | info.bottomLeftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/FinderPatternInfo#bottomLeft. = NewFinderPattern1scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewFinderPattern1().(290, 100, 1) |
| 441 | r, e = d.ProcessFinderPatternInfoscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#ProcessFinderPatternInfo().(&info) |
| 442 | if e == nil { |
| 443 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be error") |
| 444 | } |
| 445 | 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 { |
| 446 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("ProcessFinderPatternInfo must be NotFoundException, %v", e) |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | func TestDetector_DetectWithHintscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_DetectWithHint().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 451 | cbpoints := make([]gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.ResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#, 0) |
| 452 | callback := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.ResultPointCallbackscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPointCallback#(func(p gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.ResultPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#) { |
| 453 | cbpoints = append(cbpoints, p) |
| 454 | }) |
| 455 | |
| 456 | hints := make(map[gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.DecodeHintTypescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/DecodeHintType#]interface{}) |
| 457 | hints[gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.DecodeHintType_NEED_RESULT_POINT_CALLBACKscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/DecodeHintType_NEED_RESULT_POINT_CALLBACK.] = callback |
| 458 | |
| 459 | // version3 pattern |
| 460 | image, _ := 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().(45, 45) |
| 461 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 10+3, 10+3, 1) |
| 462 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 10+3+22, 10+3, 1) |
| 463 | makePatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern().(image, 10+3, 10+3+22, 1) |
| 464 | makeAlignPatternscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern().(image, 10+22, 10+22) |
| 465 | |
| 466 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 467 | r, e := d.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#Detect().(hints) |
| 468 | if e != nil { |
| 469 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect returns error, %v", e) |
| 470 | } |
| 471 | if len(cbpoints) != 4 { |
| 472 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Callback count is %v, expect 4", len(cbpoints)) |
| 473 | } |
| 474 | |
| 475 | // bottomLeft |
| 476 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[0]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 13.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 35.5 { |
| 477 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[0] = (%v,%v), expect (13.5,35.5)", 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.()) |
| 478 | } |
| 479 | // topLeft |
| 480 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[1]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 13.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 13.5 { |
| 481 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[1] = (%v,%v), expect (13.5,13.5)", 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.()) |
| 482 | } |
| 483 | // topRight |
| 484 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[2]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 35.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 13.5 { |
| 485 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[2] = (%v,%v), expect (35.5,13.5)", 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.()) |
| 486 | } |
| 487 | // alignment pattern |
| 488 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[3]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 32.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 32.5 { |
| 489 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[3] = (%v,%v), expect (32.5,32.5)", 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.()) |
| 490 | } |
| 491 | |
| 492 | for _, p := range cbpoints { |
| 493 | if !(p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() == 13.5 && p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() == 35.5) && // bottomLeft |
| 494 | !(p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() == 13.5 && p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() == 13.5) && // topLeft |
| 495 | !(p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() == 35.5 && p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() == 13.5) && // topRight |
| 496 | !(p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() == 32.5 && p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() == 32.5) { // alignmentPattern |
| 497 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("invalid callbacked point (%v,%v)", 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.()) |
| 498 | } |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | func TestDetector_DetectWithoutHintscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/TestDetector_DetectWithoutHint().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 503 | |
| 504 | image, _ := 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().(120, 120) |
| 505 | |
| 506 | d := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/NewDetector().(image) |
| 507 | _, e := d.DetectWithoutHintsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#DetectWithoutHints().() |
| 508 | if e == nil { |
| 509 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("DetectWithoutHints must be error") |
| 510 | } |
| 511 | 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 { |
| 512 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("DetectWithoutHints must be NotFoundException, %v", e) |
| 513 | } |
| 514 | |
| 515 | // version3 pattern, transformed, x3 |
| 516 | makePattern3scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern3().(image, 20, 20) |
| 517 | makePattern3scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern3().(image, 96, 21) |
| 518 | makePattern3scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makePattern3().(image, 22, 97) |
| 519 | makeAlignPattern3scip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/makeAlignPattern3().(image, 89, 88) |
| 520 | r, e := d.DetectWithoutHintsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/qrcode/detector`/Detector#DetectWithoutHints().() |
| 521 | if e != nil { |
| 522 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect returns error, %v", e) |
| 523 | } |
| 524 | |
| 525 | // bottomLeft |
| 526 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[0]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 22.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 97.5 { |
| 527 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[0] = (%v,%v), expect (22.5,97.5)", 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.()) |
| 528 | } |
| 529 | // topLeft |
| 530 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[1]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 20.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 20.5 { |
| 531 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[1] = (%v,%v), expect (20.5,20.5)", 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.()) |
| 532 | } |
| 533 | // topRight |
| 534 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[2]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 96.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 21.5 { |
| 535 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[2] = (%v,%v), expect (96.5,21.5)", 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.()) |
| 536 | } |
| 537 | // alignment pattern |
| 538 | if p := r.GetPointsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetPoints().()[3]; p.GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.() != 89.5 || p.GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() != 88.5 { |
| 539 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("points[3] = (%v,%v), expect (32.5,32.5)", 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.()) |
| 540 | } |
| 541 | |
| 542 | bits := r.GetBitsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetBits().() |
| 543 | normalizedstr := "" + |
| 544 | "X X X X X X X X X X X X X X \n" + |
| 545 | "X X X X \n" + |
| 546 | "X X X X X X X X X X \n" + |
| 547 | "X X X X X X X X X X \n" + |
| 548 | "X X X X X X X X X X \n" + |
| 549 | "X X X X \n" + |
| 550 | "X X X X X X X X X X X X X X \n" + |
| 551 | " \n" + |
| 552 | " \n" + |
| 553 | " \n" + |
| 554 | " \n" + |
| 555 | " \n" + |
| 556 | " \n" + |
| 557 | " \n" + |
| 558 | " \n" + |
| 559 | " \n" + |
| 560 | " \n" + |
| 561 | " \n" + |
| 562 | " \n" + |
| 563 | " \n" + |
| 564 | " \n" + |
| 565 | " \n" + |
| 566 | " \n" + |
| 567 | " \n" + |
| 568 | " X X X X X \n" + |
| 569 | " X X \n" + |
| 570 | "X X X X X X X X X X \n" + |
| 571 | "X X X X \n" + |
| 572 | "X X X X X X X X X X \n" + |
| 573 | "X X X X X \n" + |
| 574 | "X X X X X \n" + |
| 575 | "X X \n" + |
| 576 | "X X X X X X X \n" |
| 577 | |
| 578 | normalized, _ := gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/.ParseStringToBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ParseStringToBitMatrix().(normalizedstr, "X ", " ") |
| 579 | |
| 580 | if normalized.GetWidthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetWidth().() != bits.GetWidthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetWidth().() || normalized.GetHeightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetHeight().() != bits.GetHeightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetHeight().() { |
| 581 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("bits = %vx%v, normalized = %vx%v", |
| 582 | bits.GetWidthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetWidth().(), bits.GetHeightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetHeight().(), normalized.GetWidthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetWidth().(), normalized.GetHeightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetHeight().()) |
| 583 | } |
| 584 | |
| 585 | for j := 0; j < bits.GetHeightscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetHeight().(); j++ { |
| 586 | for i := 0; i < bits.GetWidthscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#GetWidth().(); i++ { |
| 587 | if bits.Getscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Get().(i, j) != normalized.Getscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Get().(i, j) { |
| 588 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("bits[%v,%v] = %v, expect %v", i, j, bits.Getscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Get().(i, j), normalized.Getscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#Get().(i, j)) |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | } |