summaryrefslogtreecommitdiffstats
path: root/toolkit/content/tests/widgets/test_image_recognition_unsupported.html
blob: f67ea8eb00e74ad52b2328a85e53999d9fb1f3ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE HTML>
<html>
<head>
  <title>Image recognition unsupported</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="text/javascript" src="head.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>

<div id="content">
  <img src="image.png" />
</div>

<pre id="test">
<script class="testbody">
  /**
   * This test is for platforms that do not support text recognition.
   */
  add_task(async () => {
    const img = document.querySelector("#content img");

    info("Recognizing the current image text is not supported on this platform.");
    try {
      await SpecialPowers.wrap(img).recognizeCurrentImageText();
      ok(false, "Recognizing the text should not be supported.");
    } catch (error) {
      ok(error, "Expected unsupported message: " + error.message);
    }
  });
</script>
</pre>
</body>
</html>