|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet |
|
4 href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
5 type="text/css"?> |
|
6 <!-- |
|
7 https://bugzilla.mozilla.org/show_bug.cgi?id=476634 |
|
8 --> |
|
9 <window title="Mozilla Bug 476634" onload="startup()" |
|
10 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
14 |
|
15 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
16 <a target="_blank" |
|
17 href="https://bugzilla.mozilla.org/show_bug.cgi?id=304188">Mozilla Bug 476634</a> |
|
18 <p id="display"></p> |
|
19 <div id="content" style="display: none"> |
|
20 </div> |
|
21 <pre id="test"> |
|
22 </pre> |
|
23 </body> |
|
24 <template id="test-template"> |
|
25 <query>SELECT id,value FROM test</query> |
|
26 <action> |
|
27 <label uri="?" id="?id" value="?value"/> |
|
28 </action> |
|
29 </template> |
|
30 <vbox id="results-list" datasources="rdf:null" querytype="storage" ref="*" |
|
31 template="test-template"/> |
|
32 |
|
33 <script class="testbody" type="application/javascript"> |
|
34 <![CDATA[ |
|
35 function startup() { |
|
36 var ss = Components.classes["@mozilla.org/storage/service;1"] |
|
37 .getService(Components.interfaces.mozIStorageService); |
|
38 var db = ss.openSpecialDatabase("memory"); |
|
39 |
|
40 db.createTable("test", "id TEXT, value INTEGER"); |
|
41 var stmt = db.createStatement("INSERT INTO test (id, value) VALUES (?,?)"); |
|
42 stmt.bindStringParameter(0, "test1"); |
|
43 stmt.bindInt32Parameter(1, 0); |
|
44 stmt.execute(); |
|
45 stmt.bindStringParameter(0, "test2"); |
|
46 stmt.bindInt32Parameter(1, 2147483647); |
|
47 stmt.execute(); |
|
48 stmt.bindStringParameter(0, "test3"); |
|
49 stmt.bindInt32Parameter(1, -2147483648); |
|
50 stmt.execute(); |
|
51 stmt.bindStringParameter(0, "test4"); |
|
52 stmt.bindInt64Parameter(1, 0); |
|
53 stmt.execute(); |
|
54 stmt.bindStringParameter(0, "test5"); |
|
55 stmt.bindInt64Parameter(1, 3147483647); |
|
56 stmt.execute(); |
|
57 stmt.bindStringParameter(0, "test6"); |
|
58 stmt.bindInt64Parameter(1, -3147483648); |
|
59 stmt.execute(); |
|
60 stmt.finalize(); |
|
61 |
|
62 var list = document.getElementById("results-list"); |
|
63 list.builder.datasource = db; |
|
64 |
|
65 is(list.childNodes.length, 6, "Should be 6 generated elements"); |
|
66 is(list.childNodes[0].value, "0", "Should have seen the correct value"); |
|
67 is(list.childNodes[1].value, "2147483647", "Should have seen the correct value"); |
|
68 is(list.childNodes[2].value, "-2147483648", "Should have seen the correct value"); |
|
69 is(list.childNodes[3].value, "0", "Should have seen the correct value"); |
|
70 is(list.childNodes[4].value, "3147483647", "Should have seen the correct value"); |
|
71 is(list.childNodes[5].value, "-3147483648", "Should have seen the correct value"); |
|
72 } |
|
73 ]]> |
|
74 </script> |
|
75 |
|
76 </window> |