User:Minooz/OSD600/FF/test565031

From CDOT Wiki
< User:Minooz‎ | OSD600‎ | FF
Revision as of 21:56, 13 April 2011 by Minooz (talk | contribs)
Jump to: navigation, search

test file:

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=565031
-->
<head>
  <title>Test for Bug 565031</title>
  <script src="/MochiKit/packed.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565031">Mozilla Bug 565031</a>
<p id="display">
<img src="firefoxMap.png" id="image" width="300" usemap="#mapTest" /> 
<map name="mapTest"> 
  <area shape="rect" coords="0,0,80,60" onclick="mapTest('pass', 'comma should be allowed');"/> 
  <area shape="rect" coords="0 70 80 130" onclick="mapTest('pass', 'space should be allowed');"/> 
  <area shape="rect" coords="0;140;80;200" onclick="mapTest('pass', 'semicolon should be allowed');"/>            
  <area shape="rect" coords="220\t0\t300\t60" onclick="mapTest('fail', 'tab should not be allowed');"/> 
  <area shape="rect" coords="220\n70\n300\n130" onclick="mapTest('fail', 'new line should not be allowed');"/> 
  <area shape="rect" coords="220\r140\r300\r200" onclick="mapTest('fail', 'carriage returns should not be allowed');"/>   
</map> 
<div id="content" style="display: none"> 
</div> 
<pre id="test"> 
<script> 
/** Test for Bug 565031 **/
 
  function mapTest(result, message) {
    is(result, "pass", message);
  }
 
  function runTest() {
    SimpleTest.waitForFocus(function() {
      var image = document.getElementById("image");
      synthesizeMouse(image, 50, 30, {});
      synthesizeMouse(image, 50, 100, {});
      synthesizeMouse(image, 50, 160, {});
      synthesizeMouse(image, 250, 30, {});
      synthesizeMouse(image, 250, 100, {});
      synthesizeMouse(image, 250, 160, {});
 
      SimpleTest.finish();
    });
  }
 
  SimpleTest.waitForExplicitFinish();
  addLoadEvent(runTest());
</script> 
</pre> 
</body> 
</html>


dseif test file:

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=565031
-->
<head>
  <title>Test for Bug 565031</title>
  <script src="/MochiKit/packed.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565031">Mozilla Bug 565031</a>
<p id="display">
<map name=a>
  <area coords=0,0,5,5 onclick="is('#pass', '#pass', 'commas,no spaces');">
  <area coords="5 5 10 10" onclick="is('#pass', '#pass', 'spaces only');">
  <area coords=10;10;15;15 onclick="is('#pass', '#pass', 'semicolons, no spaces');">
  <area coords=15	15	20	20 onclick="is('#fail', '#pass', 'tabs only');">
  <area id="test5" coords="20\n20\n25\n25" onclick="is('#fail', '#pass', 'new line characters, no spaces');">
  <area id="test6" coords="25\r25\r30\r30" onclick="is('#fail', '#pass', 'carriage returns, no spaces');">
  <area id="test7" coords="30\v30\v35\v35" onclick="is('#fail', '#pass', 'vertical tabs, no spaces');">
</map>
<img src=file_Dolske.png usemap=#a id=image>
</p>
<div id="content" style="display: none">

</div>
<pre id="test">

<script>
/** Test for Bug 290397 **/
SimpleTest.waitForExplicitFinish();
function tester() {
  var image = document.getElementById("image");
     synthesizeMouse(image, 3, 3, {});  
	synthesizeMouse(image, 7, 7, {});
	synthesizeMouse(image, 13, 13, {});
	synthesizeMouse(image, 17, 17, {});
	synthesizeMouse(image, 23, 23, {});
	synthesizeMouse(image, 27, 27, {});
	synthesizeMouse(image, 33, 33, {});
  SimpleTest.finish();
}

function runTest() {
 //document.getElementById("test5").coords = "20\n20\n25\n25";
 //document.getElementById("test6").coords = "25\r25\r30\r30";
 //document.getElementById("test7").coords = "30\v30\v35\v35";
  SimpleTest.waitForFocus(tester);
}
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>
</html>

dseif applied patch to firefox

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=565031
-->
<head>
  <title>Test for Bug 565031</title>
  <script src="/MochiKit/packed.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565031">Mozilla Bug 565031</a>
<p id="display">
<map name=a>
  <area coords="0,0,5,5" onclick="commas = true;">
  <area coords="5 5 10 10" onclick="spaces = true;">
  <area coords="10;10;15;15" onclick="semicolons = true;">
  <area coords="15	15	20	20" onclick="tabs = true;">
  <!-- Coords dynamically set below for test5,test6, and test7 -->
  <area id="test5" onclick="newline = true;">
  <area id="test6" onclick="carriageReturn = true;">
  <area id="test7" onclick="verticalTabs = true;">
</map>
<img src="file_Dolske.png" usemap="#a" id="image">
</p>
<div id="content" style="display: none">

</div>
<pre id="test">
<script>
  /** Test for Bug 565031 **/

  var commas = false,
      spaces = false,
      semicolons = false,
      tabs = false,
      newline = false,
      carriageReturn = false,
      verticalTabs = false;

  SimpleTest.waitForExplicitFinish();

  function tester() {
    var image = document.getElementById("image");
    synthesizeMouse(image, 3, 3, {});  
    synthesizeMouse(image, 7, 7, {});
    synthesizeMouse(image, 13, 13, {});
    synthesizeMouse(image, 17, 17, {});
    synthesizeMouse(image, 23, 23, {});
    synthesizeMouse(image, 27, 27, {});
    synthesizeMouse(image, 33, 33, {});

    // These test should pass
    ok(commas, "Failed to parse commas.");
    ok(spaces, "Failed to parse spaces");
    ok(semicolons, "Failed to parse semicolons.");

    // The next 4 tests should fail
    ok(!tabs, "Tabs should not be parsed");
    ok(!newline, "Newline characters should not be parsed");
    ok(!carriageReturn, "Carriage returns should not be parsed");
    ok(!verticalTabs, "Vertical tabs should not be parsed");

    SimpleTest.finish();
  }

  function runTest() {
    document.getElementById("test5").coords = "20\n20\n25\n25";
    document.getElementById("test6").coords = "25\r25\r30\r30";
    document.getElementById("test7").coords = "30\v30\v35\v35";

    SimpleTest.waitForFocus(tester);
  }
  addLoadEvent(runTest);
</script>
</pre>
</body>
</html>