| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
| 5 <script src="resources/mock-barcodedetection.js"></script> | 5 <script src="resources/mock-barcodedetection.js"></script> |
| 6 <script src="resources/mock-facedetection.js"></script> | 6 <script src="resources/mock-facedetection.js"></script> |
| 7 <script src="resources/mock-textdetection.js"></script> | 7 <script src="resources/mock-textdetection.js"></script> |
| 8 <body> | 8 <body> |
| 9 <img id="img" src="../media/content/greenbox.png"/> | 9 <img id="img" src="../media/content/greenbox.png"/> |
| 10 </body> | 10 </body> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 }); | 39 }); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 function FaceDetectorDetectionResultTest(detectionResult, mock) { | 42 function FaceDetectorDetectionResultTest(detectionResult, mock) { |
| 43 const imageReceivedByMock = mock.getFrameData(); | 43 const imageReceivedByMock = mock.getFrameData(); |
| 44 assert_equals(imageReceivedByMock.byteLength, 2500, "Image length"); | 44 assert_equals(imageReceivedByMock.byteLength, 2500, "Image length"); |
| 45 const GREEN_PIXEL = 0xFF00FF00; | 45 const GREEN_PIXEL = 0xFF00FF00; |
| 46 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color"); | 46 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color"); |
| 47 assert_equals(detectionResult.length, 3, "Number of faces"); | 47 assert_equals(detectionResult.length, 3, "Number of faces"); |
| 48 assert_equals(detectionResult[0].landmarks.length, 1, "Number of landmarks"); |
| 49 assert_object_equals(detectionResult[0].landmarks[0], |
| 50 {type : 'eye', location : {x : 4.0, y : 5.0}}, |
| 51 "landmark #1"); |
| 48 } | 52 } |
| 49 | 53 |
| 50 function BarcodeDetectorDetectionResultTest(detectionResult, mock) { | 54 function BarcodeDetectorDetectionResultTest(detectionResult, mock) { |
| 51 assert_equals(detectionResult.length, 2, "Number of barcodes"); | 55 assert_equals(detectionResult.length, 2, "Number of barcodes"); |
| 52 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); | 56 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); |
| 53 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); | 57 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); |
| 54 } | 58 } |
| 55 | 59 |
| 56 function TextDetectorDetectionResultTest(detectionResult, mock) { | 60 function TextDetectorDetectionResultTest(detectionResult, mock) { |
| 57 assert_equals(detectionResult.length, 2, "Number of textBlocks"); | 61 assert_equals(detectionResult.length, 2, "Number of textBlocks"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 ], | 80 ], |
| 77 [ | 81 [ |
| 78 "Text - detect(HTMLImageElement)", | 82 "Text - detect(HTMLImageElement)", |
| 79 () => { return new TextDetector(); }, | 83 () => { return new TextDetector(); }, |
| 80 () => { return mockTextDetectionReady; }, | 84 () => { return mockTextDetectionReady; }, |
| 81 TextDetectorDetectionResultTest | 85 TextDetectorDetectionResultTest |
| 82 ] | 86 ] |
| 83 ]); | 87 ]); |
| 84 | 88 |
| 85 </script> | 89 </script> |
| OLD | NEW |