content/xul/templates/tests/chrome/test_bug476634.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xul/templates/tests/chrome/test_bug476634.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,76 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet 
     1.7 +  href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.8 +  type="text/css"?>
     1.9 +<!--
    1.10 +https://bugzilla.mozilla.org/show_bug.cgi?id=476634
    1.11 +-->
    1.12 +<window title="Mozilla Bug 476634" onload="startup()"
    1.13 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.14 +
    1.15 +  <script type="application/javascript" 
    1.16 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    1.17 +
    1.18 +<body  xmlns="http://www.w3.org/1999/xhtml">
    1.19 +<a target="_blank" 
    1.20 +   href="https://bugzilla.mozilla.org/show_bug.cgi?id=304188">Mozilla Bug 476634</a>
    1.21 +<p id="display"></p>
    1.22 +<div id="content" style="display: none">
    1.23 +</div>
    1.24 +<pre id="test">
    1.25 +</pre>
    1.26 +</body>
    1.27 +<template id="test-template">
    1.28 +  <query>SELECT id,value FROM test</query>
    1.29 +  <action>
    1.30 +    <label uri="?" id="?id" value="?value"/>
    1.31 +  </action>
    1.32 +</template>
    1.33 +<vbox id="results-list" datasources="rdf:null" querytype="storage" ref="*"
    1.34 +      template="test-template"/>
    1.35 +
    1.36 +<script class="testbody" type="application/javascript">
    1.37 +<![CDATA[
    1.38 +function startup() {
    1.39 +  var ss = Components.classes["@mozilla.org/storage/service;1"]
    1.40 +                     .getService(Components.interfaces.mozIStorageService);
    1.41 +  var db = ss.openSpecialDatabase("memory");
    1.42 +  
    1.43 +  db.createTable("test", "id TEXT, value INTEGER");
    1.44 +  var stmt = db.createStatement("INSERT INTO test (id, value) VALUES (?,?)");
    1.45 +  stmt.bindStringParameter(0, "test1");
    1.46 +  stmt.bindInt32Parameter(1, 0);
    1.47 +  stmt.execute();
    1.48 +  stmt.bindStringParameter(0, "test2");
    1.49 +  stmt.bindInt32Parameter(1, 2147483647);
    1.50 +  stmt.execute();
    1.51 +  stmt.bindStringParameter(0, "test3");
    1.52 +  stmt.bindInt32Parameter(1, -2147483648);
    1.53 +  stmt.execute();
    1.54 +  stmt.bindStringParameter(0, "test4");
    1.55 +  stmt.bindInt64Parameter(1, 0);
    1.56 +  stmt.execute();
    1.57 +  stmt.bindStringParameter(0, "test5");
    1.58 +  stmt.bindInt64Parameter(1, 3147483647);
    1.59 +  stmt.execute();
    1.60 +  stmt.bindStringParameter(0, "test6");
    1.61 +  stmt.bindInt64Parameter(1, -3147483648);
    1.62 +  stmt.execute();
    1.63 +  stmt.finalize();
    1.64 +
    1.65 +  var list = document.getElementById("results-list");
    1.66 +  list.builder.datasource = db;
    1.67 +
    1.68 +  is(list.childNodes.length, 6, "Should be 6 generated elements");
    1.69 +  is(list.childNodes[0].value, "0", "Should have seen the correct value");
    1.70 +  is(list.childNodes[1].value, "2147483647", "Should have seen the correct value");
    1.71 +  is(list.childNodes[2].value, "-2147483648", "Should have seen the correct value");
    1.72 +  is(list.childNodes[3].value, "0", "Should have seen the correct value");
    1.73 +  is(list.childNodes[4].value, "3147483647", "Should have seen the correct value");
    1.74 +  is(list.childNodes[5].value, "-3147483648", "Should have seen the correct value");
    1.75 +}
    1.76 +]]>
    1.77 +</script>
    1.78 +
    1.79 +</window>

mercurial