| 1 | package detectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/ |
| 2 | |
| 3 | import ( |
| 4 | "reflectscip-go gomod github.com/golang/go/src go1.17 reflect/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.17 testing/" |
| 6 | |
| 7 | "github.com/makiuchi-d/gozxingscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/" |
| 8 | "github.com/makiuchi-d/gozxing/testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/" |
| 9 | ) |
| 10 | |
| 11 | func writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img *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, w, h, l int) { |
| 12 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x, y, w, l) |
| 13 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x, y, l, h) |
| 14 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x+w-l, y, l, h) |
| 15 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(x, y+h-l, w, l) |
| 16 | } |
| 17 | |
| 18 | func TestDetector_Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_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#) { |
| 19 | 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().(60, 60) |
| 20 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 21 | |
| 22 | // bulls eye not found |
| 23 | _, e := det.DetectNoMirrorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#DetectNoMirror().() |
| 24 | if e == nil { |
| 25 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be error") |
| 26 | } |
| 27 | |
| 28 | // extract pattern error (reedsolomon error) |
| 29 | img, _ = 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().(""+ |
| 30 | " \n"+ |
| 31 | " \n"+ |
| 32 | " ###### ## ## \n"+ |
| 33 | " ###################### \n"+ |
| 34 | " ## ## \n"+ |
| 35 | " ## ########## ## \n"+ |
| 36 | " ## ## ## ## \n"+ |
| 37 | " ## ## ## ## ## \n"+ |
| 38 | " ## ## ## ## \n"+ |
| 39 | " ## ########## ## \n"+ |
| 40 | " ## ## \n"+ |
| 41 | " #################### \n"+ |
| 42 | " ## \n"+ |
| 43 | " \n"+ |
| 44 | " \n", |
| 45 | "##", " ") |
| 46 | det = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/.ExpandBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/ExpandBitMatrix().(img, 3)) |
| 47 | _, e = det.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#Detect().(false) |
| 48 | if e == nil { |
| 49 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be error") |
| 50 | } |
| 51 | |
| 52 | img, _ = 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().(""+ |
| 53 | " \n"+ |
| 54 | " \n"+ |
| 55 | " ###### ######## ## \n"+ |
| 56 | " ###################### \n"+ |
| 57 | " #### #### \n"+ |
| 58 | " #### ########## #### \n"+ |
| 59 | " ## ## ## #### \n"+ |
| 60 | " ## ## ## ## ## \n"+ |
| 61 | " #### ## ## ## \n"+ |
| 62 | " #### ########## #### \n"+ |
| 63 | " #### #### \n"+ |
| 64 | " #################### \n"+ |
| 65 | " ###### ###### \n"+ |
| 66 | " \n"+ |
| 67 | " \n", |
| 68 | "##", " ") |
| 69 | det = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/.ExpandBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/ExpandBitMatrix().(img, 3)) |
| 70 | _, e = det.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#Detect().(false) |
| 71 | if e == nil { |
| 72 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detect must be error") |
| 73 | } |
| 74 | |
| 75 | // correct data (compact) |
| 76 | img, _ = 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().(""+ |
| 77 | " ## ## #### ## \n"+ |
| 78 | " ###### ## ###### ##\n"+ |
| 79 | " #### ## ## ## \n"+ |
| 80 | "########################## \n"+ |
| 81 | "#### ## ## \n"+ |
| 82 | " #### ########## ## ## \n"+ |
| 83 | " ## ## ## ## ## \n"+ |
| 84 | " ###### ## ## ## ########\n"+ |
| 85 | " ###### ## ## ## \n"+ |
| 86 | " ###### ########## #### \n"+ |
| 87 | " #### ###### \n"+ |
| 88 | "## #################### ##\n"+ |
| 89 | "## ## ## ## \n"+ |
| 90 | "#### ###### ## ## ##\n"+ |
| 91 | "######## #### #### ## ##\n", |
| 92 | "##", " ") |
| 93 | det = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/.ExpandBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/ExpandBitMatrix().(img, 3)) |
| 94 | r, e := det.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#Detect().(false) |
| 95 | if e != nil { |
| 96 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("detect error: %v", e) |
| 97 | } |
| 98 | if l := r.GetNbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#GetNbLayers().(); l != 1 { |
| 99 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NbLayers = %v, wants 1", l) |
| 100 | } |
| 101 | if n := r.GetNbDatablocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#GetNbDatablocks().(); n != 11 { |
| 102 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NbDatablocks = %v, wants 11", n) |
| 103 | } |
| 104 | if c := r.IsCompactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#IsCompact().(); !c { |
| 105 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("IsCompact = %v, wants true", c) |
| 106 | } |
| 107 | if b := r.GetBitsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetBits().(); !reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.17 reflect/DeepEqual().(b, img) { |
| 108 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("detected img:\n%v\nwants:\n%v", b, img) |
| 109 | } |
| 110 | |
| 111 | // mirrored |
| 112 | det = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/.ExpandBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/ExpandBitMatrix().(testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/.MirrorBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/MirrorBitMatrix().(img), 3)) |
| 113 | r, e = det.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#Detect().(true) |
| 114 | if e != nil { |
| 115 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("detect error: %v", e) |
| 116 | } |
| 117 | if l := r.GetNbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#GetNbLayers().(); l != 1 { |
| 118 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NbLayers = %v, wants 1", l) |
| 119 | } |
| 120 | if n := r.GetNbDatablocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#GetNbDatablocks().(); n != 11 { |
| 121 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NbDatablocks = %v, wants 11", n) |
| 122 | } |
| 123 | if c := r.IsCompactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#IsCompact().(); !c { |
| 124 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("IsCompact = %v, wants true", c) |
| 125 | } |
| 126 | if b := r.GetBitsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetBits().(); !reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.17 reflect/DeepEqual().(b, img) { |
| 127 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("detected img:\n%v\nwants:\n%v", b, img) |
| 128 | } |
| 129 | |
| 130 | // full size |
| 131 | img, _ = 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().(""+ |
| 132 | " #### ## ## ## ######\n"+ |
| 133 | " #### ## ## \n"+ |
| 134 | "## #### #### \n"+ |
| 135 | " ################################## \n"+ |
| 136 | "#### ## ## ##\n"+ |
| 137 | " #### ################## ## ##\n"+ |
| 138 | "## #### ## ## #### \n"+ |
| 139 | " ## ## ########## ## ## ## \n"+ |
| 140 | " #### ## ## ## ## ## ####\n"+ |
| 141 | " ## ## ## ## ## ## ## ## ## \n"+ |
| 142 | " ## ## ## ## ## ## #### \n"+ |
| 143 | "## #### ## ########## ## ###### \n"+ |
| 144 | "## ## ## ## ## ####\n"+ |
| 145 | " ## ## ################## #### \n"+ |
| 146 | "## #### ## ##\n"+ |
| 147 | "#### ############################ \n"+ |
| 148 | "#### ## #### #### \n"+ |
| 149 | " #### ###### #### ## \n"+ |
| 150 | " #### #### ##########\n", |
| 151 | "##", " ") |
| 152 | det = NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(testutilscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/.ExpandBitMatrixscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/testutil`/ExpandBitMatrix().(img, 3)) |
| 153 | r, e = det.Detectscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#Detect().(false) |
| 154 | if e != nil { |
| 155 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("detect error: %v", e) |
| 156 | } |
| 157 | if l := r.GetNbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#GetNbLayers().(); l != 1 { |
| 158 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NbLayers = %v, wants 1", l) |
| 159 | } |
| 160 | if n := r.GetNbDatablocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#GetNbDatablocks().(); n != 10 { |
| 161 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("NbDatablocks = %v, wants 10", n) |
| 162 | } |
| 163 | if c := r.IsCompactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/AztecDetectorResult#IsCompact().(); c { |
| 164 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("IsCompact = %v, wants false", c) |
| 165 | } |
| 166 | if b := r.GetBitsscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/common`/DetectorResult#GetBits().(); !reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.17 reflect/DeepEqual().(b, img) { |
| 167 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("detected img:\n%v\nwants:\n%v", b, img) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func TestDetector_extractParametersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_extractParameters().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 172 | 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().(60, 60) |
| 173 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 174 | |
| 175 | e := det.extractParametersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#extractParameters().([]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#{ |
| 176 | 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().(0, 0), 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().(0, 0), |
| 177 | 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().(0, 0), 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, 80), |
| 178 | }) |
| 179 | if e == nil { |
| 180 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("extractParameters must be error") |
| 181 | } |
| 182 | |
| 183 | // layer5 |
| 184 | writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img, 18, 18, 27, 27, 3) |
| 185 | det.compactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#compact. = true |
| 186 | det.nbCenterLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbCenterLayers. = 5 |
| 187 | points := []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#{ |
| 188 | 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().(46, 16), |
| 189 | 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().(46, 46), |
| 190 | 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().(16, 46), |
| 191 | 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().(16, 16), |
| 192 | } |
| 193 | |
| 194 | // no orientation mark |
| 195 | e = det.extractParametersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#extractParameters().(points) |
| 196 | if e == nil { |
| 197 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("extractParameters must be error") |
| 198 | } |
| 199 | |
| 200 | // orientation mark |
| 201 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(42, 15, 6, 6) |
| 202 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(42, 45, 6, 3) |
| 203 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(18, 45, 3, 3) |
| 204 | // reedsolomon decode error |
| 205 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(45, 21, 3, 3) |
| 206 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(45, 24, 3, 3) |
| 207 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(45, 39, 3, 3) |
| 208 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(15, 36, 3, 3) |
| 209 | e = det.extractParametersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#extractParameters().(points) |
| 210 | if e == nil { |
| 211 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("extractParameters must be error") |
| 212 | } |
| 213 | |
| 214 | // correct param |
| 215 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(45, 30, 3, 9) |
| 216 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(33, 45, 9, 3) |
| 217 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(21, 45, 6, 3) |
| 218 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(15, 33, 3, 9) |
| 219 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(15, 21, 3, 9) |
| 220 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(21, 15, 9, 3) |
| 221 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(36, 15, 6, 3) |
| 222 | e = det.extractParametersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#extractParameters().(points) |
| 223 | if e != nil { |
| 224 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("extractParameters error: %v", e) |
| 225 | } |
| 226 | if det.nbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbLayers. != 3 { |
| 227 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("nbLayers = %v, wants 3", det.nbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbLayers.) |
| 228 | } |
| 229 | if det.nbDataBlocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbDataBlocks. != 32 { |
| 230 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("nbDataBlocks = %v, wants 32", det.nbDataBlocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbDataBlocks.) |
| 231 | } |
| 232 | if det.shiftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#shift. != 0 { |
| 233 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("shift = %v, wants 0", det.shiftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#shift.) |
| 234 | } |
| 235 | |
| 236 | // layer7 |
| 237 | writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img, 12, 12, 39, 39, 3) |
| 238 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 9, 6, 6) |
| 239 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 9, 3, 6) |
| 240 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 48, 3, 3) |
| 241 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(18, 9, 3, 3) |
| 242 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(42, 9, 3, 3) |
| 243 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 18, 3, 3) |
| 244 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 24, 3, 3) |
| 245 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 33, 3, 3) |
| 246 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 45, 3, 3) |
| 247 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(42, 51, 6, 3) |
| 248 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(18, 51, 3, 3) |
| 249 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 45, 3, 3) |
| 250 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 33, 3, 3) |
| 251 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 27, 3, 3) |
| 252 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 18, 3, 3) |
| 253 | det.compactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#compact. = false |
| 254 | det.nbCenterLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbCenterLayers. = 7 |
| 255 | points = []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#{ |
| 256 | 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().(52, 10), |
| 257 | 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().(52, 52), |
| 258 | 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().(10, 52), |
| 259 | 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().(10, 10), |
| 260 | } |
| 261 | e = det.extractParametersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#extractParameters().(points) |
| 262 | if e != nil { |
| 263 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("extractParameters error: %v", e) |
| 264 | } |
| 265 | if det.nbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbLayers. != 9 { |
| 266 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("nbLayers = %v, wants 9", det.nbLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbLayers.) |
| 267 | } |
| 268 | if det.nbDataBlocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbDataBlocks. != 150 { |
| 269 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("nbDataBlocks = %v, wants 150", det.nbDataBlocksscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbDataBlocks.) |
| 270 | } |
| 271 | if det.shiftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#shift. != 3 { |
| 272 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("shift = %v, wants 3", det.shiftscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#shift.) |
| 273 | } |
| 274 | |
| 275 | } |
| 276 | |
| 277 | func TestDetector_getBullsEyeCornersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_getBullsEyeCorners().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 278 | 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().(60, 60) |
| 279 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 280 | _, e := det.getBullsEyeCornersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getBullsEyeCorners().(newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(25, 25)) |
| 281 | if e == nil { |
| 282 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getBullsEyeCorners must be error") |
| 283 | } |
| 284 | |
| 285 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(30, 30, 3, 3) |
| 286 | writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img, 24, 24, 15, 15, 3) |
| 287 | writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img, 18, 18, 27, 27, 3) |
| 288 | writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img, 12, 12, 39, 39, 3) |
| 289 | |
| 290 | // layer=7 |
| 291 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(9, 9, 6, 6) |
| 292 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 9, 3, 6) |
| 293 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(51, 48, 3, 3) |
| 294 | ps, e := det.getBullsEyeCornersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getBullsEyeCorners().(newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(31, 31)) |
| 295 | if e != nil { |
| 296 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getBullsEyeCorners error: %v", e) |
| 297 | } |
| 298 | if det.nbCenterLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbCenterLayers. != 7 { |
| 299 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("nbCenterLayers = %v, wants 7", det.nbCenterLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbCenterLayers.) |
| 300 | } |
| 301 | if det.compactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#compact. { |
| 302 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("compact must false") |
| 303 | } |
| 304 | wants := []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#{ |
| 305 | 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().(52, 10), |
| 306 | 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().(52, 52), |
| 307 | 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().(10, 52), |
| 308 | 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().(10, 10), |
| 309 | } |
| 310 | if !reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.17 reflect/DeepEqual().(ps, wants) { |
| 311 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("corners: %v, wants %v", ps, wants) |
| 312 | } |
| 313 | |
| 314 | // layer=5 |
| 315 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(15, 15, 6, 6) |
| 316 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(45, 15, 3, 6) |
| 317 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(45, 42, 3, 3) |
| 318 | ps, e = det.getBullsEyeCornersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getBullsEyeCorners().(newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(31, 31)) |
| 319 | if e != nil { |
| 320 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getBullsEyeCorners error: %v", e) |
| 321 | } |
| 322 | if det.nbCenterLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbCenterLayers. != 5 { |
| 323 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("nbCenterLayers = %v, wants 5", det.nbCenterLayersscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#nbCenterLayers.) |
| 324 | } |
| 325 | if !det.compactscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#compact. { |
| 326 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("compact must true") |
| 327 | } |
| 328 | wants = []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#{ |
| 329 | 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().(46, 16), |
| 330 | 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().(46, 46), |
| 331 | 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().(16, 46), |
| 332 | 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().(16, 16), |
| 333 | } |
| 334 | if !reflectscip-go gomod github.com/golang/go/src go1.17 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.17 reflect/DeepEqual().(ps, wants) { |
| 335 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("corners: %v, wants %v", ps, wants) |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | func TestDetector_getMatrixCenterscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_getMatrixCenter().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 340 | 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().(60, 60) |
| 341 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 342 | |
| 343 | p := det.getMatrixCenterscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getMatrixCenter().() |
| 344 | ex, ey := 30, 30 |
| 345 | if p.xscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#x. != ex || p.yscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#y. != ey { |
| 346 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getMatrixCenter = %v, wants <%v, %v>", p, ex, ey) |
| 347 | } |
| 348 | |
| 349 | writeFramescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/writeFrame().(img, 10, 10, 30, 30, 3) |
| 350 | p = det.getMatrixCenterscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getMatrixCenter().() |
| 351 | ex, ey = 25, 25 |
| 352 | if p.xscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#x. != ex || p.yscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#y. != ey { |
| 353 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getMatrixCenter = %v, wants <%v, %v>", p, ex, ey) |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | func TestDetector_sampleLinescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_sampleLine().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 358 | img, _ := 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().("## ### #### ## ", "#", " ") |
| 359 | e := 0b1101110111100110 |
| 360 | |
| 361 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 362 | |
| 363 | 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().(0, 0) |
| 364 | 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().(16, 0) |
| 365 | |
| 366 | r := det.sampleLinescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#sampleLine().(p1, p2, 16) |
| 367 | |
| 368 | if r != e { |
| 369 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("sampleLine = %v, wants %v", r, e) |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | func TestDetector_isWhiteOrBlackRectanglescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_isWhiteOrBlackRectangle().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 374 | 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) |
| 375 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(0, 0, 15, 10) |
| 376 | img.SetRegionscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/BitMatrix#SetRegion().(5, 10, 10, 5) |
| 377 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 378 | |
| 379 | tests := []struct { |
| 380 | p1, p2, p3, p4 Pointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point# |
| 381 | wants bool |
| 382 | }{ |
| 383 | //d a |
| 384 | //c b |
| 385 | {newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(20, 0), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(20, 15), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 15), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 0), false}, // p4-p1: 0 |
| 386 | {newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(15, 0), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(15, 20), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 20), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 0), false}, // p1-p2: 0 |
| 387 | {newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(15, 0), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(15, 15), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 15), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 0), false}, // p2-p3: 0 |
| 388 | {newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(17, 0), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(17, 15), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(1, 15), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(1, 0), false}, // p3-p4: 0 |
| 389 | {newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(12, 0), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(12, 12), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 12), newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(0, 0), true}, |
| 390 | } |
| 391 | |
| 392 | for _, test := range tests { |
| 393 | r := det.isWhiteOrBlackRectanglescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#isWhiteOrBlackRectangle().(test.p1, test.p2, test.p3, test.p4) |
| 394 | if r != test.wants { |
| 395 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("isWhiteOrBlackRectangle(%v,%v,%v,%v) = %v, wants %v", |
| 396 | test.p1, test.p2, test.p3, test.p4, r, test.wants) |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | func TestMinMaxscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestMinMax().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 402 | a, b, e := 1, 2, 1 |
| 403 | if r := minscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/min().(a, b); r != e { |
| 404 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("min(%v,%v) = %v, wants %v", a, b, r, e) |
| 405 | } |
| 406 | a, b, e = 2, 1, 1 |
| 407 | if r := minscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/min().(a, b); r != e { |
| 408 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("min(%v,%v) = %v, wants %v", a, b, r, e) |
| 409 | } |
| 410 | a, b, e = 1, 2, 2 |
| 411 | if r := maxscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/max().(a, b); r != e { |
| 412 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("max(%v,%v) = %v, wants %v", a, b, r, e) |
| 413 | } |
| 414 | a, b, e = 2, 1, 2 |
| 415 | if r := maxscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/max().(a, b); r != e { |
| 416 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("max(%v,%v) = %v, wants %v", a, b, r, e) |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | func TestDetector_getColorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_getColor().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 421 | img, _ := 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().(""+ |
| 422 | "################ \n"+ |
| 423 | "############### \n"+ |
| 424 | "############### \n"+ |
| 425 | "############### \n"+ |
| 426 | "########### \n"+ |
| 427 | "########### \n"+ |
| 428 | " \n", |
| 429 | "#", " ") |
| 430 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 431 | |
| 432 | tests := []struct { |
| 433 | x1, y1, x2, y2 int |
| 434 | wants int |
| 435 | }{ |
| 436 | {0, 0, 0, 0, 0}, |
| 437 | {0, 0, 13, 5, 1}, |
| 438 | {0, 0, 14, 5, 0}, |
| 439 | {15, 0, 26, 5, -1}, |
| 440 | } |
| 441 | |
| 442 | for _, test := range tests { |
| 443 | p1 := newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(test.x1, test.y1) |
| 444 | p2 := newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(test.x2, test.y2) |
| 445 | r := det.getColorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getColor().(p1, p2) |
| 446 | if r != test.wants { |
| 447 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getColor(%v,%v) = %v, wants %v", p1, p2, r, test.wants) |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | func TestDetector_getFirstDifferentscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_getFirstDifferent().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 453 | img, _ := 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().(""+ |
| 454 | " \n"+ |
| 455 | " ##### # \n"+ |
| 456 | " ##### # \n"+ |
| 457 | " ##### # \n"+ |
| 458 | " ##### # \n"+ |
| 459 | " ####### \n"+ |
| 460 | " # \n"+ |
| 461 | " ####### \n"+ |
| 462 | " \n"+ |
| 463 | " \n", |
| 464 | "#", " ") |
| 465 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 466 | |
| 467 | p := det.getFirstDifferentscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getFirstDifferent().(newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(1, 1), true, 1, 1) |
| 468 | ex, ey := 7, 7 |
| 469 | if p.xscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#x. != ex || p.yscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#y. != ey { |
| 470 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getFirstDifferent(1,1) = {%v,%v}, wants {%v,%v}", p.xscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#x., p.yscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#y., ex, ey) |
| 471 | } |
| 472 | p = det.getFirstDifferentscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#getFirstDifferent().(newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(2, 2), true, 2, 2) |
| 473 | ex, ey = 4, 4 |
| 474 | if p.xscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#x. != ex || p.yscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#y. != ey { |
| 475 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("getFirstDifferent(2,2) = {%v,%v}, wants {%v,%v}", p.xscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#x., p.yscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#y., ex, ey) |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | func TestExpandSquarescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestExpandSquare().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 480 | ps := []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#{ |
| 481 | 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().(10, -10), |
| 482 | 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().(10, 10), |
| 483 | 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().(-10, 10), |
| 484 | 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().(-10, -10), |
| 485 | } |
| 486 | |
| 487 | rps := expandSquarescip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/expandSquare().(ps, 2, 3) |
| 488 | |
| 489 | ratio := 1.5 |
| 490 | |
| 491 | for i := range rps { |
| 492 | rx, ry := rps[i].GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.(), rps[i].GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.() |
| 493 | ex, ey := ps[i].GetXscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetX.()*ratio, ps[i].GetYscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing`/ResultPoint#GetY.()*ratio |
| 494 | |
| 495 | if rx != ex || ry != ey { |
| 496 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("point[%v] = {%v, %v}, wants {%v, %v}", i, rx, ry, ex, ey) |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | func TestDetector_isValidPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestDetector_isValidPoint().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 502 | 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().(10, 10) |
| 503 | det := NewDetectorscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/NewDetector().(img) |
| 504 | |
| 505 | tests := []struct { |
| 506 | x, y float64 |
| 507 | expect bool |
| 508 | }{ |
| 509 | {-1, 0, false}, |
| 510 | {0, -1, false}, |
| 511 | {0, 0, true}, |
| 512 | {9.4, 9.4, true}, |
| 513 | {9.5, 9.5, false}, |
| 514 | } |
| 515 | |
| 516 | for _, test := range tests { |
| 517 | p := 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().(test.x, test.y) |
| 518 | r := det.isValidPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Detector#isValidPoint().(p) |
| 519 | if r != test.expect { |
| 520 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Detecotr.isValidPoint({%v,%v}) = %v, wants %v", test.x, test.y, r, test.expect) |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | func TestPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/TestPoint().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 526 | p := newPointscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/newPoint().(3, 5) |
| 527 | s := p.Stringscip-go gomod github.com/makiuchi-d/gozxing . `github.com/makiuchi-d/gozxing/aztec/detector`/Point#String().() |
| 528 | e := "<3 5>" |
| 529 | if s != e { |
| 530 | t.Fatalfscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatalf().("Point(3,5).String() = %q, expect %q", s, e) |
| 531 | } |
| 532 | } |