How to use view method in Best

Best JavaScript code snippet using best

dataview.js

Source:dataview.js Github

copy

Full Screen

1// |reftest| skip-if(!xulRuntime.shell)2/*3 * Any copyright is dedicated to the Public Domain.4 * http://creativecommons.org/licenses/publicdomain/5 * Contributor: Tobias Schneider <schneider@jancona.com>6 */7//------------------------------------------------------------------------------8var BUGNUMBER = 575688;9var summary = 'DataView tests';10function test() {11 function die(message, uplevel) {12 var e = new Error(message);13 var frame = e.stack.split("\n")[uplevel];14 print(message + " at " + frame.split("@")[1]);15 print("Stack:\n" + e.stack);16 throw(e);17 }18 function checkThrow(fun, type) {19 var thrown = false;20 try {21 fun();22 } catch (x) {23 thrown = x;24 }25 if (!thrown) {26 die('no exception thrown, expected ' + type.name, 2);27 } else if (!(thrown instanceof type)) {28 die('expected ' + type.name + ', got ' + thrown, 2);29 }30 }31 function checkThrowTODO(fun, type) {32 var thrown = false;33 try {34 fun();35 } catch (x) {36 thrown = x;37 }38 if (!thrown) {39 print('(TODO) no exception thrown, expected ' + type.name);40 } else if (!(thrown instanceof type)) {41 print('(TODO) expected ' + type.name + ', got ' + thrown);42 } else {43 print('test unexpectedly passed: expected ' + type.name + ' exception');44 }45 }46 enterFunc ('test');47 printBugNumber(BUGNUMBER);48 printStatus(summary);49 // testConstructor50 buffer = (new Uint8Array([1, 2])).buffer;51 checkThrow(function () new DataView(buffer, 0, 3), RangeError);52 checkThrow(function () new DataView(buffer, 1, 2), RangeError);53 checkThrow(function () new DataView(buffer, 2, 1), RangeError);54 checkThrow(function () new DataView(buffer, 2147483649, 0), RangeError);55 checkThrow(function () new DataView(buffer, 0, 2147483649), RangeError);56 checkThrow(function() new DataView(), TypeError);57 checkThrow(function() new DataView(Object.create(new ArrayBuffer(5))), TypeError);58 // testGetMethods59 // testIntegerGets(start=0, length=16)60 var data1 = [0,1,2,3,0x64,0x65,0x66,0x67,0x80,0x81,0x82,0x83,252,253,254,255];61 var data1_r = data1.slice().reverse();62 var buffer1 = new Uint8Array(data1).buffer;63 var view1 = new DataView(buffer1, 0, 16);64 view = view1;65 assertEq(view.getInt8(0), 0);66 assertEq(view.getInt8(8), -128);67 assertEq(view.getInt8(15), -1);68 assertEq(view.getUint8(0), 0);69 assertEq(view.getUint8(8), 128);70 assertEq(view.getUint8(15), 255);71 // Little endian.72 assertEq(view.getInt16(0, true), 256);73 assertEq(view.getInt16(5, true), 0x6665);74 assertEq(view.getInt16(9, true), -32127);75 assertEq(view.getInt16(14, true), -2);76 // Big endian.77 assertEq(view.getInt16(0), 1);78 assertEq(view.getInt16(5), 0x6566);79 assertEq(view.getInt16(9), -32382);80 assertEq(view.getInt16(14), -257);81 // Little endian.82 assertEq(view.getUint16(0, true), 256);83 assertEq(view.getUint16(5, true), 0x6665);84 assertEq(view.getUint16(9, true), 0x8281);85 assertEq(view.getUint16(14, true), 0xfffe);86 // Big endian.87 assertEq(view.getUint16(0), 1);88 assertEq(view.getUint16(5), 0x6566);89 assertEq(view.getUint16(9), 0x8182);90 assertEq(view.getUint16(14), 0xfeff);91 // Little endian.92 assertEq(view.getInt32(0, true), 0x3020100);93 assertEq(view.getInt32(3, true), 0x66656403);94 assertEq(view.getInt32(6, true), -2122291354);95 assertEq(view.getInt32(9, true), -58490239);96 assertEq(view.getInt32(12, true), -66052);97 // Big endian.98 assertEq(view.getInt32(0), 0x10203);99 assertEq(view.getInt32(3), 0x3646566);100 assertEq(view.getInt32(6), 0x66678081);101 assertEq(view.getInt32(9), -2122152964);102 assertEq(view.getInt32(12), -50462977);103 // Little endian.104 assertEq(view.getUint32(0, true), 0x3020100);105 assertEq(view.getUint32(3, true), 0x66656403);106 assertEq(view.getUint32(6, true), 0x81806766);107 assertEq(view.getUint32(9, true), 0xfc838281);108 assertEq(view.getUint32(12, true), 0xfffefdfc);109 // Big endian.110 assertEq(view.getUint32(0), 0x10203);111 assertEq(view.getUint32(3), 0x3646566);112 assertEq(view.getUint32(6), 0x66678081);113 assertEq(view.getUint32(9), 0x818283fc);114 assertEq(view.getUint32(12), 0xfcfdfeff);115 // testFloatGets(start=0)116 // testFloatGet expected=10117 // Little endian118 var data2 = [0,0,32,65];119 var data2_r = data2.slice().reverse();120 var buffer2 = new Uint8Array(data2).buffer;121 view = new DataView(buffer2, 0, 4);122 assertEq(view.getFloat32(0, true), 10);123 var buffer2_pad3 = new Uint8Array(Array(3).concat(data2)).buffer;124 view = new DataView(buffer2_pad3, 0, 7);125 assertEq(view.getFloat32(3, true), 10);126 var buffer2_pad7 = new Uint8Array(Array(7).concat(data2)).buffer;127 view = new DataView(buffer2_pad7, 0, 11);128 assertEq(view.getFloat32(7, true), 10);129 var buffer2_pad10 = new Uint8Array(Array(10).concat(data2)).buffer;130 view = new DataView(buffer2_pad10, 0, 14);131 assertEq(view.getFloat32(10, true), 10);132 // Big endian.133 var buffer2_r = new Uint8Array(data2_r).buffer;134 view = new DataView(buffer2_r, 0, 4);135 assertEq(view.getFloat32(0, false), 10);136 var buffer2_r_pad3 = new Uint8Array(Array(3).concat(data2_r)).buffer;137 view = new DataView(buffer2_r_pad3, 0, 7);138 assertEq(view.getFloat32(3, false), 10);139 var buffer2_r_pad7 = new Uint8Array(Array(7).concat(data2_r)).buffer;140 view = new DataView(buffer2_r_pad7, 0, 11);141 assertEq(view.getFloat32(7, false), 10);142 var buffer2_r_pad10 = new Uint8Array(Array(10).concat(data2_r)).buffer;143 view = new DataView(buffer2_r_pad10, 0, 14);144 assertEq(view.getFloat32(10, false), 10);145 // testFloatGet expected=1.2300000190734863146 // Little endian147 var data3 = [164,112,157,63];148 var data3_r = data3.slice().reverse();149 var buffer3 = new Uint8Array(data3).buffer;150 view = new DataView(buffer3, 0, 4);151 assertEq(view.getFloat32(0, true), 1.2300000190734863);152 var buffer3_pad3 = new Uint8Array(Array(3).concat(data3)).buffer;153 view = new DataView(buffer3_pad3, 0, 7);154 assertEq(view.getFloat32(3, true), 1.2300000190734863);155 var buffer3_pad7 = new Uint8Array(Array(7).concat(data3)).buffer;156 view = new DataView(buffer3_pad7, 0, 11);157 assertEq(view.getFloat32(7, true), 1.2300000190734863);158 var buffer3_pad10 = new Uint8Array(Array(10).concat(data3)).buffer;159 view = new DataView(buffer3_pad10, 0, 14);160 assertEq(view.getFloat32(10, true), 1.2300000190734863);161 // Big endian.162 var buffer3_r = new Uint8Array(data3_r).buffer;163 view = new DataView(buffer3_r, 0, 4);164 assertEq(view.getFloat32(0, false), 1.2300000190734863);165 var buffer3_r_pad3 = new Uint8Array(Array(3).concat(data3_r)).buffer;166 view = new DataView(buffer3_r_pad3, 0, 7);167 assertEq(view.getFloat32(3, false), 1.2300000190734863);168 var buffer3_r_pad7 = new Uint8Array(Array(7).concat(data3_r)).buffer;169 view = new DataView(buffer3_r_pad7, 0, 11);170 assertEq(view.getFloat32(7, false), 1.2300000190734863);171 var buffer3_r_pad10 = new Uint8Array(Array(10).concat(data3_r)).buffer;172 view = new DataView(buffer3_r_pad10, 0, 14);173 assertEq(view.getFloat32(10, false), 1.2300000190734863);174 // testFloatGet expected=-45621.37109375175 // Little endian176 var data4 = [95,53,50,199];177 var data4_r = data4.slice().reverse();178 var buffer4 = new Uint8Array(data4).buffer;179 view = new DataView(buffer4, 0, 4);180 assertEq(view.getFloat32(0, true), -45621.37109375);181 var buffer4_pad3 = new Uint8Array(Array(3).concat(data4)).buffer;182 view = new DataView(buffer4_pad3, 0, 7);183 assertEq(view.getFloat32(3, true), -45621.37109375);184 var buffer4_pad7 = new Uint8Array(Array(7).concat(data4)).buffer;185 view = new DataView(buffer4_pad7, 0, 11);186 assertEq(view.getFloat32(7, true), -45621.37109375);187 var buffer4_pad10 = new Uint8Array(Array(10).concat(data4)).buffer;188 view = new DataView(buffer4_pad10, 0, 14);189 assertEq(view.getFloat32(10, true), -45621.37109375);190 // Big endian.191 var buffer4_r = new Uint8Array(data4_r).buffer;192 view = new DataView(buffer4_r, 0, 4);193 assertEq(view.getFloat32(0, false), -45621.37109375);194 var buffer4_r_pad3 = new Uint8Array(Array(3).concat(data4_r)).buffer;195 view = new DataView(buffer4_r_pad3, 0, 7);196 assertEq(view.getFloat32(3, false), -45621.37109375);197 var buffer4_r_pad7 = new Uint8Array(Array(7).concat(data4_r)).buffer;198 view = new DataView(buffer4_r_pad7, 0, 11);199 assertEq(view.getFloat32(7, false), -45621.37109375);200 var buffer4_r_pad10 = new Uint8Array(Array(10).concat(data4_r)).buffer;201 view = new DataView(buffer4_r_pad10, 0, 14);202 assertEq(view.getFloat32(10, false), -45621.37109375);203 // testFloatGet expected=NaN204 // Little endian205 var data5 = [255,255,255,127];206 var data5_r = data5.slice().reverse();207 var buffer5 = new Uint8Array(data5).buffer;208 view = new DataView(buffer5, 0, 4);209 assertEq(view.getFloat32(0, true), NaN);210 var buffer5_pad3 = new Uint8Array(Array(3).concat(data5)).buffer;211 view = new DataView(buffer5_pad3, 0, 7);212 assertEq(view.getFloat32(3, true), NaN);213 var buffer5_pad7 = new Uint8Array(Array(7).concat(data5)).buffer;214 view = new DataView(buffer5_pad7, 0, 11);215 assertEq(view.getFloat32(7, true), NaN);216 var buffer5_pad10 = new Uint8Array(Array(10).concat(data5)).buffer;217 view = new DataView(buffer5_pad10, 0, 14);218 assertEq(view.getFloat32(10, true), NaN);219 // Big endian.220 var buffer5_r = new Uint8Array(data5_r).buffer;221 view = new DataView(buffer5_r, 0, 4);222 assertEq(view.getFloat32(0, false), NaN);223 var buffer5_r_pad3 = new Uint8Array(Array(3).concat(data5_r)).buffer;224 view = new DataView(buffer5_r_pad3, 0, 7);225 assertEq(view.getFloat32(3, false), NaN);226 var buffer5_r_pad7 = new Uint8Array(Array(7).concat(data5_r)).buffer;227 view = new DataView(buffer5_r_pad7, 0, 11);228 assertEq(view.getFloat32(7, false), NaN);229 var buffer5_r_pad10 = new Uint8Array(Array(10).concat(data5_r)).buffer;230 view = new DataView(buffer5_r_pad10, 0, 14);231 assertEq(view.getFloat32(10, false), NaN);232 // testFloatGet expected=NaN233 // Little endian234 var data6 = [255,255,255,255];235 var data6_r = data6.slice().reverse();236 var buffer6 = new Uint8Array(data6).buffer;237 view = new DataView(buffer6, 0, 4);238 assertEq(view.getFloat32(0, true), NaN);239 var buffer6_pad3 = new Uint8Array(Array(3).concat(data6)).buffer;240 view = new DataView(buffer6_pad3, 0, 7);241 assertEq(view.getFloat32(3, true), NaN);242 var buffer6_pad7 = new Uint8Array(Array(7).concat(data6)).buffer;243 view = new DataView(buffer6_pad7, 0, 11);244 assertEq(view.getFloat32(7, true), NaN);245 var buffer6_pad10 = new Uint8Array(Array(10).concat(data6)).buffer;246 view = new DataView(buffer6_pad10, 0, 14);247 assertEq(view.getFloat32(10, true), NaN);248 // Big endian.249 var buffer6_r = new Uint8Array(data6_r).buffer;250 view = new DataView(buffer6_r, 0, 4);251 assertEq(view.getFloat32(0, false), NaN);252 var buffer6_r_pad3 = new Uint8Array(Array(3).concat(data6_r)).buffer;253 view = new DataView(buffer6_r_pad3, 0, 7);254 assertEq(view.getFloat32(3, false), NaN);255 var buffer6_r_pad7 = new Uint8Array(Array(7).concat(data6_r)).buffer;256 view = new DataView(buffer6_r_pad7, 0, 11);257 assertEq(view.getFloat32(7, false), NaN);258 var buffer6_r_pad10 = new Uint8Array(Array(10).concat(data6_r)).buffer;259 view = new DataView(buffer6_r_pad10, 0, 14);260 assertEq(view.getFloat32(10, false), NaN);261 // testFloatGet expected=10262 // Little endian263 var data7 = [0,0,0,0,0,0,36,64];264 var data7_r = data7.slice().reverse();265 var buffer7 = new Uint8Array(data7).buffer;266 view = new DataView(buffer7, 0, 8);267 assertEq(view.getFloat64(0, true), 10);268 var buffer7_pad3 = new Uint8Array(Array(3).concat(data7)).buffer;269 view = new DataView(buffer7_pad3, 0, 11);270 assertEq(view.getFloat64(3, true), 10);271 var buffer7_pad7 = new Uint8Array(Array(7).concat(data7)).buffer;272 view = new DataView(buffer7_pad7, 0, 15);273 assertEq(view.getFloat64(7, true), 10);274 var buffer7_pad10 = new Uint8Array(Array(10).concat(data7)).buffer;275 view = new DataView(buffer7_pad10, 0, 18);276 assertEq(view.getFloat64(10, true), 10);277 // Big endian.278 var buffer7_r = new Uint8Array(data7_r).buffer;279 view = new DataView(buffer7_r, 0, 8);280 assertEq(view.getFloat64(0, false), 10);281 var buffer7_r_pad3 = new Uint8Array(Array(3).concat(data7_r)).buffer;282 view = new DataView(buffer7_r_pad3, 0, 11);283 assertEq(view.getFloat64(3, false), 10);284 var buffer7_r_pad7 = new Uint8Array(Array(7).concat(data7_r)).buffer;285 view = new DataView(buffer7_r_pad7, 0, 15);286 assertEq(view.getFloat64(7, false), 10);287 var buffer7_r_pad10 = new Uint8Array(Array(10).concat(data7_r)).buffer;288 view = new DataView(buffer7_r_pad10, 0, 18);289 assertEq(view.getFloat64(10, false), 10);290 // testFloatGet expected=1.23291 // Little endian292 var data8 = [174,71,225,122,20,174,243,63];293 var data8_r = data8.slice().reverse();294 var buffer8 = new Uint8Array(data8).buffer;295 view = new DataView(buffer8, 0, 8);296 assertEq(view.getFloat64(0, true), 1.23);297 var buffer8_pad3 = new Uint8Array(Array(3).concat(data8)).buffer;298 view = new DataView(buffer8_pad3, 0, 11);299 assertEq(view.getFloat64(3, true), 1.23);300 var buffer8_pad7 = new Uint8Array(Array(7).concat(data8)).buffer;301 view = new DataView(buffer8_pad7, 0, 15);302 assertEq(view.getFloat64(7, true), 1.23);303 var buffer8_pad10 = new Uint8Array(Array(10).concat(data8)).buffer;304 view = new DataView(buffer8_pad10, 0, 18);305 assertEq(view.getFloat64(10, true), 1.23);306 // Big endian.307 var buffer8_r = new Uint8Array(data8_r).buffer;308 view = new DataView(buffer8_r, 0, 8);309 assertEq(view.getFloat64(0, false), 1.23);310 var buffer8_r_pad3 = new Uint8Array(Array(3).concat(data8_r)).buffer;311 view = new DataView(buffer8_r_pad3, 0, 11);312 assertEq(view.getFloat64(3, false), 1.23);313 var buffer8_r_pad7 = new Uint8Array(Array(7).concat(data8_r)).buffer;314 view = new DataView(buffer8_r_pad7, 0, 15);315 assertEq(view.getFloat64(7, false), 1.23);316 var buffer8_r_pad10 = new Uint8Array(Array(10).concat(data8_r)).buffer;317 view = new DataView(buffer8_r_pad10, 0, 18);318 assertEq(view.getFloat64(10, false), 1.23);319 // testFloatGet expected=-6213576.4839320 // Little endian321 var data9 = [181,55,248,30,242,179,87,193];322 var data9_r = data9.slice().reverse();323 var buffer9 = new Uint8Array(data9).buffer;324 view = new DataView(buffer9, 0, 8);325 assertEq(view.getFloat64(0, true), -6213576.4839);326 var buffer9_pad3 = new Uint8Array(Array(3).concat(data9)).buffer;327 view = new DataView(buffer9_pad3, 0, 11);328 assertEq(view.getFloat64(3, true), -6213576.4839);329 var buffer9_pad7 = new Uint8Array(Array(7).concat(data9)).buffer;330 view = new DataView(buffer9_pad7, 0, 15);331 assertEq(view.getFloat64(7, true), -6213576.4839);332 var buffer9_pad10 = new Uint8Array(Array(10).concat(data9)).buffer;333 view = new DataView(buffer9_pad10, 0, 18);334 assertEq(view.getFloat64(10, true), -6213576.4839);335 // Big endian.336 var buffer9_r = new Uint8Array(data9_r).buffer;337 view = new DataView(buffer9_r, 0, 8);338 assertEq(view.getFloat64(0, false), -6213576.4839);339 var buffer9_r_pad3 = new Uint8Array(Array(3).concat(data9_r)).buffer;340 view = new DataView(buffer9_r_pad3, 0, 11);341 assertEq(view.getFloat64(3, false), -6213576.4839);342 var buffer9_r_pad7 = new Uint8Array(Array(7).concat(data9_r)).buffer;343 view = new DataView(buffer9_r_pad7, 0, 15);344 assertEq(view.getFloat64(7, false), -6213576.4839);345 var buffer9_r_pad10 = new Uint8Array(Array(10).concat(data9_r)).buffer;346 view = new DataView(buffer9_r_pad10, 0, 18);347 assertEq(view.getFloat64(10, false), -6213576.4839);348 // testFloatGet expected=NaN349 // Little endian350 var data10 = [255,255,255,255,255,255,255,127];351 var data10_r = data10.slice().reverse();352 var buffer10 = new Uint8Array(data10).buffer;353 view = new DataView(buffer10, 0, 8);354 assertEq(view.getFloat64(0, true), NaN);355 var buffer10_pad3 = new Uint8Array(Array(3).concat(data10)).buffer;356 view = new DataView(buffer10_pad3, 0, 11);357 assertEq(view.getFloat64(3, true), NaN);358 var buffer10_pad7 = new Uint8Array(Array(7).concat(data10)).buffer;359 view = new DataView(buffer10_pad7, 0, 15);360 assertEq(view.getFloat64(7, true), NaN);361 var buffer10_pad10 = new Uint8Array(Array(10).concat(data10)).buffer;362 view = new DataView(buffer10_pad10, 0, 18);363 assertEq(view.getFloat64(10, true), NaN);364 // Big endian.365 var buffer10_r = new Uint8Array(data10_r).buffer;366 view = new DataView(buffer10_r, 0, 8);367 assertEq(view.getFloat64(0, false), NaN);368 var buffer10_r_pad3 = new Uint8Array(Array(3).concat(data10_r)).buffer;369 view = new DataView(buffer10_r_pad3, 0, 11);370 assertEq(view.getFloat64(3, false), NaN);371 var buffer10_r_pad7 = new Uint8Array(Array(7).concat(data10_r)).buffer;372 view = new DataView(buffer10_r_pad7, 0, 15);373 assertEq(view.getFloat64(7, false), NaN);374 var buffer10_r_pad10 = new Uint8Array(Array(10).concat(data10_r)).buffer;375 view = new DataView(buffer10_r_pad10, 0, 18);376 assertEq(view.getFloat64(10, false), NaN);377 // testFloatGet expected=NaN378 // Little endian379 var data11 = [255,255,255,255,255,255,255,255];380 var data11_r = data11.slice().reverse();381 var buffer11 = new Uint8Array(data11).buffer;382 view = new DataView(buffer11, 0, 8);383 assertEq(view.getFloat64(0, true), NaN);384 var buffer11_pad3 = new Uint8Array(Array(3).concat(data11)).buffer;385 view = new DataView(buffer11_pad3, 0, 11);386 assertEq(view.getFloat64(3, true), NaN);387 var buffer11_pad7 = new Uint8Array(Array(7).concat(data11)).buffer;388 view = new DataView(buffer11_pad7, 0, 15);389 assertEq(view.getFloat64(7, true), NaN);390 var buffer11_pad10 = new Uint8Array(Array(10).concat(data11)).buffer;391 view = new DataView(buffer11_pad10, 0, 18);392 assertEq(view.getFloat64(10, true), NaN);393 // Big endian.394 var buffer11_r = new Uint8Array(data11_r).buffer;395 view = new DataView(buffer11_r, 0, 8);396 assertEq(view.getFloat64(0, false), NaN);397 var buffer11_r_pad3 = new Uint8Array(Array(3).concat(data11_r)).buffer;398 view = new DataView(buffer11_r_pad3, 0, 11);399 assertEq(view.getFloat64(3, false), NaN);400 var buffer11_r_pad7 = new Uint8Array(Array(7).concat(data11_r)).buffer;401 view = new DataView(buffer11_r_pad7, 0, 15);402 assertEq(view.getFloat64(7, false), NaN);403 var buffer11_r_pad10 = new Uint8Array(Array(10).concat(data11_r)).buffer;404 view = new DataView(buffer11_r_pad10, 0, 18);405 assertEq(view.getFloat64(10, false), NaN);406 // testIntegerGets(start=3, length=2)407 var data12 = [31,32,33,0,1,2,3,100,101,102,103,128,129,130,131,252,253,254,255];408 var data12_r = data12.slice().reverse();409 var buffer12 = new Uint8Array(data12).buffer;410 view = new DataView(buffer12, 3, 2);411 assertEq(view.getInt8(0), 0);412 checkThrow(function () view.getInt8(8), RangeError);413 checkThrow(function () view.getInt8(15), RangeError);414 assertEq(view.getUint8(0), 0);415 checkThrow(function () view.getUint8(8), RangeError);416 checkThrow(function () view.getUint8(15), RangeError);417 // Little endian.418 assertEq(view.getInt16(0, true), 256);419 checkThrow(function () view.getInt16(5, true), RangeError);420 checkThrow(function () view.getInt16(9, true), RangeError);421 checkThrow(function () view.getInt16(14, true), RangeError);422 // Big endian.423 assertEq(view.getInt16(0), 1);424 checkThrow(function () view.getInt16(5), RangeError);425 checkThrow(function () view.getInt16(9), RangeError);426 checkThrow(function () view.getInt16(14), RangeError);427 // Little endian.428 assertEq(view.getUint16(0, true), 256);429 checkThrow(function () view.getUint16(5, true), RangeError);430 checkThrow(function () view.getUint16(9, true), RangeError);431 checkThrow(function () view.getUint16(14, true), RangeError);432 // Big endian.433 assertEq(view.getUint16(0), 1);434 checkThrow(function () view.getUint16(5), RangeError);435 checkThrow(function () view.getUint16(9), RangeError);436 checkThrow(function () view.getUint16(14), RangeError);437 // Little endian.438 checkThrow(function () view.getInt32(0, true), RangeError);439 checkThrow(function () view.getInt32(3, true), RangeError);440 checkThrow(function () view.getInt32(6, true), RangeError);441 checkThrow(function () view.getInt32(9, true), RangeError);442 checkThrow(function () view.getInt32(12, true), RangeError);443 // Big endian.444 checkThrow(function () view.getInt32(0), RangeError);445 checkThrow(function () view.getInt32(3), RangeError);446 checkThrow(function () view.getInt32(6), RangeError);447 checkThrow(function () view.getInt32(9), RangeError);448 checkThrow(function () view.getInt32(12), RangeError);449 // Little endian.450 checkThrow(function () view.getUint32(0, true), RangeError);451 checkThrow(function () view.getUint32(3, true), RangeError);452 checkThrow(function () view.getUint32(6, true), RangeError);453 checkThrow(function () view.getUint32(9, true), RangeError);454 checkThrow(function () view.getUint32(12, true), RangeError);455 // Big endian.456 checkThrow(function () view.getUint32(0), RangeError);457 checkThrow(function () view.getUint32(3), RangeError);458 checkThrow(function () view.getUint32(6), RangeError);459 checkThrow(function () view.getUint32(9), RangeError);460 checkThrow(function () view.getUint32(12), RangeError);461 // testFloatGets(start=3)462 // testFloatGet expected=10463 // Little endian464 view = new DataView(buffer2, 3, 1);465 checkThrow(function () view.getFloat32(0, true), RangeError);466 view = new DataView(buffer2_pad3, 3, 4);467 checkThrow(function () view.getFloat32(3, true), RangeError);468 view = new DataView(buffer2_pad7, 3, 8);469 checkThrow(function () view.getFloat32(7, true), RangeError);470 view = new DataView(buffer2_pad10, 3, 11);471 checkThrow(function () view.getFloat32(10, true), RangeError);472 // Big endian.473 view = new DataView(buffer2_r, 3, 1);474 checkThrow(function () view.getFloat32(0, false), RangeError);475 view = new DataView(buffer2_r_pad3, 3, 4);476 checkThrow(function () view.getFloat32(3, false), RangeError);477 view = new DataView(buffer2_r_pad7, 3, 8);478 checkThrow(function () view.getFloat32(7, false), RangeError);479 view = new DataView(buffer2_r_pad10, 3, 11);480 checkThrow(function () view.getFloat32(10, false), RangeError);481 // testFloatGet expected=1.2300000190734863482 // Little endian483 view = new DataView(buffer3, 3, 1);484 checkThrow(function () view.getFloat32(0, true), RangeError);485 view = new DataView(buffer3_pad3, 3, 4);486 checkThrow(function () view.getFloat32(3, true), RangeError);487 view = new DataView(buffer3_pad7, 3, 8);488 checkThrow(function () view.getFloat32(7, true), RangeError);489 view = new DataView(buffer3_pad10, 3, 11);490 checkThrow(function () view.getFloat32(10, true), RangeError);491 // Big endian.492 view = new DataView(buffer3_r, 3, 1);493 checkThrow(function () view.getFloat32(0, false), RangeError);494 view = new DataView(buffer3_r_pad3, 3, 4);495 checkThrow(function () view.getFloat32(3, false), RangeError);496 view = new DataView(buffer3_r_pad7, 3, 8);497 checkThrow(function () view.getFloat32(7, false), RangeError);498 view = new DataView(buffer3_r_pad10, 3, 11);499 checkThrow(function () view.getFloat32(10, false), RangeError);500 // testFloatGet expected=-45621.37109375501 // Little endian502 view = new DataView(buffer4, 3, 1);503 checkThrow(function () view.getFloat32(0, true), RangeError);504 view = new DataView(buffer4_pad3, 3, 4);505 checkThrow(function () view.getFloat32(3, true), RangeError);506 view = new DataView(buffer4_pad7, 3, 8);507 checkThrow(function () view.getFloat32(7, true), RangeError);508 view = new DataView(buffer4_pad10, 3, 11);509 checkThrow(function () view.getFloat32(10, true), RangeError);510 // Big endian.511 view = new DataView(buffer4_r, 3, 1);512 checkThrow(function () view.getFloat32(0, false), RangeError);513 view = new DataView(buffer4_r_pad3, 3, 4);514 checkThrow(function () view.getFloat32(3, false), RangeError);515 view = new DataView(buffer4_r_pad7, 3, 8);516 checkThrow(function () view.getFloat32(7, false), RangeError);517 view = new DataView(buffer4_r_pad10, 3, 11);518 checkThrow(function () view.getFloat32(10, false), RangeError);519 // testFloatGet expected=NaN520 // Little endian521 view = new DataView(buffer5, 3, 1);522 checkThrow(function () view.getFloat32(0, true), RangeError);523 view = new DataView(buffer5_pad3, 3, 4);524 checkThrow(function () view.getFloat32(3, true), RangeError);525 view = new DataView(buffer5_pad7, 3, 8);526 checkThrow(function () view.getFloat32(7, true), RangeError);527 view = new DataView(buffer5_pad10, 3, 11);528 checkThrow(function () view.getFloat32(10, true), RangeError);529 // Big endian.530 view = new DataView(buffer5_r, 3, 1);531 checkThrow(function () view.getFloat32(0, false), RangeError);532 view = new DataView(buffer5_r_pad3, 3, 4);533 checkThrow(function () view.getFloat32(3, false), RangeError);534 view = new DataView(buffer5_r_pad7, 3, 8);535 checkThrow(function () view.getFloat32(7, false), RangeError);536 view = new DataView(buffer5_r_pad10, 3, 11);537 checkThrow(function () view.getFloat32(10, false), RangeError);538 // testFloatGet expected=NaN539 // Little endian540 view = new DataView(buffer6, 3, 1);541 checkThrow(function () view.getFloat32(0, true), RangeError);542 view = new DataView(buffer6_pad3, 3, 4);543 checkThrow(function () view.getFloat32(3, true), RangeError);544 view = new DataView(buffer6_pad7, 3, 8);545 checkThrow(function () view.getFloat32(7, true), RangeError);546 view = new DataView(buffer6_pad10, 3, 11);547 checkThrow(function () view.getFloat32(10, true), RangeError);548 // Big endian.549 view = new DataView(buffer6_r, 3, 1);550 checkThrow(function () view.getFloat32(0, false), RangeError);551 view = new DataView(buffer6_r_pad3, 3, 4);552 checkThrow(function () view.getFloat32(3, false), RangeError);553 view = new DataView(buffer6_r_pad7, 3, 8);554 checkThrow(function () view.getFloat32(7, false), RangeError);555 view = new DataView(buffer6_r_pad10, 3, 11);556 checkThrow(function () view.getFloat32(10, false), RangeError);557 // testFloatGet expected=10558 // Little endian559 view = new DataView(buffer7, 3, 5);560 checkThrow(function () view.getFloat64(0, true), RangeError);561 view = new DataView(buffer7_pad3, 3, 8);562 checkThrow(function () view.getFloat64(3, true), RangeError);563 view = new DataView(buffer7_pad7, 3, 12);564 checkThrow(function () view.getFloat64(7, true), RangeError);565 view = new DataView(buffer7_pad10, 3, 15);566 checkThrow(function () view.getFloat64(10, true), RangeError);567 // Big endian.568 view = new DataView(buffer7_r, 3, 5);569 checkThrow(function () view.getFloat64(0, false), RangeError);570 view = new DataView(buffer7_r_pad3, 3, 8);571 checkThrow(function () view.getFloat64(3, false), RangeError);572 view = new DataView(buffer7_r_pad7, 3, 12);573 checkThrow(function () view.getFloat64(7, false), RangeError);574 view = new DataView(buffer7_r_pad10, 3, 15);575 checkThrow(function () view.getFloat64(10, false), RangeError);576 // testFloatGet expected=1.23577 // Little endian578 view = new DataView(buffer8, 3, 5);579 checkThrow(function () view.getFloat64(0, true), RangeError);580 view = new DataView(buffer8_pad3, 3, 8);581 checkThrow(function () view.getFloat64(3, true), RangeError);582 view = new DataView(buffer8_pad7, 3, 12);583 checkThrow(function () view.getFloat64(7, true), RangeError);584 view = new DataView(buffer8_pad10, 3, 15);585 checkThrow(function () view.getFloat64(10, true), RangeError);586 // Big endian.587 view = new DataView(buffer8_r, 3, 5);588 checkThrow(function () view.getFloat64(0, false), RangeError);589 view = new DataView(buffer8_r_pad3, 3, 8);590 checkThrow(function () view.getFloat64(3, false), RangeError);591 view = new DataView(buffer8_r_pad7, 3, 12);592 checkThrow(function () view.getFloat64(7, false), RangeError);593 view = new DataView(buffer8_r_pad10, 3, 15);594 checkThrow(function () view.getFloat64(10, false), RangeError);595 // testFloatGet expected=-6213576.4839596 // Little endian597 view = new DataView(buffer9, 3, 5);598 checkThrow(function () view.getFloat64(0, true), RangeError);599 view = new DataView(buffer9_pad3, 3, 8);600 checkThrow(function () view.getFloat64(3, true), RangeError);601 view = new DataView(buffer9_pad7, 3, 12);602 checkThrow(function () view.getFloat64(7, true), RangeError);603 view = new DataView(buffer9_pad10, 3, 15);604 checkThrow(function () view.getFloat64(10, true), RangeError);605 // Big endian.606 view = new DataView(buffer9_r, 3, 5);607 checkThrow(function () view.getFloat64(0, false), RangeError);608 view = new DataView(buffer9_r_pad3, 3, 8);609 checkThrow(function () view.getFloat64(3, false), RangeError);610 view = new DataView(buffer9_r_pad7, 3, 12);611 checkThrow(function () view.getFloat64(7, false), RangeError);612 view = new DataView(buffer9_r_pad10, 3, 15);613 checkThrow(function () view.getFloat64(10, false), RangeError);614 // testFloatGet expected=NaN615 // Little endian616 view = new DataView(buffer10, 3, 5);617 checkThrow(function () view.getFloat64(0, true), RangeError);618 view = new DataView(buffer10_pad3, 3, 8);619 checkThrow(function () view.getFloat64(3, true), RangeError);620 view = new DataView(buffer10_pad7, 3, 12);621 checkThrow(function () view.getFloat64(7, true), RangeError);622 view = new DataView(buffer10_pad10, 3, 15);623 checkThrow(function () view.getFloat64(10, true), RangeError);624 // Big endian.625 view = new DataView(buffer10_r, 3, 5);626 checkThrow(function () view.getFloat64(0, false), RangeError);627 view = new DataView(buffer10_r_pad3, 3, 8);628 checkThrow(function () view.getFloat64(3, false), RangeError);629 view = new DataView(buffer10_r_pad7, 3, 12);630 checkThrow(function () view.getFloat64(7, false), RangeError);631 view = new DataView(buffer10_r_pad10, 3, 15);632 checkThrow(function () view.getFloat64(10, false), RangeError);633 // testFloatGet expected=NaN634 // Little endian635 view = new DataView(buffer11, 3, 5);636 checkThrow(function () view.getFloat64(0, true), RangeError);637 view = new DataView(buffer11_pad3, 3, 8);638 checkThrow(function () view.getFloat64(3, true), RangeError);639 view = new DataView(buffer11_pad7, 3, 12);640 checkThrow(function () view.getFloat64(7, true), RangeError);641 view = new DataView(buffer11_pad10, 3, 15);642 checkThrow(function () view.getFloat64(10, true), RangeError);643 // Big endian.644 view = new DataView(buffer11_r, 3, 5);645 checkThrow(function () view.getFloat64(0, false), RangeError);646 view = new DataView(buffer11_r_pad3, 3, 8);647 checkThrow(function () view.getFloat64(3, false), RangeError);648 view = new DataView(buffer11_r_pad7, 3, 12);649 checkThrow(function () view.getFloat64(7, false), RangeError);650 view = new DataView(buffer11_r_pad10, 3, 15);651 checkThrow(function () view.getFloat64(10, false), RangeError);652 // testGetNegativeIndexes653 view = new DataView(buffer1, 0, 16);654 checkThrow(function () view.getInt8(-1), RangeError);655 checkThrow(function () view.getInt8(-2), RangeError);656 checkThrow(function () view.getUint8(-1), RangeError);657 checkThrow(function () view.getUint8(-2), RangeError);658 checkThrow(function () view.getInt16(-1), RangeError);659 checkThrow(function () view.getInt16(-2), RangeError);660 checkThrow(function () view.getInt16(-3), RangeError);661 checkThrow(function () view.getUint16(-1), RangeError);662 checkThrow(function () view.getUint16(-2), RangeError);663 checkThrow(function () view.getUint16(-3), RangeError);664 checkThrow(function () view.getInt32(-1), RangeError);665 checkThrow(function () view.getInt32(-3), RangeError);666 checkThrow(function () view.getInt32(-5), RangeError);667 checkThrow(function () view.getUint32(-1), RangeError);668 checkThrow(function () view.getUint32(-3), RangeError);669 checkThrow(function () view.getUint32(-5), RangeError);670 view = new DataView(buffer7, 0, 8);671 checkThrow(function () view.getFloat32(-1), RangeError);672 checkThrow(function () view.getFloat32(-3), RangeError);673 checkThrow(function () view.getFloat32(-5), RangeError);674 checkThrow(function () view.getFloat64(-1), RangeError);675 checkThrow(function () view.getFloat64(-5), RangeError);676 checkThrow(function () view.getFloat64(-9), RangeError);677 // Too large for signed 32 bit integer index678 checkThrow(function () view.getInt8(2147483648), RangeError);679 checkThrow(function () view.getInt8(2147483649), RangeError);680 checkThrow(function () view.getUint8(2147483648), RangeError);681 checkThrow(function () view.getUint8(2147483649), RangeError);682 checkThrow(function () view.getInt16(2147483648), RangeError);683 checkThrow(function () view.getInt16(2147483649), RangeError);684 checkThrow(function () view.getUint16(2147483648), RangeError);685 checkThrow(function () view.getUint16(2147483649), RangeError);686 checkThrow(function () view.getInt32(2147483648), RangeError);687 checkThrow(function () view.getInt32(2147483649), RangeError);688 checkThrow(function () view.getUint32(2147483648), RangeError);689 checkThrow(function () view.getUint32(2147483649), RangeError);690 checkThrow(function () view.getFloat32(2147483648), RangeError);691 checkThrow(function () view.getFloat32(2147483649), RangeError);692 checkThrow(function () view.getFloat64(2147483648), RangeError);693 checkThrow(function () view.getFloat64(2147483649), RangeError);694 // Test for wrong arguments passed to get methods695 //696 // See http://www.w3.org/TR/WebIDL/#es-operations and the step saying "If entry is null, throw a TypeError."697 checkThrow(function () view.getInt8(), TypeError);698 checkThrow(function () view.getUint8(), TypeError);699 checkThrow(function () view.getInt16(), TypeError);700 checkThrow(function () view.getUint16(), TypeError);701 checkThrow(function () view.getInt32(), TypeError);702 checkThrow(function () view.getUint32(), TypeError);703 checkThrow(function () view.getFloat32(), TypeError);704 checkThrow(function () view.getFloat64(), TypeError);705 // Test for wrong type of |this|706 checkThrow(function () view.getInt8.apply("dead", [0]), TypeError);707 checkThrow(function () view.getUint8.apply("puppies", [0]), TypeError);708 checkThrow(function () view.getInt16.apply("aren", [0]), TypeError);709 checkThrow(function () view.getUint16.apply("t", [0]), TypeError);710 checkThrow(function () view.getInt32.apply("much", [0]), TypeError);711 checkThrow(function () view.getUint32.apply("fun", [0]), TypeError);712 checkThrow(function () view.getFloat32.apply("(in", [0]), TypeError);713 checkThrow(function () view.getFloat64.apply("bed)", [0]), TypeError);714 checkThrow(function () view.setInt8.apply("dead", [0, 0]), TypeError);715 checkThrow(function () view.setUint8.apply("puppies", [0, 0]), TypeError);716 checkThrow(function () view.setInt16.apply("aren", [0, 0]), TypeError);717 checkThrow(function () view.setUint16.apply("t", [0, 0]), TypeError);718 checkThrow(function () view.setInt32.apply("much", [0, 0]), TypeError);719 checkThrow(function () view.setUint32.apply("fun", [0, 0]), TypeError);720 checkThrow(function () view.setFloat32.apply("(in", [0, 0]), TypeError);721 checkThrow(function () view.setFloat64.apply("bed)", [0, 0]), TypeError);722 // testSetMethods723 // Test for set methods that work724 // testIntegerSets(start=0, length=16)725 var data13 = [204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204];726 var data13_r = data13.slice().reverse();727 var buffer13 = new Uint8Array(data13).buffer;728 view = new DataView(buffer13, 0, 16);729 view.setInt8(0, 0);730 assertEq(view.getInt8(0), 0);731 view.setInt8(8, -128);732 assertEq(view.getInt8(8), -128);733 view.setInt8(15, -1);734 assertEq(view.getInt8(15), -1);735 view.setUint8(0, 0);736 assertEq(view.getUint8(0), 0);737 view.setUint8(8, 128);738 assertEq(view.getUint8(8), 128);739 view.setUint8(15, 255);740 assertEq(view.getUint8(15), 255);741 view.setInt16(0, 256, true);742 assertEq(view.getInt16(0, true), 256);743 view.setInt16(5, 26213, true);744 assertEq(view.getInt16(5, true), 26213);745 view.setInt16(9, -32127, true);746 assertEq(view.getInt16(9, true), -32127);747 view.setInt16(14, -2, true);748 assertEq(view.getInt16(14, true), -2);749 view.setInt16(0, 1);750 assertEq(view.getInt16(0), 1);751 view.setInt16(5, 25958);752 assertEq(view.getInt16(5), 25958);753 view.setInt16(9, -32382);754 assertEq(view.getInt16(9), -32382);755 view.setInt16(14, -257);756 assertEq(view.getInt16(14), -257);757 view.setUint16(0, 256, true);758 assertEq(view.getUint16(0, true), 256);759 view.setUint16(5, 26213, true);760 assertEq(view.getUint16(5, true), 26213);761 view.setUint16(9, 33409, true);762 assertEq(view.getUint16(9, true), 33409);763 view.setUint16(14, 65534, true);764 assertEq(view.getUint16(14, true), 65534);765 view.setUint16(0, 1);766 assertEq(view.getUint16(0), 1);767 view.setUint16(5, 25958);768 assertEq(view.getUint16(5), 25958);769 view.setUint16(9, 33154);770 assertEq(view.getUint16(9), 33154);771 view.setUint16(14, 65279);772 assertEq(view.getUint16(14), 65279);773 view.setInt32(0, 50462976, true);774 assertEq(view.getInt32(0, true), 50462976);775 view.setInt32(3, 1717920771, true);776 assertEq(view.getInt32(3, true), 1717920771);777 view.setInt32(6, -2122291354, true);778 assertEq(view.getInt32(6, true), -2122291354);779 view.setInt32(9, -58490239, true);780 assertEq(view.getInt32(9, true), -58490239);781 view.setInt32(12, -66052, true);782 assertEq(view.getInt32(12, true), -66052);783 view.setInt32(0, 66051);784 assertEq(view.getInt32(0), 66051);785 view.setInt32(3, 56911206);786 assertEq(view.getInt32(3), 56911206);787 view.setInt32(6, 1718059137);788 assertEq(view.getInt32(6), 1718059137);789 view.setInt32(9, -2122152964);790 assertEq(view.getInt32(9), -2122152964);791 view.setInt32(12, -50462977);792 assertEq(view.getInt32(12), -50462977);793 view.setUint32(0, 50462976, true);794 assertEq(view.getUint32(0, true), 50462976);795 view.setUint32(3, 1717920771, true);796 assertEq(view.getUint32(3, true), 1717920771);797 view.setUint32(6, 2172675942, true);798 assertEq(view.getUint32(6, true), 2172675942);799 view.setUint32(9, 4236477057, true);800 assertEq(view.getUint32(9, true), 4236477057);801 view.setUint32(12, 4294901244, true);802 assertEq(view.getUint32(12, true), 4294901244);803 view.setUint32(0, 66051);804 assertEq(view.getUint32(0), 66051);805 view.setUint32(3, 56911206);806 assertEq(view.getUint32(3), 56911206);807 view.setUint32(6, 1718059137);808 assertEq(view.getUint32(6), 1718059137);809 view.setUint32(9, 2172814332);810 assertEq(view.getUint32(9), 2172814332);811 view.setUint32(12, 4244504319);812 assertEq(view.getUint32(12), 4244504319);813 // testFloatSets(start=undefined)814 // testFloatSet expected=10815 // Little endian816 view = new DataView(buffer13, 0, 16);817 view.setFloat32(0, 10, true);818 assertEq(view.getFloat32(0, true), 10);819 var buffer13_pad3 = new Uint8Array(Array(3).concat(data13)).buffer;820 view = new DataView(buffer13_pad3, 0, 19);821 view.setFloat32(3, 10, true);822 assertEq(view.getFloat32(3, true), 10);823 var buffer13_pad7 = new Uint8Array(Array(7).concat(data13)).buffer;824 view = new DataView(buffer13_pad7, 0, 23);825 view.setFloat32(7, 10, true);826 assertEq(view.getFloat32(7, true), 10);827 var buffer13_pad10 = new Uint8Array(Array(10).concat(data13)).buffer;828 view = new DataView(buffer13_pad10, 0, 26);829 view.setFloat32(10, 10, true);830 assertEq(view.getFloat32(10, true), 10);831 // Big endian.832 var buffer13_r = new Uint8Array(data13_r).buffer;833 view = new DataView(buffer13_r, 0, 16);834 view.setFloat32(0, 10, false);835 assertEq(view.getFloat32(0, false), 10);836 var buffer13_r_pad3 = new Uint8Array(Array(3).concat(data13_r)).buffer;837 view = new DataView(buffer13_r_pad3, 0, 19);838 view.setFloat32(3, 10, false);839 assertEq(view.getFloat32(3, false), 10);840 var buffer13_r_pad7 = new Uint8Array(Array(7).concat(data13_r)).buffer;841 view = new DataView(buffer13_r_pad7, 0, 23);842 view.setFloat32(7, 10, false);843 assertEq(view.getFloat32(7, false), 10);844 var buffer13_r_pad10 = new Uint8Array(Array(10).concat(data13_r)).buffer;845 view = new DataView(buffer13_r_pad10, 0, 26);846 view.setFloat32(10, 10, false);847 assertEq(view.getFloat32(10, false), 10);848 // testFloatSet expected=1.2300000190734863849 // Little endian850 view = new DataView(buffer13, 0, 16);851 view.setFloat32(0, 1.2300000190734863, true);852 assertEq(view.getFloat32(0, true), 1.2300000190734863);853 view = new DataView(buffer13_pad3, 0, 19);854 view.setFloat32(3, 1.2300000190734863, true);855 assertEq(view.getFloat32(3, true), 1.2300000190734863);856 view = new DataView(buffer13_pad7, 0, 23);857 view.setFloat32(7, 1.2300000190734863, true);858 assertEq(view.getFloat32(7, true), 1.2300000190734863);859 view = new DataView(buffer13_pad10, 0, 26);860 view.setFloat32(10, 1.2300000190734863, true);861 assertEq(view.getFloat32(10, true), 1.2300000190734863);862 // Big endian.863 view = new DataView(buffer13_r, 0, 16);864 view.setFloat32(0, 1.2300000190734863, false);865 assertEq(view.getFloat32(0, false), 1.2300000190734863);866 view = new DataView(buffer13_r_pad3, 0, 19);867 view.setFloat32(3, 1.2300000190734863, false);868 assertEq(view.getFloat32(3, false), 1.2300000190734863);869 view = new DataView(buffer13_r_pad7, 0, 23);870 view.setFloat32(7, 1.2300000190734863, false);871 assertEq(view.getFloat32(7, false), 1.2300000190734863);872 view = new DataView(buffer13_r_pad10, 0, 26);873 view.setFloat32(10, 1.2300000190734863, false);874 assertEq(view.getFloat32(10, false), 1.2300000190734863);875 // testFloatSet expected=-45621.37109375876 // Little endian877 view = new DataView(buffer13, 0, 16);878 view.setFloat32(0, -45621.37109375, true);879 assertEq(view.getFloat32(0, true), -45621.37109375);880 view = new DataView(buffer13_pad3, 0, 19);881 view.setFloat32(3, -45621.37109375, true);882 assertEq(view.getFloat32(3, true), -45621.37109375);883 view = new DataView(buffer13_pad7, 0, 23);884 view.setFloat32(7, -45621.37109375, true);885 assertEq(view.getFloat32(7, true), -45621.37109375);886 view = new DataView(buffer13_pad10, 0, 26);887 view.setFloat32(10, -45621.37109375, true);888 assertEq(view.getFloat32(10, true), -45621.37109375);889 // Big endian.890 view = new DataView(buffer13_r, 0, 16);891 view.setFloat32(0, -45621.37109375, false);892 assertEq(view.getFloat32(0, false), -45621.37109375);893 view = new DataView(buffer13_r_pad3, 0, 19);894 view.setFloat32(3, -45621.37109375, false);895 assertEq(view.getFloat32(3, false), -45621.37109375);896 view = new DataView(buffer13_r_pad7, 0, 23);897 view.setFloat32(7, -45621.37109375, false);898 assertEq(view.getFloat32(7, false), -45621.37109375);899 view = new DataView(buffer13_r_pad10, 0, 26);900 view.setFloat32(10, -45621.37109375, false);901 assertEq(view.getFloat32(10, false), -45621.37109375);902 // testFloatSet expected=NaN903 // Little endian904 view = new DataView(buffer13, 0, 16);905 view.setFloat32(0, NaN, true);906 assertEq(view.getFloat32(0, true), NaN);907 view = new DataView(buffer13_pad3, 0, 19);908 view.setFloat32(3, NaN, true);909 assertEq(view.getFloat32(3, true), NaN);910 view = new DataView(buffer13_pad7, 0, 23);911 view.setFloat32(7, NaN, true);912 assertEq(view.getFloat32(7, true), NaN);913 view = new DataView(buffer13_pad10, 0, 26);914 view.setFloat32(10, NaN, true);915 assertEq(view.getFloat32(10, true), NaN);916 // Big endian.917 view = new DataView(buffer13_r, 0, 16);918 view.setFloat32(0, NaN, false);919 assertEq(view.getFloat32(0, false), NaN);920 view = new DataView(buffer13_r_pad3, 0, 19);921 view.setFloat32(3, NaN, false);922 assertEq(view.getFloat32(3, false), NaN);923 view = new DataView(buffer13_r_pad7, 0, 23);924 view.setFloat32(7, NaN, false);925 assertEq(view.getFloat32(7, false), NaN);926 view = new DataView(buffer13_r_pad10, 0, 26);927 view.setFloat32(10, NaN, false);928 assertEq(view.getFloat32(10, false), NaN);929 // testFloatSet expected=-NaN930 // Little endian931 view = new DataView(buffer13, 0, 16);932 view.setFloat32(0, -NaN, true);933 assertEq(view.getFloat32(0, true), -NaN);934 view = new DataView(buffer13_pad3, 0, 19);935 view.setFloat32(3, -NaN, true);936 assertEq(view.getFloat32(3, true), -NaN);937 view = new DataView(buffer13_pad7, 0, 23);938 view.setFloat32(7, -NaN, true);939 assertEq(view.getFloat32(7, true), -NaN);940 view = new DataView(buffer13_pad10, 0, 26);941 view.setFloat32(10, -NaN, true);942 assertEq(view.getFloat32(10, true), -NaN);943 // Big endian.944 view = new DataView(buffer13_r, 0, 16);945 view.setFloat32(0, -NaN, false);946 assertEq(view.getFloat32(0, false), -NaN);947 view = new DataView(buffer13_r_pad3, 0, 19);948 view.setFloat32(3, -NaN, false);949 assertEq(view.getFloat32(3, false), -NaN);950 view = new DataView(buffer13_r_pad7, 0, 23);951 view.setFloat32(7, -NaN, false);952 assertEq(view.getFloat32(7, false), -NaN);953 view = new DataView(buffer13_r_pad10, 0, 26);954 view.setFloat32(10, -NaN, false);955 assertEq(view.getFloat32(10, false), -NaN);956 // testFloatSet expected=10957 // Little endian958 view = new DataView(buffer13, 0, 16);959 view.setFloat64(0, 10, true);960 assertEq(view.getFloat64(0, true), 10);961 view = new DataView(buffer13_pad3, 0, 19);962 view.setFloat64(3, 10, true);963 assertEq(view.getFloat64(3, true), 10);964 view = new DataView(buffer13_pad7, 0, 23);965 view.setFloat64(7, 10, true);966 assertEq(view.getFloat64(7, true), 10);967 view = new DataView(buffer13_pad10, 0, 26);968 view.setFloat64(10, 10, true);969 assertEq(view.getFloat64(10, true), 10);970 // Big endian.971 view = new DataView(buffer13_r, 0, 16);972 view.setFloat64(0, 10, false);973 assertEq(view.getFloat64(0, false), 10);974 view = new DataView(buffer13_r_pad3, 0, 19);975 view.setFloat64(3, 10, false);976 assertEq(view.getFloat64(3, false), 10);977 view = new DataView(buffer13_r_pad7, 0, 23);978 view.setFloat64(7, 10, false);979 assertEq(view.getFloat64(7, false), 10);980 view = new DataView(buffer13_r_pad10, 0, 26);981 view.setFloat64(10, 10, false);982 assertEq(view.getFloat64(10, false), 10);983 // testFloatSet expected=1.23984 // Little endian985 view = new DataView(buffer13, 0, 16);986 view.setFloat64(0, 1.23, true);987 assertEq(view.getFloat64(0, true), 1.23);988 view = new DataView(buffer13_pad3, 0, 19);989 view.setFloat64(3, 1.23, true);990 assertEq(view.getFloat64(3, true), 1.23);991 view = new DataView(buffer13_pad7, 0, 23);992 view.setFloat64(7, 1.23, true);993 assertEq(view.getFloat64(7, true), 1.23);994 view = new DataView(buffer13_pad10, 0, 26);995 view.setFloat64(10, 1.23, true);996 assertEq(view.getFloat64(10, true), 1.23);997 // Big endian.998 view = new DataView(buffer13_r, 0, 16);999 view.setFloat64(0, 1.23, false);1000 assertEq(view.getFloat64(0, false), 1.23);1001 view = new DataView(buffer13_r_pad3, 0, 19);1002 view.setFloat64(3, 1.23, false);1003 assertEq(view.getFloat64(3, false), 1.23);1004 view = new DataView(buffer13_r_pad7, 0, 23);1005 view.setFloat64(7, 1.23, false);1006 assertEq(view.getFloat64(7, false), 1.23);1007 view = new DataView(buffer13_r_pad10, 0, 26);1008 view.setFloat64(10, 1.23, false);1009 assertEq(view.getFloat64(10, false), 1.23);1010 // testFloatSet expected=-6213576.48391011 // Little endian1012 view = new DataView(buffer13, 0, 16);1013 view.setFloat64(0, -6213576.4839, true);1014 assertEq(view.getFloat64(0, true), -6213576.4839);1015 view = new DataView(buffer13_pad3, 0, 19);1016 view.setFloat64(3, -6213576.4839, true);1017 assertEq(view.getFloat64(3, true), -6213576.4839);1018 view = new DataView(buffer13_pad7, 0, 23);1019 view.setFloat64(7, -6213576.4839, true);1020 assertEq(view.getFloat64(7, true), -6213576.4839);1021 view = new DataView(buffer13_pad10, 0, 26);1022 view.setFloat64(10, -6213576.4839, true);1023 assertEq(view.getFloat64(10, true), -6213576.4839);1024 // Big endian.1025 view = new DataView(buffer13_r, 0, 16);1026 view.setFloat64(0, -6213576.4839, false);1027 assertEq(view.getFloat64(0, false), -6213576.4839);1028 view = new DataView(buffer13_r_pad3, 0, 19);1029 view.setFloat64(3, -6213576.4839, false);1030 assertEq(view.getFloat64(3, false), -6213576.4839);1031 view = new DataView(buffer13_r_pad7, 0, 23);1032 view.setFloat64(7, -6213576.4839, false);1033 assertEq(view.getFloat64(7, false), -6213576.4839);1034 view = new DataView(buffer13_r_pad10, 0, 26);1035 view.setFloat64(10, -6213576.4839, false);1036 assertEq(view.getFloat64(10, false), -6213576.4839);1037 // testFloatSet expected=NaN1038 // Little endian1039 view = new DataView(buffer13, 0, 16);1040 view.setFloat64(0, NaN, true);1041 assertEq(view.getFloat64(0, true), NaN);1042 view = new DataView(buffer13_pad3, 0, 19);1043 view.setFloat64(3, NaN, true);1044 assertEq(view.getFloat64(3, true), NaN);1045 view = new DataView(buffer13_pad7, 0, 23);1046 view.setFloat64(7, NaN, true);1047 assertEq(view.getFloat64(7, true), NaN);1048 view = new DataView(buffer13_pad10, 0, 26);1049 view.setFloat64(10, NaN, true);1050 assertEq(view.getFloat64(10, true), NaN);1051 // Big endian.1052 view = new DataView(buffer13_r, 0, 16);1053 view.setFloat64(0, NaN, false);1054 assertEq(view.getFloat64(0, false), NaN);1055 view = new DataView(buffer13_r_pad3, 0, 19);1056 view.setFloat64(3, NaN, false);1057 assertEq(view.getFloat64(3, false), NaN);1058 view = new DataView(buffer13_r_pad7, 0, 23);1059 view.setFloat64(7, NaN, false);1060 assertEq(view.getFloat64(7, false), NaN);1061 view = new DataView(buffer13_r_pad10, 0, 26);1062 view.setFloat64(10, NaN, false);1063 assertEq(view.getFloat64(10, false), NaN);1064 // testFloatSet expected=-NaN1065 // Little endian1066 view = new DataView(buffer13, 0, 16);1067 view.setFloat64(0, -NaN, true);1068 assertEq(view.getFloat64(0, true), -NaN);1069 view = new DataView(buffer13_pad3, 0, 19);1070 view.setFloat64(3, -NaN, true);1071 assertEq(view.getFloat64(3, true), -NaN);1072 view = new DataView(buffer13_pad7, 0, 23);1073 view.setFloat64(7, -NaN, true);1074 assertEq(view.getFloat64(7, true), -NaN);1075 view = new DataView(buffer13_pad10, 0, 26);1076 view.setFloat64(10, -NaN, true);1077 assertEq(view.getFloat64(10, true), -NaN);1078 // Big endian.1079 view = new DataView(buffer13_r, 0, 16);1080 view.setFloat64(0, -NaN, false);1081 assertEq(view.getFloat64(0, false), -NaN);1082 view = new DataView(buffer13_r_pad3, 0, 19);1083 view.setFloat64(3, -NaN, false);1084 assertEq(view.getFloat64(3, false), -NaN);1085 view = new DataView(buffer13_r_pad7, 0, 23);1086 view.setFloat64(7, -NaN, false);1087 assertEq(view.getFloat64(7, false), -NaN);1088 view = new DataView(buffer13_r_pad10, 0, 26);1089 view.setFloat64(10, -NaN, false);1090 assertEq(view.getFloat64(10, false), -NaN);1091 // Test for set methods that might write beyond the range1092 // testIntegerSets(start=3, length=2)1093 view = new DataView(buffer13, 3, 2);1094 view.setInt8(0, 0);1095 assertEq(view.getInt8(0), 0);1096 checkThrow(function () view.setInt8(8, -128), RangeError);1097 checkThrow(function () view.setInt8(15, -1), RangeError);1098 view.setUint8(0, 0);1099 assertEq(view.getUint8(0), 0);1100 checkThrow(function () view.setUint8(8, 128), RangeError);1101 checkThrow(function () view.setUint8(15, 255), RangeError);1102 view.setInt16(0, 256, true);1103 assertEq(view.getInt16(0, true), 256);1104 checkThrow(function () view.setInt16(5, 26213, true), RangeError);1105 checkThrow(function () view.setInt16(9, -32127, true), RangeError);1106 checkThrow(function () view.setInt16(14, -2, true), RangeError);1107 view.setInt16(0, 1);1108 assertEq(view.getInt16(0), 1);1109 checkThrow(function () view.setInt16(5, 25958), RangeError);1110 checkThrow(function () view.setInt16(9, -32382), RangeError);1111 checkThrow(function () view.setInt16(14, -257), RangeError);1112 view.setUint16(0, 256, true);1113 assertEq(view.getUint16(0, true), 256);1114 checkThrow(function () view.setUint16(5, 26213, true), RangeError);1115 checkThrow(function () view.setUint16(9, 33409, true), RangeError);1116 checkThrow(function () view.setUint16(14, 65534, true), RangeError);1117 view.setUint16(0, 1);1118 assertEq(view.getUint16(0), 1);1119 checkThrow(function () view.setUint16(5, 25958), RangeError);1120 checkThrow(function () view.setUint16(9, 33154), RangeError);1121 checkThrow(function () view.setUint16(14, 65279), RangeError);1122 checkThrow(function () view.setInt32(0, 50462976, true), RangeError);1123 checkThrow(function () view.setInt32(3, 1717920771, true), RangeError);1124 checkThrow(function () view.setInt32(6, -2122291354, true), RangeError);1125 checkThrow(function () view.setInt32(9, -58490239, true), RangeError);1126 checkThrow(function () view.setInt32(12, -66052, true), RangeError);1127 checkThrow(function () view.setInt32(0, 66051), RangeError);1128 checkThrow(function () view.setInt32(3, 56911206), RangeError);1129 checkThrow(function () view.setInt32(6, 1718059137), RangeError);1130 checkThrow(function () view.setInt32(9, -2122152964), RangeError);1131 checkThrow(function () view.setInt32(12, -50462977), RangeError);1132 checkThrow(function () view.setUint32(0, 50462976, true), RangeError);1133 checkThrow(function () view.setUint32(3, 1717920771, true), RangeError);1134 checkThrow(function () view.setUint32(6, 2172675942, true), RangeError);1135 checkThrow(function () view.setUint32(9, 4236477057, true), RangeError);1136 checkThrow(function () view.setUint32(12, 4294901244, true), RangeError);1137 checkThrow(function () view.setUint32(0, 66051), RangeError);1138 checkThrow(function () view.setUint32(3, 56911206), RangeError);1139 checkThrow(function () view.setUint32(6, 1718059137), RangeError);1140 checkThrow(function () view.setUint32(9, 2172814332), RangeError);1141 checkThrow(function () view.setUint32(12, 4244504319), RangeError);1142 // testFloatSets(start=7)1143 // testFloatSet expected=101144 // Little endian1145 view = new DataView(buffer13, 7, 9);1146 view.setFloat32(0, 10, true);1147 assertEq(view.getFloat32(0, true), 10);1148 view = new DataView(buffer13_pad3, 7, 12);1149 view.setFloat32(3, 10, true);1150 assertEq(view.getFloat32(3, true), 10);1151 view = new DataView(buffer13_pad7, 7, 16);1152 view.setFloat32(7, 10, true);1153 assertEq(view.getFloat32(7, true), 10);1154 view = new DataView(buffer13_pad10, 7, 19);1155 view.setFloat32(10, 10, true);1156 assertEq(view.getFloat32(10, true), 10);1157 // Big endian.1158 view = new DataView(buffer13_r, 7, 9);1159 view.setFloat32(0, 10, false);1160 assertEq(view.getFloat32(0, false), 10);1161 view = new DataView(buffer13_r_pad3, 7, 12);1162 view.setFloat32(3, 10, false);1163 assertEq(view.getFloat32(3, false), 10);1164 view = new DataView(buffer13_r_pad7, 7, 16);1165 view.setFloat32(7, 10, false);1166 assertEq(view.getFloat32(7, false), 10);1167 view = new DataView(buffer13_r_pad10, 7, 19);1168 view.setFloat32(10, 10, false);1169 assertEq(view.getFloat32(10, false), 10);1170 // testFloatSet expected=1.23000001907348631171 // Little endian1172 view = new DataView(buffer13, 7, 9);1173 view.setFloat32(0, 1.2300000190734863, true);1174 assertEq(view.getFloat32(0, true), 1.2300000190734863);1175 view = new DataView(buffer13_pad3, 7, 12);1176 view.setFloat32(3, 1.2300000190734863, true);1177 assertEq(view.getFloat32(3, true), 1.2300000190734863);1178 view = new DataView(buffer13_pad7, 7, 16);1179 view.setFloat32(7, 1.2300000190734863, true);1180 assertEq(view.getFloat32(7, true), 1.2300000190734863);1181 view = new DataView(buffer13_pad10, 7, 19);1182 view.setFloat32(10, 1.2300000190734863, true);1183 assertEq(view.getFloat32(10, true), 1.2300000190734863);1184 // Big endian.1185 view = new DataView(buffer13_r, 7, 9);1186 view.setFloat32(0, 1.2300000190734863, false);1187 assertEq(view.getFloat32(0, false), 1.2300000190734863);1188 view = new DataView(buffer13_r_pad3, 7, 12);1189 view.setFloat32(3, 1.2300000190734863, false);1190 assertEq(view.getFloat32(3, false), 1.2300000190734863);1191 view = new DataView(buffer13_r_pad7, 7, 16);1192 view.setFloat32(7, 1.2300000190734863, false);1193 assertEq(view.getFloat32(7, false), 1.2300000190734863);1194 view = new DataView(buffer13_r_pad10, 7, 19);1195 view.setFloat32(10, 1.2300000190734863, false);1196 assertEq(view.getFloat32(10, false), 1.2300000190734863);1197 // testFloatSet expected=-45621.371093751198 // Little endian1199 view = new DataView(buffer13, 7, 9);1200 view.setFloat32(0, -45621.37109375, true);1201 assertEq(view.getFloat32(0, true), -45621.37109375);1202 view = new DataView(buffer13_pad3, 7, 12);1203 view.setFloat32(3, -45621.37109375, true);1204 assertEq(view.getFloat32(3, true), -45621.37109375);1205 view = new DataView(buffer13_pad7, 7, 16);1206 view.setFloat32(7, -45621.37109375, true);1207 assertEq(view.getFloat32(7, true), -45621.37109375);1208 view = new DataView(buffer13_pad10, 7, 19);1209 view.setFloat32(10, -45621.37109375, true);1210 assertEq(view.getFloat32(10, true), -45621.37109375);1211 // Big endian.1212 view = new DataView(buffer13_r, 7, 9);1213 view.setFloat32(0, -45621.37109375, false);1214 assertEq(view.getFloat32(0, false), -45621.37109375);1215 view = new DataView(buffer13_r_pad3, 7, 12);1216 view.setFloat32(3, -45621.37109375, false);1217 assertEq(view.getFloat32(3, false), -45621.37109375);1218 view = new DataView(buffer13_r_pad7, 7, 16);1219 view.setFloat32(7, -45621.37109375, false);1220 assertEq(view.getFloat32(7, false), -45621.37109375);1221 view = new DataView(buffer13_r_pad10, 7, 19);1222 view.setFloat32(10, -45621.37109375, false);1223 assertEq(view.getFloat32(10, false), -45621.37109375);1224 // testFloatSet expected=NaN1225 // Little endian1226 view = new DataView(buffer13, 7, 9);1227 view.setFloat32(0, NaN, true);1228 assertEq(view.getFloat32(0, true), NaN);1229 view = new DataView(buffer13_pad3, 7, 12);1230 view.setFloat32(3, NaN, true);1231 assertEq(view.getFloat32(3, true), NaN);1232 view = new DataView(buffer13_pad7, 7, 16);1233 view.setFloat32(7, NaN, true);1234 assertEq(view.getFloat32(7, true), NaN);1235 view = new DataView(buffer13_pad10, 7, 19);1236 view.setFloat32(10, NaN, true);1237 assertEq(view.getFloat32(10, true), NaN);1238 // Big endian.1239 view = new DataView(buffer13_r, 7, 9);1240 view.setFloat32(0, NaN, false);1241 assertEq(view.getFloat32(0, false), NaN);1242 view = new DataView(buffer13_r_pad3, 7, 12);1243 view.setFloat32(3, NaN, false);1244 assertEq(view.getFloat32(3, false), NaN);1245 view = new DataView(buffer13_r_pad7, 7, 16);1246 view.setFloat32(7, NaN, false);1247 assertEq(view.getFloat32(7, false), NaN);1248 view = new DataView(buffer13_r_pad10, 7, 19);1249 view.setFloat32(10, NaN, false);1250 assertEq(view.getFloat32(10, false), NaN);1251 // testFloatSet expected=-NaN1252 // Little endian1253 view = new DataView(buffer13, 7, 9);1254 view.setFloat32(0, -NaN, true);1255 assertEq(view.getFloat32(0, true), -NaN);1256 view = new DataView(buffer13_pad3, 7, 12);1257 view.setFloat32(3, -NaN, true);1258 assertEq(view.getFloat32(3, true), -NaN);1259 view = new DataView(buffer13_pad7, 7, 16);1260 view.setFloat32(7, -NaN, true);1261 assertEq(view.getFloat32(7, true), -NaN);1262 view = new DataView(buffer13_pad10, 7, 19);1263 view.setFloat32(10, -NaN, true);1264 assertEq(view.getFloat32(10, true), -NaN);1265 // Big endian.1266 view = new DataView(buffer13_r, 7, 9);1267 view.setFloat32(0, -NaN, false);1268 assertEq(view.getFloat32(0, false), -NaN);1269 view = new DataView(buffer13_r_pad3, 7, 12);1270 view.setFloat32(3, -NaN, false);1271 assertEq(view.getFloat32(3, false), -NaN);1272 view = new DataView(buffer13_r_pad7, 7, 16);1273 view.setFloat32(7, -NaN, false);1274 assertEq(view.getFloat32(7, false), -NaN);1275 view = new DataView(buffer13_r_pad10, 7, 19);1276 view.setFloat32(10, -NaN, false);1277 assertEq(view.getFloat32(10, false), -NaN);1278 // testFloatSet expected=101279 // Little endian1280 view = new DataView(buffer13, 7, 9);1281 view.setFloat64(0, 10, true);1282 assertEq(view.getFloat64(0, true), 10);1283 view = new DataView(buffer13_pad3, 7, 12);1284 view.setFloat64(3, 10, true);1285 assertEq(view.getFloat64(3, true), 10);1286 view = new DataView(buffer13_pad7, 7, 16);1287 view.setFloat64(7, 10, true);1288 assertEq(view.getFloat64(7, true), 10);1289 view = new DataView(buffer13_pad10, 7, 19);1290 view.setFloat64(10, 10, true);1291 assertEq(view.getFloat64(10, true), 10);1292 // Big endian.1293 view = new DataView(buffer13_r, 7, 9);1294 view.setFloat64(0, 10, false);1295 assertEq(view.getFloat64(0, false), 10);1296 view = new DataView(buffer13_r_pad3, 7, 12);1297 view.setFloat64(3, 10, false);1298 assertEq(view.getFloat64(3, false), 10);1299 view = new DataView(buffer13_r_pad7, 7, 16);1300 view.setFloat64(7, 10, false);1301 assertEq(view.getFloat64(7, false), 10);1302 view = new DataView(buffer13_r_pad10, 7, 19);1303 view.setFloat64(10, 10, false);1304 assertEq(view.getFloat64(10, false), 10);1305 // testFloatSet expected=1.231306 // Little endian1307 view = new DataView(buffer13, 7, 9);1308 view.setFloat64(0, 1.23, true);1309 assertEq(view.getFloat64(0, true), 1.23);1310 view = new DataView(buffer13_pad3, 7, 12);1311 view.setFloat64(3, 1.23, true);1312 assertEq(view.getFloat64(3, true), 1.23);1313 view = new DataView(buffer13_pad7, 7, 16);1314 view.setFloat64(7, 1.23, true);1315 assertEq(view.getFloat64(7, true), 1.23);1316 view = new DataView(buffer13_pad10, 7, 19);1317 view.setFloat64(10, 1.23, true);1318 assertEq(view.getFloat64(10, true), 1.23);1319 // Big endian.1320 view = new DataView(buffer13_r, 7, 9);1321 view.setFloat64(0, 1.23, false);1322 assertEq(view.getFloat64(0, false), 1.23);1323 view = new DataView(buffer13_r_pad3, 7, 12);1324 view.setFloat64(3, 1.23, false);1325 assertEq(view.getFloat64(3, false), 1.23);1326 view = new DataView(buffer13_r_pad7, 7, 16);1327 view.setFloat64(7, 1.23, false);1328 assertEq(view.getFloat64(7, false), 1.23);1329 view = new DataView(buffer13_r_pad10, 7, 19);1330 view.setFloat64(10, 1.23, false);1331 assertEq(view.getFloat64(10, false), 1.23);1332 // testFloatSet expected=-6213576.48391333 // Little endian1334 view = new DataView(buffer13, 7, 9);1335 view.setFloat64(0, -6213576.4839, true);1336 assertEq(view.getFloat64(0, true), -6213576.4839);1337 view = new DataView(buffer13_pad3, 7, 12);1338 view.setFloat64(3, -6213576.4839, true);1339 assertEq(view.getFloat64(3, true), -6213576.4839);1340 view = new DataView(buffer13_pad7, 7, 16);1341 view.setFloat64(7, -6213576.4839, true);1342 assertEq(view.getFloat64(7, true), -6213576.4839);1343 view = new DataView(buffer13_pad10, 7, 19);1344 view.setFloat64(10, -6213576.4839, true);1345 assertEq(view.getFloat64(10, true), -6213576.4839);1346 // Big endian.1347 view = new DataView(buffer13_r, 7, 9);1348 view.setFloat64(0, -6213576.4839, false);1349 assertEq(view.getFloat64(0, false), -6213576.4839);1350 view = new DataView(buffer13_r_pad3, 7, 12);1351 view.setFloat64(3, -6213576.4839, false);1352 assertEq(view.getFloat64(3, false), -6213576.4839);1353 view = new DataView(buffer13_r_pad7, 7, 16);1354 view.setFloat64(7, -6213576.4839, false);1355 assertEq(view.getFloat64(7, false), -6213576.4839);1356 view = new DataView(buffer13_r_pad10, 7, 19);1357 view.setFloat64(10, -6213576.4839, false);1358 assertEq(view.getFloat64(10, false), -6213576.4839);1359 // testFloatSet expected=NaN1360 // Little endian1361 view = new DataView(buffer13, 7, 9);1362 view.setFloat64(0, NaN, true);1363 assertEq(view.getFloat64(0, true), NaN);1364 view = new DataView(buffer13_pad3, 7, 12);1365 view.setFloat64(3, NaN, true);1366 assertEq(view.getFloat64(3, true), NaN);1367 view = new DataView(buffer13_pad7, 7, 16);1368 view.setFloat64(7, NaN, true);1369 assertEq(view.getFloat64(7, true), NaN);1370 view = new DataView(buffer13_pad10, 7, 19);1371 view.setFloat64(10, NaN, true);1372 assertEq(view.getFloat64(10, true), NaN);1373 // Big endian.1374 view = new DataView(buffer13_r, 7, 9);1375 view.setFloat64(0, NaN, false);1376 assertEq(view.getFloat64(0, false), NaN);1377 view = new DataView(buffer13_r_pad3, 7, 12);1378 view.setFloat64(3, NaN, false);1379 assertEq(view.getFloat64(3, false), NaN);1380 view = new DataView(buffer13_r_pad7, 7, 16);1381 view.setFloat64(7, NaN, false);1382 assertEq(view.getFloat64(7, false), NaN);1383 view = new DataView(buffer13_r_pad10, 7, 19);1384 view.setFloat64(10, NaN, false);1385 assertEq(view.getFloat64(10, false), NaN);1386 // testFloatSet expected=-NaN1387 // Little endian1388 view = new DataView(buffer13, 7, 9);1389 view.setFloat64(0, -NaN, true);1390 assertEq(view.getFloat64(0, true), -NaN);1391 view = new DataView(buffer13_pad3, 7, 12);1392 view.setFloat64(3, -NaN, true);1393 assertEq(view.getFloat64(3, true), -NaN);1394 view = new DataView(buffer13_pad7, 7, 16);1395 view.setFloat64(7, -NaN, true);1396 assertEq(view.getFloat64(7, true), -NaN);1397 view = new DataView(buffer13_pad10, 7, 19);1398 view.setFloat64(10, -NaN, true);1399 assertEq(view.getFloat64(10, true), -NaN);1400 // Big endian.1401 view = new DataView(buffer13_r, 7, 9);1402 view.setFloat64(0, -NaN, false);1403 assertEq(view.getFloat64(0, false), -NaN);1404 view = new DataView(buffer13_r_pad3, 7, 12);1405 view.setFloat64(3, -NaN, false);1406 assertEq(view.getFloat64(3, false), -NaN);1407 view = new DataView(buffer13_r_pad7, 7, 16);1408 view.setFloat64(7, -NaN, false);1409 assertEq(view.getFloat64(7, false), -NaN);1410 view = new DataView(buffer13_r_pad10, 7, 19);1411 view.setFloat64(10, -NaN, false);1412 assertEq(view.getFloat64(10, false), -NaN);1413 // Test for set methods that write to negative index1414 // testSetNegativeIndexes1415 view = new DataView(buffer1, 0, 16);1416 checkThrow(function () view.setInt8(-1, 0), RangeError);1417 checkThrow(function () view.setInt8(-2, 0), RangeError);1418 checkThrow(function () view.setUint8(-1, 0), RangeError);1419 checkThrow(function () view.setUint8(-2, 0), RangeError);1420 checkThrow(function () view.setInt16(-1, 0), RangeError);1421 checkThrow(function () view.setInt16(-2, 0), RangeError);1422 checkThrow(function () view.setInt16(-3, 0), RangeError);1423 checkThrow(function () view.setUint16(-1, 0), RangeError);1424 checkThrow(function () view.setUint16(-2, 0), RangeError);1425 checkThrow(function () view.setUint16(-3, 0), RangeError);1426 checkThrow(function () view.setInt32(-1, 0), RangeError);1427 checkThrow(function () view.setInt32(-3, 0), RangeError);1428 checkThrow(function () view.setInt32(-5, 0), RangeError);1429 checkThrow(function () view.setUint32(-1, 0), RangeError);1430 checkThrow(function () view.setUint32(-3, 0), RangeError);1431 checkThrow(function () view.setUint32(-5, 0), RangeError);1432 view = new DataView(buffer7, 0, 8);1433 checkThrow(function () view.setFloat32(-1, 0), RangeError);1434 checkThrow(function () view.setFloat32(-3, 0), RangeError);1435 checkThrow(function () view.setFloat32(-5, 0), RangeError);1436 checkThrow(function () view.setFloat64(-1, 0), RangeError);1437 checkThrow(function () view.setFloat64(-5, 0), RangeError);1438 checkThrow(function () view.setFloat64(-9, 0), RangeError);1439 // Too large for signed 32 bit integer index1440 checkThrow(function () view.setInt8(2147483649, 1), RangeError);1441 checkThrow(function () view.setUint8(2147483649, 1), RangeError);1442 checkThrow(function () view.setInt16(2147483649, 1), RangeError);1443 checkThrow(function () view.setUint16(2147483649, 1), RangeError);1444 checkThrow(function () view.setInt32(2147483649, 1), RangeError);1445 checkThrow(function () view.setUint32(2147483649, 1), RangeError);1446 checkThrow(function () view.setFloat32(2147483649, 1), RangeError);1447 checkThrow(function () view.setFloat64(2147483649, 1), RangeError);1448 // Test for wrong arguments passed to set methods1449 checkThrow(function () view.setInt8(), Error);1450 checkThrow(function () view.setUint8(), Error);1451 checkThrow(function () view.setInt16(), Error);1452 checkThrow(function () view.setUint16(), Error);1453 checkThrow(function () view.setInt32(), Error);1454 checkThrow(function () view.setUint32(), Error);1455 checkThrow(function () view.setFloat32(), Error);1456 checkThrow(function () view.setFloat64(), Error);1457 checkThrow(function () view.setInt8(1), Error);1458 checkThrow(function () view.setUint8(1), Error);1459 checkThrow(function () view.setInt16(1), Error);1460 checkThrow(function () view.setUint16(1), Error);1461 checkThrow(function () view.setInt32(1), Error);1462 checkThrow(function () view.setUint32(1), Error);1463 checkThrow(function () view.setFloat32(1), Error);1464 checkThrow(function () view.setFloat64(1), Error);1465 // testAlignment1466 var intArray1 = [0, 1, 2, 3, 100, 101, 102, 103, 128, 129, 130, 131, 252, 253, 254, 255];1467 view = new DataView((new Uint8Array(intArray1)).buffer, 0);1468 assertEq(view.getUint32(0, false), 0x00010203);1469 view = new DataView((new Uint8Array(intArray1)).buffer, 1);1470 assertEq(view.getUint32(0, false), 0x01020364);1471 view = new DataView((new Uint8Array(intArray1)).buffer, 2);1472 assertEq(view.getUint32(0, false), 0x02036465);1473 view = new DataView((new Uint8Array(intArray1)).buffer, 3);1474 assertEq(view.getUint32(0, false), 0x03646566);1475 view = new DataView((new Uint8Array(intArray1)).buffer, 4);1476 assertEq(view.getUint32(0, false), 0x64656667);1477 view = new DataView((new Uint8Array(intArray1)).buffer, 5);1478 assertEq(view.getUint32(0, false), 0x65666780);1479 view = new DataView((new Uint8Array(intArray1)).buffer, 6);1480 assertEq(view.getUint32(0, false), 0x66678081);1481 view = new DataView((new Uint8Array(intArray1)).buffer, 7);1482 assertEq(view.getUint32(0, false), 0x67808182);1483 // Test for indexing into a DataView, which should not use the ArrayBuffer storage1484 view = new DataView((new Uint8Array([1, 2])).buffer);1485 assertEq(view[0], undefined);1486 view[0] = 3;1487 assertEq(view[0], 3);1488 assertEq(view.getUint8(0), 1);1489 // Test WebIDL-specific class and prototype class names1490 assertEq(Object.prototype.toString.apply(Uint8Array(0)), "[object Uint8Array]");1491 assertEq(Object.prototype.toString.apply(Float32Array(0)), "[object Float32Array]");1492 assertEq(Object.prototype.toString.apply(Uint8Array.prototype), "[object Uint8ArrayPrototype]");1493 assertEq(Object.prototype.toString.apply(Float32Array.prototype), "[object Float32ArrayPrototype]");1494 assertEq(Object.prototype.toString.apply(ArrayBuffer()), "[object ArrayBuffer]");1495 assertEq(Object.prototype.toString.apply(DataView(view.buffer)), "[object DataView]");1496 assertEq(Object.prototype.toString.apply(DataView.prototype), "[object DataViewPrototype]");1497 // Accessing DataView fields on DataView.prototype should crash1498 checkThrow(function () DataView.prototype.byteLength, TypeError);1499 checkThrow(function () DataView.prototype.byteOffset, TypeError);1500 checkThrow(function () DataView.prototype.buffer, TypeError);1501 // Protos and proxies, oh my!1502 var alien = newGlobal('new-compartment');1503 var alien_data = alien.eval('data = ' + data1.toSource());1504 var alien_buffer = alien.eval('buffer = new Uint8Array(data).buffer');1505 var alien_view = alien.eval('view = new DataView(buffer, 0, 16)');1506 // proto is view of buffer: should throw1507 var o = Object.create(view1);1508 checkThrow(function () o.getUint8(4), TypeError); // WebIDL 4.4.7: Operations1509 checkThrow(function () o.buffer, TypeError); // WebIDL 4.4.6: Attributes, section 21510 checkThrow(function () o.byteOffset, TypeError);1511 checkThrow(function () o.byteLength, TypeError);1512 // proxy for view of buffer: should work1513 assertEq(alien_view.buffer.byteLength > 0, true);1514 assertEq(alien_view.getUint8(4), 100);1515 // Bug 753996: when throwing an Error whose message contains the name of a1516 // function, the JS engine calls js_ValueToFunction to produce the function1517 // name to include in the message. js_ValueToFunction does not unwrap its1518 // argument. So if the function is actually a wrapper, then1519 // js_ValueToFunction will throw a TypeError ("X is not a function").1520 // Confusingly, this TypeError uses the decompiler, which *will* unwrap the1521 // object to get the wrapped function name out, so the final error will1522 // look something like "SomeFunction() is not a function".)1523 var weirdo = Object.create(alien.eval("new Date"));1524 var e = null;1525 try {1526 weirdo.getTime();1527 } catch (exc) {1528 e = exc;1529 }1530 if (!e) {1531 print("==== TODO but PASSED? ====");1532 print("Bug 753996 unexpectedly passed");1533 }1534 // proto is proxy for view of buffer: should throw TypeError1535 //1536 // As of this writing, bug 753996 causes this to throw the *wrong*1537 // TypeError, and in fact it throws a (thisglobal).TypeError instead of1538 // alien.TypeError.1539 var av = Object.create(alien_view);1540 checkThrowTODO(function () av.getUint8(4), alien.TypeError);1541 checkThrowTODO(function () av.buffer, alien.TypeError);1542 // view of object whose proto is buffer. This should not work per dherman.1543 // Note that DataView throws a TypeError while TypedArrays create a1544 // zero-length view. Odd though it seems, this is correct: TypedArrays have1545 // a constructor that takes a length argument; DataViews do not. So a1546 // TypedArray will do ToUint32 and end up passing a zero as the1547 // constructor's length argument.1548 buffer = Object.create(buffer1);1549 checkThrow(function () new DataView(buffer), TypeError);1550 // view of proxy for buffer1551 av = new DataView(alien_buffer);1552 assertEq(av.getUint8(4), 100);1553 assertEq(Object.getPrototypeOf(av), DataView.prototype);1554 // Bug 760904: call another compartment's constructor with an ArrayBuffer1555 // from this compartment, both as a constructor and as a regular call. (The1556 // latter is what was broken in that bug.)1557 var alien_constructor = alien.DataView;1558 var local_buffer = (new Int8Array(3)).buffer;1559 var foreign_exchange_student_1 = alien_constructor(local_buffer);1560 var foreign_exchange_student_2 = new alien_constructor(local_buffer);1561 // gc bug 7877751562 var ab = new ArrayBuffer(4);1563 var dv = new DataView(ab);1564 dv = 1;1565 gc();1566 reportCompare(0, 0, 'done.');1567 exitFunc ('test');1568}...

Full Screen

Full Screen

subpass-input.ios.framebuffer-fetch.asm.frag

Source:subpass-input.ios.framebuffer-fetch.asm.frag Github

copy

Full Screen

1; SPIR-V2; Version: 1.03; Generator: Google spiregg; 04; Bound: 1305; Schema: 06 OpCapability Shader7 OpCapability InputAttachment8 OpExtension "SPV_GOOGLE_hlsl_functionality1"9 %1 = OpExtInstImport "GLSL.std.450"10 OpMemoryModel Logical GLSL45011 OpEntryPoint Fragment %Main "main" %gl_FragCoord %out_var_SV_Target012 OpExecutionMode %Main OriginUpperLeft13 OpSource HLSL 60014 OpName %type_subpass_image "type.subpass.image"15 OpName %gl_LastFragData "gl_LastFragData"16 OpName %type_View "type.View"17 OpMemberName %type_View 0 "View_TranslatedWorldToClip"18 OpMemberName %type_View 1 "View_WorldToClip"19 OpMemberName %type_View 2 "View_TranslatedWorldToView"20 OpMemberName %type_View 3 "View_ViewToTranslatedWorld"21 OpMemberName %type_View 4 "View_TranslatedWorldToCameraView"22 OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld"23 OpMemberName %type_View 6 "View_ViewToClip"24 OpMemberName %type_View 7 "View_ViewToClipNoAA"25 OpMemberName %type_View 8 "View_ClipToView"26 OpMemberName %type_View 9 "View_ClipToTranslatedWorld"27 OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld"28 OpMemberName %type_View 11 "View_ScreenToWorld"29 OpMemberName %type_View 12 "View_ScreenToTranslatedWorld"30 OpMemberName %type_View 13 "View_ViewForward"31 OpMemberName %type_View 14 "PrePadding_View_844"32 OpMemberName %type_View 15 "View_ViewUp"33 OpMemberName %type_View 16 "PrePadding_View_860"34 OpMemberName %type_View 17 "View_ViewRight"35 OpMemberName %type_View 18 "PrePadding_View_876"36 OpMemberName %type_View 19 "View_HMDViewNoRollUp"37 OpMemberName %type_View 20 "PrePadding_View_892"38 OpMemberName %type_View 21 "View_HMDViewNoRollRight"39 OpMemberName %type_View 22 "PrePadding_View_908"40 OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform"41 OpMemberName %type_View 24 "View_ScreenPositionScaleBias"42 OpMemberName %type_View 25 "View_WorldCameraOrigin"43 OpMemberName %type_View 26 "PrePadding_View_956"44 OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin"45 OpMemberName %type_View 28 "PrePadding_View_972"46 OpMemberName %type_View 29 "View_WorldViewOrigin"47 OpMemberName %type_View 30 "PrePadding_View_988"48 OpMemberName %type_View 31 "View_PreViewTranslation"49 OpMemberName %type_View 32 "PrePadding_View_1004"50 OpMemberName %type_View 33 "View_PrevProjection"51 OpMemberName %type_View 34 "View_PrevViewProj"52 OpMemberName %type_View 35 "View_PrevViewRotationProj"53 OpMemberName %type_View 36 "View_PrevViewToClip"54 OpMemberName %type_View 37 "View_PrevClipToView"55 OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip"56 OpMemberName %type_View 39 "View_PrevTranslatedWorldToView"57 OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld"58 OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView"59 OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld"60 OpMemberName %type_View 43 "View_PrevWorldCameraOrigin"61 OpMemberName %type_View 44 "PrePadding_View_1660"62 OpMemberName %type_View 45 "View_PrevWorldViewOrigin"63 OpMemberName %type_View 46 "PrePadding_View_1676"64 OpMemberName %type_View 47 "View_PrevPreViewTranslation"65 OpMemberName %type_View 48 "PrePadding_View_1692"66 OpMemberName %type_View 49 "View_PrevInvViewProj"67 OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld"68 OpMemberName %type_View 51 "View_ClipToPrevClip"69 OpMemberName %type_View 52 "View_TemporalAAJitter"70 OpMemberName %type_View 53 "View_GlobalClippingPlane"71 OpMemberName %type_View 54 "View_FieldOfViewWideAngles"72 OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles"73 OpMemberName %type_View 56 "View_ViewRectMin"74 OpMemberName %type_View 57 "View_ViewSizeAndInvSize"75 OpMemberName %type_View 58 "View_BufferSizeAndInvSize"76 OpMemberName %type_View 59 "View_BufferBilinearUVMinMax"77 OpMemberName %type_View 60 "View_NumSceneColorMSAASamples"78 OpMemberName %type_View 61 "View_PreExposure"79 OpMemberName %type_View 62 "View_OneOverPreExposure"80 OpMemberName %type_View 63 "PrePadding_View_2012"81 OpMemberName %type_View 64 "View_DiffuseOverrideParameter"82 OpMemberName %type_View 65 "View_SpecularOverrideParameter"83 OpMemberName %type_View 66 "View_NormalOverrideParameter"84 OpMemberName %type_View 67 "View_RoughnessOverrideParameter"85 OpMemberName %type_View 68 "View_PrevFrameGameTime"86 OpMemberName %type_View 69 "View_PrevFrameRealTime"87 OpMemberName %type_View 70 "View_OutOfBoundsMask"88 OpMemberName %type_View 71 "PrePadding_View_2084"89 OpMemberName %type_View 72 "PrePadding_View_2088"90 OpMemberName %type_View 73 "PrePadding_View_2092"91 OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame"92 OpMemberName %type_View 75 "View_CullingSign"93 OpMemberName %type_View 76 "View_NearPlane"94 OpMemberName %type_View 77 "View_AdaptiveTessellationFactor"95 OpMemberName %type_View 78 "View_GameTime"96 OpMemberName %type_View 79 "View_RealTime"97 OpMemberName %type_View 80 "View_DeltaTime"98 OpMemberName %type_View 81 "View_MaterialTextureMipBias"99 OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply"100 OpMemberName %type_View 83 "View_Random"101 OpMemberName %type_View 84 "View_FrameNumber"102 OpMemberName %type_View 85 "View_StateFrameIndexMod8"103 OpMemberName %type_View 86 "View_StateFrameIndex"104 OpMemberName %type_View 87 "View_CameraCut"105 OpMemberName %type_View 88 "View_UnlitViewmodeMask"106 OpMemberName %type_View 89 "PrePadding_View_2164"107 OpMemberName %type_View 90 "PrePadding_View_2168"108 OpMemberName %type_View 91 "PrePadding_View_2172"109 OpMemberName %type_View 92 "View_DirectionalLightColor"110 OpMemberName %type_View 93 "View_DirectionalLightDirection"111 OpMemberName %type_View 94 "PrePadding_View_2204"112 OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin"113 OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize"114 OpMemberName %type_View 97 "View_TemporalAAParams"115 OpMemberName %type_View 98 "View_CircleDOFParams"116 OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth"117 OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance"118 OpMemberName %type_View 101 "View_DepthOfFieldScale"119 OpMemberName %type_View 102 "View_DepthOfFieldFocalLength"120 OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion"121 OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion"122 OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion"123 OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel"124 OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled"125 OpMemberName %type_View 108 "View_GeneralPurposeTweak"126 OpMemberName %type_View 109 "View_DemosaicVposOffset"127 OpMemberName %type_View 110 "PrePadding_View_2348"128 OpMemberName %type_View 111 "View_IndirectLightingColorScale"129 OpMemberName %type_View 112 "View_HDR32bppEncodingMode"130 OpMemberName %type_View 113 "View_AtmosphericFogSunDirection"131 OpMemberName %type_View 114 "View_AtmosphericFogSunPower"132 OpMemberName %type_View 115 "View_AtmosphericFogPower"133 OpMemberName %type_View 116 "View_AtmosphericFogDensityScale"134 OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset"135 OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset"136 OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale"137 OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale"138 OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh"139 OpMemberName %type_View 122 "View_AtmosphericFogStartDistance"140 OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset"141 OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale"142 OpMemberName %type_View 125 "View_AtmosphericFogRenderMask"143 OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum"144 OpMemberName %type_View 127 "View_AtmosphericFogSunColor"145 OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias"146 OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask"147 OpMemberName %type_View 130 "View_AmbientCubemapTint"148 OpMemberName %type_View 131 "View_AmbientCubemapIntensity"149 OpMemberName %type_View 132 "View_SkyLightParameters"150 OpMemberName %type_View 133 "PrePadding_View_2488"151 OpMemberName %type_View 134 "PrePadding_View_2492"152 OpMemberName %type_View 135 "View_SkyLightColor"153 OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap"154 OpMemberName %type_View 137 "View_MobilePreviewMode"155 OpMemberName %type_View 138 "View_HMDEyePaddingOffset"156 OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip"157 OpMemberName %type_View 140 "View_ShowDecalsMask"158 OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode"159 OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity"160 OpMemberName %type_View 143 "PrePadding_View_2648"161 OpMemberName %type_View 144 "PrePadding_View_2652"162 OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight"163 OpMemberName %type_View 146 "View_StereoPassIndex"164 OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent"165 OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul"166 OpMemberName %type_View 149 "View_GlobalVolumeDimension"167 OpMemberName %type_View 150 "View_GlobalVolumeTexelSize"168 OpMemberName %type_View 151 "View_MaxGlobalDistance"169 OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering"170 OpMemberName %type_View 153 "View_VolumetricFogInvGridSize"171 OpMemberName %type_View 154 "PrePadding_View_2828"172 OpMemberName %type_View 155 "View_VolumetricFogGridZParams"173 OpMemberName %type_View 156 "PrePadding_View_2844"174 OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV"175 OpMemberName %type_View 158 "View_VolumetricFogMaxDistance"176 OpMemberName %type_View 159 "PrePadding_View_2860"177 OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale"178 OpMemberName %type_View 161 "PrePadding_View_2876"179 OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd"180 OpMemberName %type_View 163 "PrePadding_View_2892"181 OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize"182 OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize"183 OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize"184 OpMemberName %type_View 167 "View_StereoIPD"185 OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag"186 OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle"187 OpName %View "View"188 OpName %type_sampler "type.sampler"189 OpName %type_2d_image "type.2d.image"190 OpName %ShadowDepthTexture "ShadowDepthTexture"191 OpName %ShadowDepthTextureSampler "ShadowDepthTextureSampler"192 OpName %type__Globals "type.$Globals"193 OpMemberName %type__Globals 0 "SoftTransitionScale"194 OpMemberName %type__Globals 1 "ShadowBufferSize"195 OpMemberName %type__Globals 2 "ShadowFadeFraction"196 OpMemberName %type__Globals 3 "ShadowSharpen"197 OpMemberName %type__Globals 4 "LightPositionAndInvRadius"198 OpMemberName %type__Globals 5 "ScreenToShadowMatrix"199 OpMemberName %type__Globals 6 "ProjectionDepthBiasParameters"200 OpMemberName %type__Globals 7 "ModulatedShadowColor"201 OpMemberName %type__Globals 8 "ShadowTileOffsetAndSize"202 OpName %_Globals "$Globals"203 OpName %out_var_SV_Target0 "out.var.SV_Target0"204 OpName %Main "Main"205 OpName %type_sampled_image "type.sampled.image"206 OpDecorate %gl_LastFragData InputAttachmentIndex 0207 OpDecorate %gl_FragCoord BuiltIn FragCoord208 OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION"209 OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0"210 OpDecorate %out_var_SV_Target0 Location 0211 OpDecorate %gl_LastFragData DescriptorSet 0212 OpDecorate %gl_LastFragData Binding 0213 OpDecorate %View DescriptorSet 0214 OpDecorate %View Binding 0215 OpDecorate %ShadowDepthTexture DescriptorSet 0216 OpDecorate %ShadowDepthTexture Binding 0217 OpDecorate %ShadowDepthTextureSampler DescriptorSet 0218 OpDecorate %ShadowDepthTextureSampler Binding 0219 OpDecorate %_Globals DescriptorSet 0220 OpDecorate %_Globals Binding 1221 OpDecorate %_arr_v4float_uint_2 ArrayStride 16222 OpDecorate %_arr_v4float_uint_7 ArrayStride 16223 OpDecorate %_arr_v4float_uint_4 ArrayStride 16224 OpMemberDecorate %type_View 0 Offset 0225 OpMemberDecorate %type_View 0 MatrixStride 16226 OpMemberDecorate %type_View 0 ColMajor227 OpMemberDecorate %type_View 1 Offset 64228 OpMemberDecorate %type_View 1 MatrixStride 16229 OpMemberDecorate %type_View 1 ColMajor230 OpMemberDecorate %type_View 2 Offset 128231 OpMemberDecorate %type_View 2 MatrixStride 16232 OpMemberDecorate %type_View 2 ColMajor233 OpMemberDecorate %type_View 3 Offset 192234 OpMemberDecorate %type_View 3 MatrixStride 16235 OpMemberDecorate %type_View 3 ColMajor236 OpMemberDecorate %type_View 4 Offset 256237 OpMemberDecorate %type_View 4 MatrixStride 16238 OpMemberDecorate %type_View 4 ColMajor239 OpMemberDecorate %type_View 5 Offset 320240 OpMemberDecorate %type_View 5 MatrixStride 16241 OpMemberDecorate %type_View 5 ColMajor242 OpMemberDecorate %type_View 6 Offset 384243 OpMemberDecorate %type_View 6 MatrixStride 16244 OpMemberDecorate %type_View 6 ColMajor245 OpMemberDecorate %type_View 7 Offset 448246 OpMemberDecorate %type_View 7 MatrixStride 16247 OpMemberDecorate %type_View 7 ColMajor248 OpMemberDecorate %type_View 8 Offset 512249 OpMemberDecorate %type_View 8 MatrixStride 16250 OpMemberDecorate %type_View 8 ColMajor251 OpMemberDecorate %type_View 9 Offset 576252 OpMemberDecorate %type_View 9 MatrixStride 16253 OpMemberDecorate %type_View 9 ColMajor254 OpMemberDecorate %type_View 10 Offset 640255 OpMemberDecorate %type_View 10 MatrixStride 16256 OpMemberDecorate %type_View 10 ColMajor257 OpMemberDecorate %type_View 11 Offset 704258 OpMemberDecorate %type_View 11 MatrixStride 16259 OpMemberDecorate %type_View 11 ColMajor260 OpMemberDecorate %type_View 12 Offset 768261 OpMemberDecorate %type_View 12 MatrixStride 16262 OpMemberDecorate %type_View 12 ColMajor263 OpMemberDecorate %type_View 13 Offset 832264 OpMemberDecorate %type_View 14 Offset 844265 OpMemberDecorate %type_View 15 Offset 848266 OpMemberDecorate %type_View 16 Offset 860267 OpMemberDecorate %type_View 17 Offset 864268 OpMemberDecorate %type_View 18 Offset 876269 OpMemberDecorate %type_View 19 Offset 880270 OpMemberDecorate %type_View 20 Offset 892271 OpMemberDecorate %type_View 21 Offset 896272 OpMemberDecorate %type_View 22 Offset 908273 OpMemberDecorate %type_View 23 Offset 912274 OpMemberDecorate %type_View 24 Offset 928275 OpMemberDecorate %type_View 25 Offset 944276 OpMemberDecorate %type_View 26 Offset 956277 OpMemberDecorate %type_View 27 Offset 960278 OpMemberDecorate %type_View 28 Offset 972279 OpMemberDecorate %type_View 29 Offset 976280 OpMemberDecorate %type_View 30 Offset 988281 OpMemberDecorate %type_View 31 Offset 992282 OpMemberDecorate %type_View 32 Offset 1004283 OpMemberDecorate %type_View 33 Offset 1008284 OpMemberDecorate %type_View 33 MatrixStride 16285 OpMemberDecorate %type_View 33 ColMajor286 OpMemberDecorate %type_View 34 Offset 1072287 OpMemberDecorate %type_View 34 MatrixStride 16288 OpMemberDecorate %type_View 34 ColMajor289 OpMemberDecorate %type_View 35 Offset 1136290 OpMemberDecorate %type_View 35 MatrixStride 16291 OpMemberDecorate %type_View 35 ColMajor292 OpMemberDecorate %type_View 36 Offset 1200293 OpMemberDecorate %type_View 36 MatrixStride 16294 OpMemberDecorate %type_View 36 ColMajor295 OpMemberDecorate %type_View 37 Offset 1264296 OpMemberDecorate %type_View 37 MatrixStride 16297 OpMemberDecorate %type_View 37 ColMajor298 OpMemberDecorate %type_View 38 Offset 1328299 OpMemberDecorate %type_View 38 MatrixStride 16300 OpMemberDecorate %type_View 38 ColMajor301 OpMemberDecorate %type_View 39 Offset 1392302 OpMemberDecorate %type_View 39 MatrixStride 16303 OpMemberDecorate %type_View 39 ColMajor304 OpMemberDecorate %type_View 40 Offset 1456305 OpMemberDecorate %type_View 40 MatrixStride 16306 OpMemberDecorate %type_View 40 ColMajor307 OpMemberDecorate %type_View 41 Offset 1520308 OpMemberDecorate %type_View 41 MatrixStride 16309 OpMemberDecorate %type_View 41 ColMajor310 OpMemberDecorate %type_View 42 Offset 1584311 OpMemberDecorate %type_View 42 MatrixStride 16312 OpMemberDecorate %type_View 42 ColMajor313 OpMemberDecorate %type_View 43 Offset 1648314 OpMemberDecorate %type_View 44 Offset 1660315 OpMemberDecorate %type_View 45 Offset 1664316 OpMemberDecorate %type_View 46 Offset 1676317 OpMemberDecorate %type_View 47 Offset 1680318 OpMemberDecorate %type_View 48 Offset 1692319 OpMemberDecorate %type_View 49 Offset 1696320 OpMemberDecorate %type_View 49 MatrixStride 16321 OpMemberDecorate %type_View 49 ColMajor322 OpMemberDecorate %type_View 50 Offset 1760323 OpMemberDecorate %type_View 50 MatrixStride 16324 OpMemberDecorate %type_View 50 ColMajor325 OpMemberDecorate %type_View 51 Offset 1824326 OpMemberDecorate %type_View 51 MatrixStride 16327 OpMemberDecorate %type_View 51 ColMajor328 OpMemberDecorate %type_View 52 Offset 1888329 OpMemberDecorate %type_View 53 Offset 1904330 OpMemberDecorate %type_View 54 Offset 1920331 OpMemberDecorate %type_View 55 Offset 1928332 OpMemberDecorate %type_View 56 Offset 1936333 OpMemberDecorate %type_View 57 Offset 1952334 OpMemberDecorate %type_View 58 Offset 1968335 OpMemberDecorate %type_View 59 Offset 1984336 OpMemberDecorate %type_View 60 Offset 2000337 OpMemberDecorate %type_View 61 Offset 2004338 OpMemberDecorate %type_View 62 Offset 2008339 OpMemberDecorate %type_View 63 Offset 2012340 OpMemberDecorate %type_View 64 Offset 2016341 OpMemberDecorate %type_View 65 Offset 2032342 OpMemberDecorate %type_View 66 Offset 2048343 OpMemberDecorate %type_View 67 Offset 2064344 OpMemberDecorate %type_View 68 Offset 2072345 OpMemberDecorate %type_View 69 Offset 2076346 OpMemberDecorate %type_View 70 Offset 2080347 OpMemberDecorate %type_View 71 Offset 2084348 OpMemberDecorate %type_View 72 Offset 2088349 OpMemberDecorate %type_View 73 Offset 2092350 OpMemberDecorate %type_View 74 Offset 2096351 OpMemberDecorate %type_View 75 Offset 2108352 OpMemberDecorate %type_View 76 Offset 2112353 OpMemberDecorate %type_View 77 Offset 2116354 OpMemberDecorate %type_View 78 Offset 2120355 OpMemberDecorate %type_View 79 Offset 2124356 OpMemberDecorate %type_View 80 Offset 2128357 OpMemberDecorate %type_View 81 Offset 2132358 OpMemberDecorate %type_View 82 Offset 2136359 OpMemberDecorate %type_View 83 Offset 2140360 OpMemberDecorate %type_View 84 Offset 2144361 OpMemberDecorate %type_View 85 Offset 2148362 OpMemberDecorate %type_View 86 Offset 2152363 OpMemberDecorate %type_View 87 Offset 2156364 OpMemberDecorate %type_View 88 Offset 2160365 OpMemberDecorate %type_View 89 Offset 2164366 OpMemberDecorate %type_View 90 Offset 2168367 OpMemberDecorate %type_View 91 Offset 2172368 OpMemberDecorate %type_View 92 Offset 2176369 OpMemberDecorate %type_View 93 Offset 2192370 OpMemberDecorate %type_View 94 Offset 2204371 OpMemberDecorate %type_View 95 Offset 2208372 OpMemberDecorate %type_View 96 Offset 2240373 OpMemberDecorate %type_View 97 Offset 2272374 OpMemberDecorate %type_View 98 Offset 2288375 OpMemberDecorate %type_View 99 Offset 2304376 OpMemberDecorate %type_View 100 Offset 2308377 OpMemberDecorate %type_View 101 Offset 2312378 OpMemberDecorate %type_View 102 Offset 2316379 OpMemberDecorate %type_View 103 Offset 2320380 OpMemberDecorate %type_View 104 Offset 2324381 OpMemberDecorate %type_View 105 Offset 2328382 OpMemberDecorate %type_View 106 Offset 2332383 OpMemberDecorate %type_View 107 Offset 2336384 OpMemberDecorate %type_View 108 Offset 2340385 OpMemberDecorate %type_View 109 Offset 2344386 OpMemberDecorate %type_View 110 Offset 2348387 OpMemberDecorate %type_View 111 Offset 2352388 OpMemberDecorate %type_View 112 Offset 2364389 OpMemberDecorate %type_View 113 Offset 2368390 OpMemberDecorate %type_View 114 Offset 2380391 OpMemberDecorate %type_View 115 Offset 2384392 OpMemberDecorate %type_View 116 Offset 2388393 OpMemberDecorate %type_View 117 Offset 2392394 OpMemberDecorate %type_View 118 Offset 2396395 OpMemberDecorate %type_View 119 Offset 2400396 OpMemberDecorate %type_View 120 Offset 2404397 OpMemberDecorate %type_View 121 Offset 2408398 OpMemberDecorate %type_View 122 Offset 2412399 OpMemberDecorate %type_View 123 Offset 2416400 OpMemberDecorate %type_View 124 Offset 2420401 OpMemberDecorate %type_View 125 Offset 2424402 OpMemberDecorate %type_View 126 Offset 2428403 OpMemberDecorate %type_View 127 Offset 2432404 OpMemberDecorate %type_View 128 Offset 2448405 OpMemberDecorate %type_View 129 Offset 2460406 OpMemberDecorate %type_View 130 Offset 2464407 OpMemberDecorate %type_View 131 Offset 2480408 OpMemberDecorate %type_View 132 Offset 2484409 OpMemberDecorate %type_View 133 Offset 2488410 OpMemberDecorate %type_View 134 Offset 2492411 OpMemberDecorate %type_View 135 Offset 2496412 OpMemberDecorate %type_View 136 Offset 2512413 OpMemberDecorate %type_View 137 Offset 2624414 OpMemberDecorate %type_View 138 Offset 2628415 OpMemberDecorate %type_View 139 Offset 2632416 OpMemberDecorate %type_View 140 Offset 2636417 OpMemberDecorate %type_View 141 Offset 2640418 OpMemberDecorate %type_View 142 Offset 2644419 OpMemberDecorate %type_View 143 Offset 2648420 OpMemberDecorate %type_View 144 Offset 2652421 OpMemberDecorate %type_View 145 Offset 2656422 OpMemberDecorate %type_View 146 Offset 2668423 OpMemberDecorate %type_View 147 Offset 2672424 OpMemberDecorate %type_View 148 Offset 2736425 OpMemberDecorate %type_View 149 Offset 2800426 OpMemberDecorate %type_View 150 Offset 2804427 OpMemberDecorate %type_View 151 Offset 2808428 OpMemberDecorate %type_View 152 Offset 2812429 OpMemberDecorate %type_View 153 Offset 2816430 OpMemberDecorate %type_View 154 Offset 2828431 OpMemberDecorate %type_View 155 Offset 2832432 OpMemberDecorate %type_View 156 Offset 2844433 OpMemberDecorate %type_View 157 Offset 2848434 OpMemberDecorate %type_View 158 Offset 2856435 OpMemberDecorate %type_View 159 Offset 2860436 OpMemberDecorate %type_View 160 Offset 2864437 OpMemberDecorate %type_View 161 Offset 2876438 OpMemberDecorate %type_View 162 Offset 2880439 OpMemberDecorate %type_View 163 Offset 2892440 OpMemberDecorate %type_View 164 Offset 2896441 OpMemberDecorate %type_View 165 Offset 2908442 OpMemberDecorate %type_View 166 Offset 2912443 OpMemberDecorate %type_View 167 Offset 2924444 OpMemberDecorate %type_View 168 Offset 2928445 OpMemberDecorate %type_View 169 Offset 2932446 OpDecorate %type_View Block447 OpMemberDecorate %type__Globals 0 Offset 0448 OpMemberDecorate %type__Globals 1 Offset 16449 OpMemberDecorate %type__Globals 2 Offset 32450 OpMemberDecorate %type__Globals 3 Offset 36451 OpMemberDecorate %type__Globals 4 Offset 48452 OpMemberDecorate %type__Globals 5 Offset 64453 OpMemberDecorate %type__Globals 5 MatrixStride 16454 OpMemberDecorate %type__Globals 5 ColMajor455 OpMemberDecorate %type__Globals 6 Offset 128456 OpMemberDecorate %type__Globals 7 Offset 144457 OpMemberDecorate %type__Globals 8 Offset 160458 OpDecorate %type__Globals Block459 %float = OpTypeFloat 32460 %v4float = OpTypeVector %float 4461%mat4v4float = OpTypeMatrix %v4float 4462 %v3float = OpTypeVector %float 3463 %v2float = OpTypeVector %float 2464 %int = OpTypeInt 32 1465 %uint = OpTypeInt 32 0466 %uint_2 = OpConstant %uint 2467 %uint_7 = OpConstant %uint 7468 %uint_4 = OpConstant %uint 4469 %float_1 = OpConstant %float 1470 %int_58 = OpConstant %int 58471 %int_24 = OpConstant %int 24472 %int_5 = OpConstant %int 5473 %int_2 = OpConstant %int 2474 %int_3 = OpConstant %int 3475 %int_8 = OpConstant %int 8476%float_0_999989986 = OpConstant %float 0.999989986477 %int_0 = OpConstant %int 0478 %float_0 = OpConstant %float 0479 %int_7 = OpConstant %int 7480 %float_0_5 = OpConstant %float 0.5481 %41 = OpConstantComposite %v3float %float_1 %float_1 %float_1482 %v2int = OpTypeVector %int 2483 %43 = OpConstantComposite %v2int %int_0 %int_0484 %44 = OpConstantComposite %v3float %float_0 %float_0 %float_0485%type_subpass_image = OpTypeImage %float SubpassData 2 0 0 2 Unknown486%_ptr_UniformConstant_type_subpass_image = OpTypePointer UniformConstant %type_subpass_image487%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2488%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7489%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4490 %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float491%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View492%type_sampler = OpTypeSampler493%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler494%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown495%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image496%type__Globals = OpTypeStruct %v3float %v4float %float %float %v4float %mat4v4float %v2float %v4float %v4float497%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals498%_ptr_Input_v4float = OpTypePointer Input %v4float499%_ptr_Output_v4float = OpTypePointer Output %v4float500 %void = OpTypeVoid501 %53 = OpTypeFunction %void502%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float503%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float504%_ptr_Uniform_float = OpTypePointer Uniform %float505%type_sampled_image = OpTypeSampledImage %type_2d_image506%gl_LastFragData = OpVariable %_ptr_UniformConstant_type_subpass_image UniformConstant507 %View = OpVariable %_ptr_Uniform_type_View Uniform508%ShadowDepthTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant509%ShadowDepthTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant510 %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform511%gl_FragCoord = OpVariable %_ptr_Input_v4float Input512%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output513 %57 = OpConstantNull %v4float514 %58 = OpUndef %v4float515 %Main = OpFunction %void None %53516 %59 = OpLabel517 %60 = OpLoad %v4float %gl_FragCoord518 %61 = OpVectorShuffle %v2float %60 %60 0 1519 %62 = OpAccessChain %_ptr_Uniform_v4float %View %int_58520 %63 = OpLoad %v4float %62521 %64 = OpVectorShuffle %v2float %63 %63 2 3522 %65 = OpFMul %v2float %61 %64523 %66 = OpLoad %type_subpass_image %gl_LastFragData524 %67 = OpImageRead %v4float %66 %43 None525 %68 = OpCompositeExtract %float %67 3526 %69 = OpAccessChain %_ptr_Uniform_v4float %View %int_24527 %70 = OpLoad %v4float %69528 %71 = OpVectorShuffle %v2float %70 %70 3 2529 %72 = OpFSub %v2float %65 %71530 %73 = OpVectorShuffle %v2float %70 %70 0 1531 %74 = OpFDiv %v2float %72 %73532 %75 = OpCompositeConstruct %v2float %68 %68533 %76 = OpFMul %v2float %74 %75534 %77 = OpCompositeExtract %float %76 0535 %78 = OpCompositeExtract %float %76 1536 %79 = OpCompositeConstruct %v4float %77 %78 %68 %float_1537 %80 = OpAccessChain %_ptr_Uniform_mat4v4float %_Globals %int_5538 %81 = OpLoad %mat4v4float %80539 %82 = OpMatrixTimesVector %v4float %81 %79540 %83 = OpCompositeExtract %float %82 2541 %84 = OpCompositeExtract %float %82 3542 %85 = OpCompositeConstruct %v3float %84 %84 %84543 %86 = OpVectorShuffle %v3float %82 %82 0 1 2544 %87 = OpFDiv %v3float %86 %85545 %88 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_8546 %89 = OpLoad %v4float %88547 %90 = OpVectorShuffle %v2float %89 %89 2 3548 %91 = OpVectorShuffle %v2float %87 %57 0 1549 %92 = OpFMul %v2float %91 %90550 %93 = OpVectorShuffle %v2float %89 %89 0 1551 %94 = OpVectorShuffle %v2float %92 %57 0 1552 %95 = OpFAdd %v2float %94 %93553 %96 = OpExtInst %float %1 FMin %83 %float_0_999989986554 %97 = OpLoad %type_2d_image %ShadowDepthTexture555 %98 = OpLoad %type_sampler %ShadowDepthTextureSampler556 %99 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2557 %100 = OpLoad %float %99558 %101 = OpVectorShuffle %v2float %95 %57 0 1559 %102 = OpSampledImage %type_sampled_image %97 %98560 %103 = OpImageSampleExplicitLod %v4float %102 %101 Lod %float_0561 %104 = OpVectorShuffle %v3float %103 %103 0 0 0562 %105 = OpFMul %float %96 %100563 %106 = OpFSub %float %105 %float_1564 %107 = OpCompositeConstruct %v3float %100 %100 %100565 %108 = OpFMul %v3float %104 %107566 %109 = OpCompositeConstruct %v3float %106 %106 %106567 %110 = OpFSub %v3float %108 %109568 %111 = OpExtInst %v3float %1 FClamp %110 %44 %41569 %112 = OpCompositeExtract %float %111 0570 %113 = OpFSub %float %112 %float_0_5571 %114 = OpAccessChain %_ptr_Uniform_float %_Globals %int_3572 %115 = OpLoad %float %114573 %116 = OpFMul %float %113 %115574 %117 = OpFAdd %float %116 %float_0_5575 %118 = OpExtInst %float %1 FClamp %117 %float_0 %float_1576 %119 = OpFMul %float %118 %118577 %120 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2578 %121 = OpLoad %float %120579 %122 = OpExtInst %float %1 FMix %float_1 %119 %121580 %123 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7581 %124 = OpLoad %v4float %123582 %125 = OpVectorShuffle %v3float %124 %124 0 1 2583 %126 = OpCompositeConstruct %v3float %122 %122 %122584 %127 = OpExtInst %v3float %1 FMix %125 %41 %126585 %128 = OpVectorShuffle %v4float %58 %127 4 5 6 3586 %129 = OpCompositeInsert %v4float %float_0 %128 3587 OpStore %out_var_SV_Target0 %129588 OpReturn...

Full Screen

Full Screen

history.js

Source:history.js Github

copy

Full Screen

1/**2 * @ngdoc service3 * @name $ionicHistory4 * @module ionic5 * @description6 * $ionicHistory keeps track of views as the user navigates through an app. Similar to the way a7 * browser behaves, an Ionic app is able to keep track of the previous view, the current view, and8 * the forward view (if there is one). However, a typical web browser only keeps track of one9 * history stack in a linear fashion.10 *11 * Unlike a traditional browser environment, apps and webapps have parallel independent histories,12 * such as with tabs. Should a user navigate few pages deep on one tab, and then switch to a new13 * tab and back, the back button relates not to the previous tab, but to the previous pages14 * visited within _that_ tab.15 *16 * `$ionicHistory` facilitates this parallel history architecture.17 */18IonicModule19.factory('$ionicHistory', [20 '$rootScope',21 '$state',22 '$location',23 '$window',24 '$timeout',25 '$ionicViewSwitcher',26 '$ionicNavViewDelegate',27function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $ionicNavViewDelegate) {28 // history actions while navigating views29 var ACTION_INITIAL_VIEW = 'initialView';30 var ACTION_NEW_VIEW = 'newView';31 var ACTION_MOVE_BACK = 'moveBack';32 var ACTION_MOVE_FORWARD = 'moveForward';33 // direction of navigation34 var DIRECTION_BACK = 'back';35 var DIRECTION_FORWARD = 'forward';36 var DIRECTION_ENTER = 'enter';37 var DIRECTION_EXIT = 'exit';38 var DIRECTION_SWAP = 'swap';39 var DIRECTION_NONE = 'none';40 var stateChangeCounter = 0;41 var lastStateId, nextViewOptions, deregisterStateChangeListener, nextViewExpireTimer, forcedNav;42 var viewHistory = {43 histories: { root: { historyId: 'root', parentHistoryId: null, stack: [], cursor: -1 } },44 views: {},45 backView: null,46 forwardView: null,47 currentView: null48 };49 var View = function() {};50 View.prototype.initialize = function(data) {51 if (data) {52 for (var name in data) this[name] = data[name];53 return this;54 }55 return null;56 };57 View.prototype.go = function() {58 if (this.stateName) {59 return $state.go(this.stateName, this.stateParams);60 }61 if (this.url && this.url !== $location.url()) {62 if (viewHistory.backView === this) {63 return $window.history.go(-1);64 } else if (viewHistory.forwardView === this) {65 return $window.history.go(1);66 }67 $location.url(this.url);68 }69 return null;70 };71 View.prototype.destroy = function() {72 if (this.scope) {73 this.scope.$destroy && this.scope.$destroy();74 this.scope = null;75 }76 };77 function getViewById(viewId) {78 return (viewId ? viewHistory.views[ viewId ] : null);79 }80 function getBackView(view) {81 return (view ? getViewById(view.backViewId) : null);82 }83 function getForwardView(view) {84 return (view ? getViewById(view.forwardViewId) : null);85 }86 function getHistoryById(historyId) {87 return (historyId ? viewHistory.histories[ historyId ] : null);88 }89 function getHistory(scope) {90 var histObj = getParentHistoryObj(scope);91 if (!viewHistory.histories[ histObj.historyId ]) {92 // this history object exists in parent scope, but doesn't93 // exist in the history data yet94 viewHistory.histories[ histObj.historyId ] = {95 historyId: histObj.historyId,96 parentHistoryId: getParentHistoryObj(histObj.scope.$parent).historyId,97 stack: [],98 cursor: -199 };100 }101 return getHistoryById(histObj.historyId);102 }103 function getParentHistoryObj(scope) {104 var parentScope = scope;105 while (parentScope) {106 if (parentScope.hasOwnProperty('$historyId')) {107 // this parent scope has a historyId108 return { historyId: parentScope.$historyId, scope: parentScope };109 }110 // nothing found keep climbing up111 parentScope = parentScope.$parent;112 }113 // no history for the parent, use the root114 return { historyId: 'root', scope: $rootScope };115 }116 function setNavViews(viewId) {117 viewHistory.currentView = getViewById(viewId);118 viewHistory.backView = getBackView(viewHistory.currentView);119 viewHistory.forwardView = getForwardView(viewHistory.currentView);120 }121 function getCurrentStateId() {122 var id;123 if ($state && $state.current && $state.current.name) {124 id = $state.current.name;125 if ($state.params) {126 for (var key in $state.params) {127 if ($state.params.hasOwnProperty(key) && $state.params[key]) {128 id += "_" + key + "=" + $state.params[key];129 }130 }131 }132 return id;133 }134 // if something goes wrong make sure its got a unique stateId135 return ionic.Utils.nextUid();136 }137 function getCurrentStateParams() {138 var rtn;139 if ($state && $state.params) {140 for (var key in $state.params) {141 if ($state.params.hasOwnProperty(key)) {142 rtn = rtn || {};143 rtn[key] = $state.params[key];144 }145 }146 }147 return rtn;148 }149 return {150 register: function(parentScope, viewLocals) {151 var currentStateId = getCurrentStateId(),152 hist = getHistory(parentScope),153 currentView = viewHistory.currentView,154 backView = viewHistory.backView,155 forwardView = viewHistory.forwardView,156 viewId = null,157 action = null,158 direction = DIRECTION_NONE,159 historyId = hist.historyId,160 url = $location.url(),161 tmp, x, ele;162 if (lastStateId !== currentStateId) {163 lastStateId = currentStateId;164 stateChangeCounter++;165 }166 if (forcedNav) {167 // we've previously set exactly what to do168 viewId = forcedNav.viewId;169 action = forcedNav.action;170 direction = forcedNav.direction;171 forcedNav = null;172 } else if (backView && backView.stateId === currentStateId) {173 // they went back one, set the old current view as a forward view174 viewId = backView.viewId;175 historyId = backView.historyId;176 action = ACTION_MOVE_BACK;177 if (backView.historyId === currentView.historyId) {178 // went back in the same history179 direction = DIRECTION_BACK;180 } else if (currentView) {181 direction = DIRECTION_EXIT;182 tmp = getHistoryById(backView.historyId);183 if (tmp && tmp.parentHistoryId === currentView.historyId) {184 direction = DIRECTION_ENTER;185 } else {186 tmp = getHistoryById(currentView.historyId);187 if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {188 direction = DIRECTION_SWAP;189 }190 }191 }192 } else if (forwardView && forwardView.stateId === currentStateId) {193 // they went to the forward one, set the forward view to no longer a forward view194 viewId = forwardView.viewId;195 historyId = forwardView.historyId;196 action = ACTION_MOVE_FORWARD;197 if (forwardView.historyId === currentView.historyId) {198 direction = DIRECTION_FORWARD;199 } else if (currentView) {200 direction = DIRECTION_EXIT;201 if (currentView.historyId === hist.parentHistoryId) {202 direction = DIRECTION_ENTER;203 } else {204 tmp = getHistoryById(currentView.historyId);205 if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {206 direction = DIRECTION_SWAP;207 }208 }209 }210 tmp = getParentHistoryObj(parentScope);211 if (forwardView.historyId && tmp.scope) {212 // if a history has already been created by the forward view then make sure it stays the same213 tmp.scope.$historyId = forwardView.historyId;214 historyId = forwardView.historyId;215 }216 } else if (currentView && currentView.historyId !== historyId &&217 hist.cursor > -1 && hist.stack.length > 0 && hist.cursor < hist.stack.length &&218 hist.stack[hist.cursor].stateId === currentStateId) {219 // they just changed to a different history and the history already has views in it220 var switchToView = hist.stack[hist.cursor];221 viewId = switchToView.viewId;222 historyId = switchToView.historyId;223 action = ACTION_MOVE_BACK;224 direction = DIRECTION_SWAP;225 tmp = getHistoryById(currentView.historyId);226 if (tmp && tmp.parentHistoryId === historyId) {227 direction = DIRECTION_EXIT;228 } else {229 tmp = getHistoryById(historyId);230 if (tmp && tmp.parentHistoryId === currentView.historyId) {231 direction = DIRECTION_ENTER;232 }233 }234 // if switching to a different history, and the history of the view we're switching235 // to has an existing back view from a different history than itself, then236 // it's back view would be better represented using the current view as its back view237 tmp = getViewById(switchToView.backViewId);238 if (tmp && switchToView.historyId !== tmp.historyId) {239 // the new view is being removed from it's old position in the history and being placed at the top,240 // so we need to update any views that reference it as a backview, otherwise there will be infinitely loops241 var viewIds = Object.keys(viewHistory.views);242 viewIds.forEach(function(viewId) {243 var view = viewHistory.views[viewId];244 if ( view.backViewId === switchToView.viewId ) {245 view.backViewId = null;246 }247 });248 hist.stack[hist.cursor].backViewId = currentView.viewId;249 }250 } else {251 // create an element from the viewLocals template252 ele = $ionicViewSwitcher.createViewEle(viewLocals);253 if (this.isAbstractEle(ele, viewLocals)) {254 return {255 action: 'abstractView',256 direction: DIRECTION_NONE,257 ele: ele258 };259 }260 // set a new unique viewId261 viewId = ionic.Utils.nextUid();262 if (currentView) {263 // set the forward view if there is a current view (ie: if its not the first view)264 currentView.forwardViewId = viewId;265 action = ACTION_NEW_VIEW;266 // check if there is a new forward view within the same history267 if (forwardView && currentView.stateId !== forwardView.stateId &&268 currentView.historyId === forwardView.historyId) {269 // they navigated to a new view but the stack already has a forward view270 // since its a new view remove any forwards that existed271 tmp = getHistoryById(forwardView.historyId);272 if (tmp) {273 // the forward has a history274 for (x = tmp.stack.length - 1; x >= forwardView.index; x--) {275 // starting from the end destroy all forwards in this history from this point276 var stackItem = tmp.stack[x];277 stackItem && stackItem.destroy && stackItem.destroy();278 tmp.stack.splice(x);279 }280 historyId = forwardView.historyId;281 }282 }283 // its only moving forward if its in the same history284 if (hist.historyId === currentView.historyId) {285 direction = DIRECTION_FORWARD;286 } else if (currentView.historyId !== hist.historyId) {287 // DB: this is a new view in a different tab288 direction = DIRECTION_ENTER;289 tmp = getHistoryById(currentView.historyId);290 if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {291 direction = DIRECTION_SWAP;292 } else {293 tmp = getHistoryById(tmp.parentHistoryId);294 if (tmp && tmp.historyId === hist.historyId) {295 direction = DIRECTION_EXIT;296 }297 }298 }299 } else {300 // there's no current view, so this must be the initial view301 action = ACTION_INITIAL_VIEW;302 }303 if (stateChangeCounter < 2) {304 // views that were spun up on the first load should not animate305 direction = DIRECTION_NONE;306 }307 // add the new view308 viewHistory.views[viewId] = this.createView({309 viewId: viewId,310 index: hist.stack.length,311 historyId: hist.historyId,312 backViewId: (currentView && currentView.viewId ? currentView.viewId : null),313 forwardViewId: null,314 stateId: currentStateId,315 stateName: this.currentStateName(),316 stateParams: getCurrentStateParams(),317 url: url,318 canSwipeBack: canSwipeBack(ele, viewLocals)319 });320 // add the new view to this history's stack321 hist.stack.push(viewHistory.views[viewId]);322 }323 deregisterStateChangeListener && deregisterStateChangeListener();324 $timeout.cancel(nextViewExpireTimer);325 if (nextViewOptions) {326 if (nextViewOptions.disableAnimate) direction = DIRECTION_NONE;327 if (nextViewOptions.disableBack) viewHistory.views[viewId].backViewId = null;328 if (nextViewOptions.historyRoot) {329 for (x = 0; x < hist.stack.length; x++) {330 if (hist.stack[x].viewId === viewId) {331 hist.stack[x].index = 0;332 hist.stack[x].backViewId = hist.stack[x].forwardViewId = null;333 } else {334 delete viewHistory.views[hist.stack[x].viewId];335 }336 }337 hist.stack = [viewHistory.views[viewId]];338 }339 nextViewOptions = null;340 }341 setNavViews(viewId);342 if (viewHistory.backView && historyId == viewHistory.backView.historyId && currentStateId == viewHistory.backView.stateId && url == viewHistory.backView.url) {343 for (x = 0; x < hist.stack.length; x++) {344 if (hist.stack[x].viewId == viewId) {345 action = 'dupNav';346 direction = DIRECTION_NONE;347 if (x > 0) {348 hist.stack[x - 1].forwardViewId = null;349 }350 viewHistory.forwardView = null;351 viewHistory.currentView.index = viewHistory.backView.index;352 viewHistory.currentView.backViewId = viewHistory.backView.backViewId;353 viewHistory.backView = getBackView(viewHistory.backView);354 hist.stack.splice(x, 1);355 break;356 }357 }358 }359 hist.cursor = viewHistory.currentView.index;360 return {361 viewId: viewId,362 action: action,363 direction: direction,364 historyId: historyId,365 enableBack: this.enabledBack(viewHistory.currentView),366 isHistoryRoot: (viewHistory.currentView.index === 0),367 ele: ele368 };369 },370 registerHistory: function(scope) {371 scope.$historyId = ionic.Utils.nextUid();372 },373 createView: function(data) {374 var newView = new View();375 return newView.initialize(data);376 },377 getViewById: getViewById,378 /**379 * @ngdoc method380 * @name $ionicHistory#viewHistory381 * @description The app's view history data, such as all the views and histories, along382 * with how they are ordered and linked together within the navigation stack.383 * @returns {object} Returns an object containing the apps view history data.384 */385 viewHistory: function() {386 return viewHistory;387 },388 /**389 * @ngdoc method390 * @name $ionicHistory#currentView391 * @description The app's current view.392 * @returns {object} Returns the current view.393 */394 currentView: function(view) {395 if (arguments.length) {396 viewHistory.currentView = view;397 }398 return viewHistory.currentView;399 },400 /**401 * @ngdoc method402 * @name $ionicHistory#currentHistoryId403 * @description The ID of the history stack which is the parent container of the current view.404 * @returns {string} Returns the current history ID.405 */406 currentHistoryId: function() {407 return viewHistory.currentView ? viewHistory.currentView.historyId : null;408 },409 /**410 * @ngdoc method411 * @name $ionicHistory#currentTitle412 * @description Gets and sets the current view's title.413 * @param {string=} val The title to update the current view with.414 * @returns {string} Returns the current view's title.415 */416 currentTitle: function(val) {417 if (viewHistory.currentView) {418 if (arguments.length) {419 viewHistory.currentView.title = val;420 }421 return viewHistory.currentView.title;422 }423 },424 /**425 * @ngdoc method426 * @name $ionicHistory#backView427 * @description Returns the view that was before the current view in the history stack.428 * If the user navigated from View A to View B, then View A would be the back view, and429 * View B would be the current view.430 * @returns {object} Returns the back view.431 */432 backView: function(view) {433 if (arguments.length) {434 viewHistory.backView = view;435 }436 return viewHistory.backView;437 },438 /**439 * @ngdoc method440 * @name $ionicHistory#backTitle441 * @description Gets the back view's title.442 * @returns {string} Returns the back view's title.443 */444 backTitle: function(view) {445 var backView = (view && getViewById(view.backViewId)) || viewHistory.backView;446 return backView && backView.title;447 },448 /**449 * @ngdoc method450 * @name $ionicHistory#forwardView451 * @description Returns the view that was in front of the current view in the history stack.452 * A forward view would exist if the user navigated from View A to View B, then453 * navigated back to View A. At this point then View B would be the forward view, and View454 * A would be the current view.455 * @returns {object} Returns the forward view.456 */457 forwardView: function(view) {458 if (arguments.length) {459 viewHistory.forwardView = view;460 }461 return viewHistory.forwardView;462 },463 /**464 * @ngdoc method465 * @name $ionicHistory#currentStateName466 * @description Returns the current state name.467 * @returns {string}468 */469 currentStateName: function() {470 return ($state && $state.current ? $state.current.name : null);471 },472 isCurrentStateNavView: function(navView) {473 return !!($state && $state.current && $state.current.views && $state.current.views[navView]);474 },475 goToHistoryRoot: function(historyId) {476 if (historyId) {477 var hist = getHistoryById(historyId);478 if (hist && hist.stack.length) {479 if (viewHistory.currentView && viewHistory.currentView.viewId === hist.stack[0].viewId) {480 return;481 }482 forcedNav = {483 viewId: hist.stack[0].viewId,484 action: ACTION_MOVE_BACK,485 direction: DIRECTION_BACK486 };487 hist.stack[0].go();488 }489 }490 },491 /**492 * @ngdoc method493 * @name $ionicHistory#goBack494 * @param {number=} backCount Optional negative integer setting how many views to go495 * back. By default it'll go back one view by using the value `-1`. To go back two496 * views you would use `-2`. If the number goes farther back than the number of views497 * in the current history's stack then it'll go to the first view in the current history's498 * stack. If the number is zero or greater then it'll do nothing. It also does not499 * cross history stacks, meaning it can only go as far back as the current history.500 * @description Navigates the app to the back view, if a back view exists.501 */502 goBack: function(backCount) {503 if (isDefined(backCount) && backCount !== -1) {504 if (backCount > -1) return;505 var currentHistory = viewHistory.histories[this.currentHistoryId()];506 var newCursor = currentHistory.cursor + backCount + 1;507 if (newCursor < 1) {508 newCursor = 1;509 }510 currentHistory.cursor = newCursor;511 setNavViews(currentHistory.stack[newCursor].viewId);512 var cursor = newCursor - 1;513 var clearStateIds = [];514 var fwdView = getViewById(currentHistory.stack[cursor].forwardViewId);515 while (fwdView) {516 clearStateIds.push(fwdView.stateId || fwdView.viewId);517 cursor++;518 if (cursor >= currentHistory.stack.length) break;519 fwdView = getViewById(currentHistory.stack[cursor].forwardViewId);520 }521 var self = this;522 if (clearStateIds.length) {523 $timeout(function() {524 self.clearCache(clearStateIds);525 }, 300);526 }527 }528 viewHistory.backView && viewHistory.backView.go();529 },530 /**531 * @ngdoc method532 * @name $ionicHistory#removeBackView533 * @description Remove the previous view from the history completely, including the534 * cached element and scope (if they exist).535 */536 removeBackView: function() {537 var self = this;538 var currentHistory = viewHistory.histories[this.currentHistoryId()];539 var currentCursor = currentHistory.cursor;540 var currentView = currentHistory.stack[currentCursor];541 var backView = currentHistory.stack[currentCursor - 1];542 var replacementView = currentHistory.stack[currentCursor - 2];543 // fail if we dont have enough views in the history544 if (!backView || !replacementView) {545 return;546 }547 // remove the old backView and the cached element/scope548 currentHistory.stack.splice(currentCursor - 1, 1);549 self.clearCache([backView.viewId]);550 // make the replacementView and currentView point to each other (bypass the old backView)551 currentView.backViewId = replacementView.viewId;552 currentView.index = currentView.index - 1;553 replacementView.forwardViewId = currentView.viewId;554 // update the cursor and set new backView555 viewHistory.backView = replacementView;556 currentHistory.currentCursor += -1;557 },558 enabledBack: function(view) {559 var backView = getBackView(view);560 return !!(backView && backView.historyId === view.historyId);561 },562 /**563 * @ngdoc method564 * @name $ionicHistory#clearHistory565 * @description Clears out the app's entire history, except for the current view.566 */567 clearHistory: function() {568 var569 histories = viewHistory.histories,570 currentView = viewHistory.currentView;571 if (histories) {572 for (var historyId in histories) {573 if (histories[historyId].stack) {574 histories[historyId].stack = [];575 histories[historyId].cursor = -1;576 }577 if (currentView && currentView.historyId === historyId) {578 currentView.backViewId = currentView.forwardViewId = null;579 histories[historyId].stack.push(currentView);580 } else if (histories[historyId].destroy) {581 histories[historyId].destroy();582 }583 }584 }585 for (var viewId in viewHistory.views) {586 if (viewId !== currentView.viewId) {587 delete viewHistory.views[viewId];588 }589 }590 if (currentView) {591 setNavViews(currentView.viewId);592 }593 },594 /**595 * @ngdoc method596 * @name $ionicHistory#clearCache597 * @return promise598 * @description Removes all cached views within every {@link ionic.directive:ionNavView}.599 * This both removes the view element from the DOM, and destroy it's scope.600 */601 clearCache: function(stateIds) {602 return $timeout(function() {603 $ionicNavViewDelegate._instances.forEach(function(instance) {604 instance.clearCache(stateIds);605 });606 });607 },608 /**609 * @ngdoc method610 * @name $ionicHistory#nextViewOptions611 * @description Sets options for the next view. This method can be useful to override612 * certain view/transition defaults right before a view transition happens. For example,613 * the {@link ionic.directive:menuClose} directive uses this method internally to ensure614 * an animated view transition does not happen when a side menu is open, and also sets615 * the next view as the root of its history stack. After the transition these options616 * are set back to null.617 *618 * Available options:619 *620 * * `disableAnimate`: Do not animate the next transition.621 * * `disableBack`: The next view should forget its back view, and set it to null.622 * * `historyRoot`: The next view should become the root view in its history stack.623 *624 * ```js625 * $ionicHistory.nextViewOptions({626 * disableAnimate: true,627 * disableBack: true628 * });629 * ```630 */631 nextViewOptions: function(opts) {632 deregisterStateChangeListener && deregisterStateChangeListener();633 if (arguments.length) {634 $timeout.cancel(nextViewExpireTimer);635 if (opts === null) {636 nextViewOptions = opts;637 } else {638 nextViewOptions = nextViewOptions || {};639 extend(nextViewOptions, opts);640 if (nextViewOptions.expire) {641 deregisterStateChangeListener = $rootScope.$on('$stateChangeSuccess', function() {642 nextViewExpireTimer = $timeout(function() {643 nextViewOptions = null;644 }, nextViewOptions.expire);645 });646 }647 }648 }649 return nextViewOptions;650 },651 isAbstractEle: function(ele, viewLocals) {652 if (viewLocals && viewLocals.$$state && viewLocals.$$state.self['abstract']) {653 return true;654 }655 return !!(ele && (isAbstractTag(ele) || isAbstractTag(ele.children())));656 },657 isActiveScope: function(scope) {658 if (!scope) return false;659 var climbScope = scope;660 var currentHistoryId = this.currentHistoryId();661 var foundHistoryId;662 while (climbScope) {663 if (climbScope.$$disconnected) {664 return false;665 }666 if (!foundHistoryId && climbScope.hasOwnProperty('$historyId')) {667 foundHistoryId = true;668 }669 if (currentHistoryId) {670 if (climbScope.hasOwnProperty('$historyId') && currentHistoryId == climbScope.$historyId) {671 return true;672 }673 if (climbScope.hasOwnProperty('$activeHistoryId')) {674 if (currentHistoryId == climbScope.$activeHistoryId) {675 if (climbScope.hasOwnProperty('$historyId')) {676 return true;677 }678 if (!foundHistoryId) {679 return true;680 }681 }682 }683 }684 if (foundHistoryId && climbScope.hasOwnProperty('$activeHistoryId')) {685 foundHistoryId = false;686 }687 climbScope = climbScope.$parent;688 }689 return currentHistoryId ? currentHistoryId == 'root' : true;690 }691 };692 function isAbstractTag(ele) {693 return ele && ele.length && /ion-side-menus|ion-tabs/i.test(ele[0].tagName);694 }695 function canSwipeBack(ele, viewLocals) {696 if (viewLocals && viewLocals.$$state && viewLocals.$$state.self.canSwipeBack === false) {697 return false;698 }699 if (ele && ele.attr('can-swipe-back') === 'false') {700 return false;701 }702 var eleChild = ele.find('ion-view');703 if (eleChild && eleChild.attr('can-swipe-back') === 'false') {704 return false;705 }706 return true;707 }708}])709.run([710 '$rootScope',711 '$state',712 '$location',713 '$document',714 '$ionicPlatform',715 '$ionicHistory',716 'IONIC_BACK_PRIORITY',717function($rootScope, $state, $location, $document, $ionicPlatform, $ionicHistory, IONIC_BACK_PRIORITY) {718 // always reset the keyboard state when change stage719 $rootScope.$on('$ionicView.beforeEnter', function() {720 ionic.keyboard && ionic.keyboard.hide && ionic.keyboard.hide();721 });722 $rootScope.$on('$ionicHistory.change', function(e, data) {723 if (!data) return null;724 var viewHistory = $ionicHistory.viewHistory();725 var hist = (data.historyId ? viewHistory.histories[ data.historyId ] : null);726 if (hist && hist.cursor > -1 && hist.cursor < hist.stack.length) {727 // the history they're going to already exists728 // go to it's last view in its stack729 var view = hist.stack[ hist.cursor ];730 return view.go(data);731 }732 // this history does not have a URL, but it does have a uiSref733 // figure out its URL from the uiSref734 if (!data.url && data.uiSref) {735 data.url = $state.href(data.uiSref);736 }737 if (data.url) {738 // don't let it start with a #, messes with $location.url()739 if (data.url.indexOf('#') === 0) {740 data.url = data.url.replace('#', '');741 }742 if (data.url !== $location.url()) {743 // we've got a good URL, ready GO!744 $location.url(data.url);745 }746 }747 });748 $rootScope.$ionicGoBack = function(backCount) {749 $ionicHistory.goBack(backCount);750 };751 // Set the document title when a new view is shown752 $rootScope.$on('$ionicView.afterEnter', function(ev, data) {753 if (data && data.title) {754 $document[0].title = data.title;755 }756 });757 // Triggered when devices with a hardware back button (Android) is clicked by the user758 // This is a Cordova/Phonegap platform specifc method759 function onHardwareBackButton(e) {760 var backView = $ionicHistory.backView();761 if (backView) {762 // there is a back view, go to it763 backView.go();764 } else {765 // there is no back view, so close the app instead766 ionic.Platform.exitApp();767 }768 e.preventDefault();769 return false;770 }771 $ionicPlatform.registerBackButtonAction(772 onHardwareBackButton,773 IONIC_BACK_PRIORITY.view774 );...

Full Screen

Full Screen

urls.py

Source:urls.py Github

copy

Full Screen

...12urlpatterns = [13 # general14 url(15 r'^general/config$', 16 views.ViewGeneralConfig.as_view(), 17 name='ViewGeneralConfig'18 ),19 url(20 r'^general/parse$', 21 views.ViewGeneralParse.as_view(), 22 name='ViewGeneralParse'23 ),24 url(25 r'^general/version$', 26 views.ViewGeneralVersion.as_view(), 27 name='ViewGeneralVersion'28 ),29 # runtime30 url(31 r'^runtime/mgrinfo$', 32 views.ViewRuntime.as_view(template_name="squid/general/mgrinfo.html"), 33 name='ViewRuntimeMgrInfo'34 ),35 url(36 r'^runtime/counters$', 37 views.ViewRuntime.as_view(template_name="squid/general/counters.html"), 38 name='ViewRuntimeCounters'39 ),40 url(41 r'^runtime/counters/min5$', 42 views.ViewRuntime.as_view(template_name="squid/general/5min.html"), 43 name='ViewRuntimeCountersMin5'44 ),45 url(46 r'^runtime/counters/min60$', 47 views.ViewRuntime.as_view(template_name="squid/general/60min.html"), 48 name='ViewRuntimeCountersMin60'49 ),50 url(51 r'^runtime/utilization$', 52 views.ViewRuntime.as_view(template_name="squid/general/utilization.html"), 53 name='ViewRuntimeUtilization'54 ),55 url(56 r'^runtime/dnsinfo$', 57 views.ViewRuntime.as_view(template_name="squid/general/dnsinfo.html"), 58 name='ViewRuntimeDnsInfo'59 ),60 url(61 r'^runtime/auth/negotiate$', 62 views.ViewRuntime.as_view(template_name="squid/general/auth_negotiate.html"), 63 name='ViewRuntimeAuthNegotiate'64 ),65 url(66 r'^runtime/auth/ntlm$', 67 views.ViewRuntime.as_view(template_name="squid/general/auth_ntlm.html"), 68 name='ViewRuntimeAuthNtlm'69 ),70 url(71 r'^runtime/auth/basic$', 72 views.ViewRuntime.as_view(template_name="squid/general/auth_basic.html"), 73 name='ViewRuntimeAuthBasic'74 ),75 url(76 r'^runtime/client/list$', 77 views.ViewRuntime.as_view(template_name="squid/general/client_list.html"), 78 name='ViewRuntimeClientList'79 ),80 url(81 r'^runtime/active/requests$', 82 views.ViewRuntime.as_view(template_name="squid/general/active_requests.html"), 83 name='ViewRuntimeActiveRequests'84 ),85 # settings86 url(r'^network/info/$', views.ViewNetworkInfo.as_view(), name='ViewNetworkInfo'),87 url(r'^acls/$', views.ViewAcls.as_view(), name='ViewAcls'),88 url(r'^administrative/$', views.ViewAdministrative.as_view(), name='ViewAdministrative'),89 url(r'^dns/$', views.ViewDns.as_view(), name='ViewDns'),90 url(r'^miscellaneous/$', views.ViewMiscellaneous.as_view(), name='ViewMiscellaneous'),91 92 # ssl93 url(r'^ssl/info$', views.ViewSslInfo.as_view(), name='ViewSslInfo'),94 url(r'^ssl/mode$', views.ViewSslMode.as_view(), name='ViewSslMode'),95 url(r'^ssl/der$', views.ViewSslDer.as_view(), name='ViewSslDer'),96 url(r'^ssl/pem/backup$', views.ViewSslPemBackUp.as_view(), name='ViewSslPemBackUp'),97 url(r'^ssl/pem/upload$', views.ViewSslPemUpload.as_view(), name='ViewSslPemUpload'),98 url(r'^ssl/pem/generate$', views.ViewSslPemGenerate.as_view(), name='ViewSslPemGenerate'),99 url(r'^ssl/target/domain/list$', views.ViewSslTargetDomainList.as_view(), name='ViewSslTargetDomainList'),100 url(r'^ssl/target/domain/create$', views.ViewSslTargetDomainCreate.as_view(), name='ViewSslTargetDomainCreate'),101 url(r'^ssl/target/domain/(?P<pk>\d+)/update$', views.ViewSslTargetDomainUpdate.as_view(), name='ViewSslTargetDomainUpdate'),102 url(r'^ssl/target/ip/list$', views.ViewSslTargetIpList.as_view(), name='ViewSslTargetIpList'),103 url(r'^ssl/target/ip/create$', views.ViewSslTargetIpCreate.as_view(), name='ViewSslTargetIpCreate'),104 url(r'^ssl/target/ip/(?P<pk>\d+)/update$', views.ViewSslTargetIpUpdate.as_view(), name='ViewSslTargetIpUpdate'),105 url(r'^ssl/target/subnet/list$', views.ViewSslTargetSubnetList.as_view(), name='ViewSslTargetSubnetList'),106 url(r'^ssl/target/subnet/create$', views.ViewSslTargetSubnetCreate.as_view(), name='ViewSslTargetSubnetCreate'),107 url(r'^ssl/target/subnet/(?P<pk>\d+)/update$', views.ViewSslTargetSubnetUpdate.as_view(), name='ViewSslTargetSubnetUpdate'),108 url(r'^ssl/error/domain/list$', views.ViewSslErrorDomainList.as_view(), name='ViewSslErrorDomainList'),109 url(r'^ssl/error/domain/create$', views.ViewSslErrorDomainCreate.as_view(), name='ViewSslErrorDomainCreate'),110 url(r'^ssl/error/domain/(?P<pk>\d+)/update$', views.ViewSslErrorDomainUpdate.as_view(), name='ViewSslErrorDomainUpdate'),111 url(r'^ssl/error/ip/list$', views.ViewSslErrorIpList.as_view(), name='ViewSslErrorIpList'),112 url(r'^ssl/error/ip/create$', views.ViewSslErrorIpCreate.as_view(), name='ViewSslErrorIpCreate'),113 url(r'^ssl/error/ip/(?P<pk>\d+)/update$', views.ViewSslErrorIpUpdate.as_view(), name='ViewSslErrorIpUpdate'),114 url(r'^ssl/error/subnet/list$', views.ViewSslErrorSubnetList.as_view(), name='ViewSslErrorSubnetList'),115 url(r'^ssl/error/subnet/create$', views.ViewSslErrorSubnetCreate.as_view(), name='ViewSslErrorSubnetCreate'),116 url(r'^ssl/error/subnet/(?P<pk>\d+)/update$', views.ViewSslErrorSubnetUpdate.as_view(), name='ViewSslErrorSubnetUpdate'),117 url(r'^ssl/missing/certs/list$', views.ViewSslIntermediateCertList.as_view(), name='ViewSslIntermediateCertList'),118 url(r'^ssl/missing/certs/create$', views.ViewSslIntermediateCertCreate.as_view(), name='ViewSslIntermediateCertCreate'),119 url(r'^ssl/missing/certs/backup$', views.ViewSslIntermediateCertBackUp.as_view(), name='ViewSslIntermediateCertBackUp'),120 # exclusions 121 url(r'^exclude/domain/name/list$', views.ViewExcludeDomainNameList.as_view(), name='ViewExcludeDomainNameList'),122 url(r'^exclude/domain/name/create$', views.ViewExcludeDomainNameCreate.as_view(), name='ViewExcludeDomainNameCreate'),123 url(r'^exclude/domain/name/(?P<pk>\d+)/update$', views.ViewExcludeDomainNameUpdate.as_view(), name='ViewExcludeDomainNameUpdate'),124 url(r'^exclude/domain/ip/list$', views.ViewExcludeDomainIpList.as_view(), name='ViewExcludeDomainIpList'),125 url(r'^exclude/domain/ip/create$', views.ViewExcludeDomainIpCreate.as_view(), name='ViewExcludeDomainIpCreate'),126 url(r'^exclude/domain/ip/(?P<pk>\d+)/update$', views.ViewExcludeDomainIpUpdate.as_view(), name='ViewExcludeDomainIpUpdate'),127 url(r'^exclude/domain/range/list$', views.ViewExcludeDomainRangeList.as_view(), name='ViewExcludeDomainRangeList'),128 url(r'^exclude/domain/range/create$', views.ViewExcludeDomainRangeCreate.as_view(), name='ViewExcludeDomainRangeCreate'),129 url(r'^exclude/domain/range/(?P<pk>\d+)/update$', views.ViewExcludeDomainRangeUpdate.as_view(), name='ViewExcludeDomainRangeUpdate'),130 url(r'^exclude/domain/subnet/list$', views.ViewExcludeDomainSubnetList.as_view(), name='ViewExcludeDomainSubnetList'),131 url(r'^exclude/domain/subnet/create$', views.ViewExcludeDomainSubnetCreate.as_view(), name='ViewExcludeDomainSubnetCreate'),132 url(r'^exclude/domain/subnet/(?P<pk>\d+)/update$', views.ViewExcludeDomainSubnetUpdate.as_view(), name='ViewExcludeDomainSubnetUpdate'),133 url(r'^exclude/user/ip/list$', views.ViewExcludeUserIpList.as_view(), name='ViewExcludeUserIpList'),134 url(r'^exclude/user/ip/create$', views.ViewExcludeUserIpCreate.as_view(), name='ViewExcludeUserIpCreate'),135 url(r'^exclude/user/ip/(?P<pk>\d+)/update$', views.ViewExcludeUserIpUpdate.as_view(), name='ViewExcludeUserIpUpdate'),136 url(r'^exclude/user/range/list$', views.ViewExcludeUserRangeList.as_view(), name='ViewExcludeUserRangeList'),137 url(r'^exclude/user/range/create$', views.ViewExcludeUserRangeCreate.as_view(), name='ViewExcludeUserRangeCreate'),138 url(r'^exclude/user/range/(?P<pk>\d+)/update$', views.ViewExcludeUserRangeUpdate.as_view(), name='ViewExcludeUserRangeUpdate'),139 url(r'^exclude/user/subnet/list$', views.ViewExcludeUserSubnetList.as_view(), name='ViewExcludeUserSubnetList'),140 url(r'^exclude/user/subnet/create$', views.ViewExcludeUserSubnetCreate.as_view(), name='ViewExcludeUserSubnetCreate'),141 url(r'^exclude/user/subnet/(?P<pk>\d+)/update$', views.ViewExcludeUserSubnetUpdate.as_view(), name='ViewExcludeUserSubnetUpdate'), 142 url(r'^exclude/user/agent/list$', views.ViewExcludeUserAgentList.as_view(), name='ViewExcludeUserAgentList'),143 url(r'^exclude/user/agent/create$', views.ViewExcludeUserAgentCreate.as_view(), name='ViewExcludeUserAgentCreate'),144 url(r'^exclude/user/agent/(?P<pk>\d+)/update$', views.ViewExcludeUserAgentUpdate.as_view(), name='ViewExcludeUserAgentUpdate'),145 url(r'^exclude/content/type/list$', views.ViewExcludeContentTypeList.as_view(), name='ViewExcludeContentTypeList'),146 url(r'^exclude/content/type/create$', views.ViewExcludeContentTypeCreate.as_view(), name='ViewExcludeContentTypeCreate'),147 url(r'^exclude/content/type/(?P<pk>\d+)/update$', views.ViewExcludeContentTypeUpdate.as_view(), name='ViewExcludeContentTypeUpdate'),148 url(r'^exclude/schedule/list$', views.ViewExcludeScheduleList.as_view(), name='ViewExcludeScheduleList'),149 url(r'^exclude/schedule/create$', views.ViewExcludeScheduleCreate.as_view(), name='ViewExcludeScheduleCreate'),150 url(r'^exclude/schedule/(?P<pk>\d+)/update$', views.ViewExcludeScheduleUpdate.as_view(), name='ViewExcludeScheduleUpdate'),151 url(r'^exclude/advanced/ssl$', views.ViewExcludeAdvancedSsl.as_view(), name='ViewExcludeAdvancedSsl'), 152 url(r'^exclude/advanced/adaptation$', views.ViewExcludeAdvancedAdaptation.as_view(), name='ViewExcludeAdvancedAdaptation'),153 url(r'^exclude/advanced/auth$', views.ViewExcludeAdvancedAuth.as_view(), name='ViewExcludeAdvancedAuth'),154 url(r'^exclude/advanced/cache$', views.ViewExcludeAdvancedCache.as_view(), name='ViewExcludeAdvancedCache'),155 url(r'^exclude/advanced/urlrewriter$', views.ViewExcludeAdvancedUrlRewriter.as_view(),name='ViewExcludeAdvancedUrlRewriter'),156 url(r'^exclude/category/update$', views.ViewExcludeCategoryUpdate.as_view(), name='ViewExcludeCategoryUpdate'),157 # auth158 url(r'^auth/mode/explicit$', views.ViewAuthExplicit.as_view(), name='ViewAuthExplicit'),159 url(r'^auth/mode/pseudo$', views.ViewAuthPseudo.as_view(), name='ViewAuthPseudo'),160 url(r'^auth/domain/edit$', views.ViewAuthDomainEdit.as_view(), name='ViewAuthDomainEdit'),161 url(r'^auth/domain/test/$', views.ViewAuthDomainTest.as_view(), name='ViewAuthDomainTest'), 162 url(r'^auth/domain/ldaps$', views.ViewAuthDomainLdaps.as_view(), name='ViewAuthDomainLdaps'),163 url(r'^auth/domain/ldaps/export$', views.ViewAuthDomainLdapsExport.as_view(), name='ViewAuthDomainLdapsExport'),164 url(r'^auth/domain/ldaps/remove$', views.ViewAuthDomainLdapsRemove.as_view(), name='ViewAuthDomainLdapsRemove'),165 url(r'^auth/domain/ldaps/detect$', views.ViewLdapsDetect.as_view(), name='ViewLdapsDetect'),166 url(r'^auth/detect$', views.ViewAuthDetect.as_view(), name='ViewAuthDetect'),167 url(r'^auth/group/edit$', views.ViewAuthGroupMembershipEdit.as_view(), name='ViewAuthGroupMembershipEdit'),168 url(r'^auth/negotiate/scheme/edit$', views.ViewAuthNegotiateSchemeEdit.as_view(), name='ViewAuthNegotiateSchemeEdit'),169 url(r'^auth/negotiate/scheme/download/keytab$', views.ViewAuthNegotiateSchemeGetKeyTab.as_view(), name='ViewAuthNegotiateSchemeGetKeyTab'),170 url(r'^auth/ntlm/scheme/edit$', views.ViewAuthNtlmSchemeEdit.as_view(), name='ViewAuthNtlmSchemeEdit'),171 url(r'^auth/ldap/scheme/edit$', views.ViewAuthLdapSchemeEdit.as_view(), name='ViewAuthLdapSchemeEdit'),172 url(r'^auth/localdb/edit$', views.ViewAuthLocalDbEdit.as_view(), name='ViewAuthLocalDbEdit'),173 url(r'^auth/localdb/user/list/$', views.ViewAuthLocalDbUsersList.as_view(), name='ViewAuthLocalDbUsersList'),174 url(r'^auth/localdb/user/(?P<pk>[\w\.]+)/edit/$', views.ViewAuthLocalDbUsersUpdate.as_view(), name='ViewAuthLocalDbUsersUpdate'),175 url(r'^auth/localdb/user/create/$', views.ViewAuthLocalDbUsersCreate.as_view(), name='ViewAuthLocalDbUsersCreate'),176 url(r'^auth/localdb/export/$', views.ViewAuthLocalDbExport.as_view(), name='ViewAuthLocalDbExport'),177 url(r'^auth/localdb/import$', views.ViewAuthLocalDbImport.as_view(), name='ViewAuthLocalDbImport'),178 url(r'^auth/radius/edit$', views.ViewAuthRadiusEdit.as_view(), name='ViewAuthRadiusEdit'),179 180 url(r'^auth/label/edit$', views.ViewAuthLabelEdit.as_view(), name='ViewAuthLabelEdit'),181 url(r'^auth/label/user/list/$', views.ViewAuthLabelList.as_view(), name='ViewAuthLabelList'),182 url(r'^auth/label/user/(?P<pk>[\w\.]+)/edit/$', views.ViewAuthLabelUpdate.as_view(), name='ViewAuthLabelUpdate'),183 url(r'^auth/label/user/create/$', views.ViewAuthLabelCreate.as_view(), name='ViewAuthLabelCreate'),184 url(r'^auth/pseudo/edit$', views.ViewAuthPseudoEdit.as_view(), name='ViewAuthPseudoEdit'),185 url(r'^auth/pseudo/user/list/$', views.ViewAuthPseudoList.as_view(), name='ViewAuthPseudoList'),186 187 # tools188 url(r'^tools/upload$', views.ToolsUploadSquidFile.as_view(), name='ToolsUploadSquidFile'),189 url(r'^tools/wpad/upload$', views.ToolsUploadWpad.as_view(), name='ToolsUploadWpad'),190 url(r'^tools/wpad/remove$', views.ToolsRemoveWpad.as_view(), name='ToolsRemoveWpad'),191 url(r'^tools/sslservertest$', views.ToolsSslServerTest.as_view(), name='ToolsSslServerTest'),192 # logs193 url(r'^logs/access/log$', views.ViewAccessLog.as_view(), name='ViewAccessLog'),194 url(r'^logs/cache/log$', views.ViewCacheLog.as_view(), name='ViewCacheLog'),195 url(r'^logs/levels$', views.ViewLogLevels.as_view(), name='ViewLogLevels'),196 url(r'^logs/section/(?P<pk>\d+)/update$', views.ViewLogSectionUpdate.as_view(), name='ViewLogSectionUpdate'),197 # cache198 url(r'^cache/memory$', views.ViewCacheMemory.as_view(), name='ViewCacheMemory'),199 url(r'^cache/disk$', views.ViewCacheDisk.as_view(), name='ViewCacheDisk'),200 url(r'^cache/disk/enable/$', views.ViewCacheDiskEnable.as_view(), name='ViewCacheDiskEnable'),201 url(r'^cache/disk/reset/$', views.ViewCacheDiskReset.as_view(), name='ViewCacheDiskReset'),202 url(r'^cache/refresh/pattern/list$', views.ViewCacheRefreshPatternList.as_view(), name='ViewCacheRefreshPatternList'),203 url(r'^cache/refresh/pattern/create$', views.ViewCacheRefreshPatternCreate.as_view(), name='ViewCacheRefreshPatternCreate'),204 url(r'^cache/refresh/pattern/(?P<pk>\d+)/update$', views.ViewCacheRefreshPatternUpdate.as_view(), name='ViewCacheRefreshPatternUpdate'),...

Full Screen

Full Screen

view.js

Source:view.js Github

copy

Full Screen

1$(document).ready(function() {2 var view;3 module("Backbone.View", {4 setup: function() {5 view = new Backbone.View({6 id : 'test-view',7 className : 'test-view',8 other : 'non-special-option'9 });10 }11 });12 test("constructor", 6, function() {13 equal(view.el.id, 'test-view');14 equal(view.el.className, 'test-view');15 equal(view.el.other, void 0);16 equal(view.options.id, 'test-view');17 equal(view.options.className, 'test-view');18 equal(view.options.other, 'non-special-option');19 });20 test("jQuery", 1, function() {21 var view = new Backbone.View;22 view.setElement('<p><a><b>test</b></a></p>');23 strictEqual(view.$('a b').html(), 'test');24 });25 test("initialize", 1, function() {26 var View = Backbone.View.extend({27 initialize: function() {28 this.one = 1;29 }30 });31 strictEqual(new View().one, 1);32 });33 test("delegateEvents", 6, function() {34 var counter1 = 0, counter2 = 0;35 var view = new Backbone.View({el: '<p><a id="test"></a></p>'});36 view.increment = function(){ counter1++; };37 view.$el.on('click', function(){ counter2++; });38 var events = {'click #test': 'increment'};39 view.delegateEvents(events);40 view.$('#test').trigger('click');41 equal(counter1, 1);42 equal(counter2, 1);43 view.$('#test').trigger('click');44 equal(counter1, 2);45 equal(counter2, 2);46 view.delegateEvents(events);47 view.$('#test').trigger('click');48 equal(counter1, 3);49 equal(counter2, 3);50 });51 test("delegateEvents allows functions for callbacks", 3, function() {52 var view = new Backbone.View({el: '<p></p>'});53 view.counter = 0;54 var events = {55 click: function() {56 this.counter++;57 }58 };59 view.delegateEvents(events);60 view.$el.trigger('click');61 equal(view.counter, 1);62 view.$el.trigger('click');63 equal(view.counter, 2);64 view.delegateEvents(events);65 view.$el.trigger('click');66 equal(view.counter, 3);67 });68 test("delegateEvents ignore undefined methods", 0, function() {69 var view = new Backbone.View({el: '<p></p>'});70 view.delegateEvents({'click': 'undefinedMethod'});71 view.$el.trigger('click');72 });73 test("undelegateEvents", 6, function() {74 var counter1 = 0, counter2 = 0;75 var view = new Backbone.View({el: '<p><a id="test"></a></p>'});76 view.increment = function(){ counter1++; };77 view.$el.on('click', function(){ counter2++; });78 var events = {'click #test': 'increment'};79 view.delegateEvents(events);80 view.$('#test').trigger('click');81 equal(counter1, 1);82 equal(counter2, 1);83 view.undelegateEvents();84 view.$('#test').trigger('click');85 equal(counter1, 1);86 equal(counter2, 2);87 view.delegateEvents(events);88 view.$('#test').trigger('click');89 equal(counter1, 2);90 equal(counter2, 3);91 });92 test("_ensureElement with DOM node el", 1, function() {93 var View = Backbone.View.extend({94 el: document.body95 });96 equal(new View().el, document.body);97 });98 test("_ensureElement with string el", 3, function() {99 var View = Backbone.View.extend({100 el: "body"101 });102 strictEqual(new View().el, document.body);103 View = Backbone.View.extend({104 el: "#testElement > h1"105 });106 strictEqual(new View().el, $("#testElement > h1").get(0));107 View = Backbone.View.extend({108 el: "#nonexistent"109 });110 ok(!new View().el);111 });112 test("with className and id functions", 2, function() {113 var View = Backbone.View.extend({114 className: function() {115 return 'className';116 },117 id: function() {118 return 'id';119 }120 });121 strictEqual(new View().el.className, 'className');122 strictEqual(new View().el.id, 'id');123 });124 test("with options function", 3, function() {125 var View1 = Backbone.View.extend({126 options: function() {127 return {128 title: 'title1',129 acceptText: 'confirm'130 };131 }132 });133 var View2 = View1.extend({134 options: function() {135 return _.extend(View1.prototype.options.call(this), {136 title: 'title2',137 fixed: true138 });139 }140 });141 strictEqual(new View2().options.title, 'title2');142 strictEqual(new View2().options.acceptText, 'confirm');143 strictEqual(new View2().options.fixed, true);144 });145 test("with attributes", 2, function() {146 var View = Backbone.View.extend({147 attributes: {148 id: 'id',149 'class': 'class'150 }151 });152 strictEqual(new View().el.className, 'class');153 strictEqual(new View().el.id, 'id');154 });155 test("with attributes as a function", 1, function() {156 var View = Backbone.View.extend({157 attributes: function() {158 return {'class': 'dynamic'};159 }160 });161 strictEqual(new View().el.className, 'dynamic');162 });163 test("multiple views per element", 3, function() {164 var count = 0;165 var $el = $('<p></p>');166 var View = Backbone.View.extend({167 el: $el,168 events: {169 click: function() {170 count++;171 }172 }173 });174 var view1 = new View;175 $el.trigger("click");176 equal(1, count);177 var view2 = new View;178 $el.trigger("click");179 equal(3, count);180 view1.delegateEvents();181 $el.trigger("click");182 equal(5, count);183 });184 test("custom events, with namespaces", 2, function() {185 var count = 0;186 var View = Backbone.View.extend({187 el: $('body'),188 events: function() {189 return {"fake$event.namespaced": "run"};190 },191 run: function() {192 count++;193 }194 });195 var view = new View;196 $('body').trigger('fake$event').trigger('fake$event');197 equal(count, 2);198 $('body').unbind('.namespaced');199 $('body').trigger('fake$event');200 equal(count, 2);201 });202 test("#1048 - setElement uses provided object.", 2, function() {203 var $el = $('body');204 var view = new Backbone.View({el: $el});205 ok(view.$el === $el);206 view.setElement($el = $($el));207 ok(view.$el === $el);208 });209 test("#986 - Undelegate before changing element.", 1, function() {210 var button1 = $('<button></button>');211 var button2 = $('<button></button>');212 var View = Backbone.View.extend({213 events: {214 click: function(e) {215 ok(view.el === e.target);216 }217 }218 });219 var view = new View({el: button1});220 view.setElement(button2);221 button1.trigger('click');222 button2.trigger('click');223 });224 test("#1172 - Clone attributes object", 2, function() {225 var View = Backbone.View.extend({226 attributes: {foo: 'bar'}227 });228 var view1 = new View({id: 'foo'});229 strictEqual(view1.el.id, 'foo');230 var view2 = new View();231 ok(!view2.el.id);232 });233 test("#1228 - tagName can be provided as a function", 1, function() {234 var View = Backbone.View.extend({235 tagName: function() {236 return 'p';237 }238 });239 ok(new View().$el.is('p'));240 });241 test("views stopListening", 0, function() {242 var View = Backbone.View.extend({243 initialize: function() {244 this.listenTo(this.model, 'all x', function(){ ok(false); }, this);245 this.listenTo(this.collection, 'all x', function(){ ok(false); }, this);246 }247 });248 var view = new View({249 model: new Backbone.Model,250 collection: new Backbone.Collection251 });252 view.stopListening();253 view.model.trigger('x');254 view.collection.trigger('x');255 });256 test("Provide function for el.", 1, function() {257 var View = Backbone.View.extend({258 el: function() {259 return "<p><a></a></p>";260 }261 });262 var view = new View;263 ok(view.$el.is('p:has(a)'));264 });265 test("events passed in options", 2, function() {266 var counter = 0;267 var View = Backbone.View.extend({268 el: '<p><a id="test"></a></p>',269 increment: function() {270 counter++;271 }272 });273 var view = new View({events:{'click #test':'increment'}});274 var view2 = new View({events:function(){275 return {'click #test':'increment'};276 }});277 view.$('#test').trigger('click');278 view2.$('#test').trigger('click');279 equal(counter, 2);280 view.$('#test').trigger('click');281 view2.$('#test').trigger('click');282 equal(counter, 4);283 });...

Full Screen

Full Screen

App.js

Source:App.js Github

copy

Full Screen

1import './App.css';2import { BrowserRouter, Route, Switch } from "react-router-dom";3import LoginView from './view/login/login_view';4import PageConstant from './constant/page_constant';5import HomeView from './view/home/home_view';6import UsersView from './view/users/users_view';7import UserTaskView from './view/users/user_task_view';8import RegisterView from './view/register/register_view';9import UserEditView from './view/users/users_edit_view';10import TrucksView from './view/truck/trucks_view';11import TrucksEditView from './view/truck/trucks_edit_view';12import UserAddView from './view/users/users_add_view';13import TrucksAddView from './view/truck/trucks_add_view';14import VendorsView from './view/vendor/vendors_view';15import VendorAddView from './view/vendor/vendor_add_view';16import VendorEditView from './view/vendor/vendor_edit_view';17import FactoriesView from './view/factory/factories_view';18import FactoryAddView from './view/factory/factory_add_view';19import FactoryEditView from './view/factory/factory_edit_view';20import TaskView from './view/task/task_view';21import TaskAddView from './view/task/task_add_view';22import TaskEditView from './view/task/task_edit_view';23import TaskAssignView from './view/task/task_assign_view';24import AssignedTaskView from './view/task/assigned_task_view';25import AssignedTaskDetailView from './view/task/assigned_task_detail_view';26import TaskRouteMapView from './view/map/task_route_map_view';27import DangerAreaAddView from './view/areas/danger_area_add_view';28import DangerAreasView from './view/areas/danger_areas_view';29import FactoryTaskView from './view/factory/factory_task_view';30import FactoriesEntryView from './view/factory/factories_entry_view';31function App() {32 return (33 <div>34 <BrowserRouter>35 <Switch>36 <Route exact path={PageConstant.MAIN_PAGE_URL} component={HomeView} />37 <Route path={PageConstant.LOGIN_PAGE_URL} component={LoginView} />38 <Route path={PageConstant.USERS_PAGE_URL} component={UsersView} />39 <Route path={PageConstant.TASK_ADD_PAGE_URL} component={TaskAddView} />40 <Route path={PageConstant.USER_TASK_PAGE_URL} component={UserTaskView} />41 <Route path={PageConstant.REGISTER_PAGE_URL} component={RegisterView} />42 <Route path={PageConstant.USER_EDIT_PAGE_URL} component={UserEditView} />43 <Route path={PageConstant.USER_ADD_PAGE_URL} component={UserAddView} />44 <Route path={PageConstant.TRUCKS_PAGE_URL} component={TrucksView} />45 <Route path={PageConstant.TRUCKS_EDIT_PAGE_URL} component={TrucksEditView} />46 <Route path={PageConstant.TRUCKS_ADD_PAGE_URL} component={TrucksAddView} />47 <Route path={PageConstant.VENDOR_PAGE_URL} component={VendorsView} />48 <Route path={PageConstant.VENDOR_ADD_PAGE_URL} component={VendorAddView} />49 <Route path={PageConstant.VENDOR_EDIT_PAGE_URL} component={VendorEditView} />50 <Route path={PageConstant.FACTORIES_PAGE_URL} component={FactoriesView} />51 <Route path={PageConstant.FACTORY_ADD_PAGE_URL} component={FactoryAddView} />52 <Route path={PageConstant.FACTORY_EDIT_PAGE_URL} component={FactoryEditView} />53 <Route path={PageConstant.TASKS_PAGE_URL} component={TaskView} />54 <Route path={PageConstant.TASK_ADD_PAGE_URL} component={TaskAddView} />55 <Route path={PageConstant.TASK_EDIT_PAGE_URL} component={TaskEditView} />56 <Route path={PageConstant.TASK_ASSIGN_PAGE_URL} component={TaskAssignView} />57 <Route path={PageConstant.ASSIGNED_TASK_PAGE_URL} component={AssignedTaskView} />58 <Route path={PageConstant.ASSIGNED_TASK_DETAIL_PAGE_URL} component={AssignedTaskDetailView} />59 <Route path={PageConstant.TASK_ROUTE_MAP_VIEW} component={TaskRouteMapView} />60 <Route path={PageConstant.DANGER_AREA_ADD_VIEW} component={DangerAreaAddView} />61 <Route path={PageConstant.DANGER_AREAS_VIEW} component={DangerAreasView} />62 <Route path={PageConstant.FACTORY_TASK_VÄ°EW} component={FactoryTaskView} />63 <Route path={PageConstant.FACTORY_ENTRY_VÄ°EW} component={FactoriesEntryView} />64 </Switch>65 </BrowserRouter>66 </div>67 );68}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const BestTimeToBuyAndSellStock = require('./BestTimeToBuyAndSellStock');2const bestTimeToBuyAndSellStock = new BestTimeToBuyAndSellStock();3const input = [7, 1, 5, 3, 6, 4];4const output = bestTimeToBuyAndSellStock.view(input);5console.log(output);6class BestTimeToBuyAndSellStock {7 view(prices) {8 let maxProfit = 0;9 let minPrice = Number.MAX_SAFE_INTEGER;10 for (let i = 0; i < prices.length; i++) {11 if (prices[i] < minPrice) {12 minPrice = prices[i];13 } else if (prices[i] - minPrice > maxProfit) {14 maxProfit = prices[i] - minPrice;15 }16 }17 return maxProfit;18 }19}20module.exports = BestTimeToBuyAndSellStock;

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestRoute = require('./BestRoute.js');2var bestRoute = new BestRoute();3bestRoute.view();4var BestRoute = require('./BestRoute.js');5var bestRoute = new BestRoute();6bestRoute.view();7var BestRoute = function() {8 this.view = function() {9 console.log('view');10 }11};12module.exports = BestRoute;13var BestRoute = function() {14 this.view = function() {15 console.log('view');16 }17};18module.exports = BestRoute;

Full Screen

Using AI Code Generation

copy

Full Screen

1var Bestseller = require('./Bestseller');2var myBestseller = new Bestseller();3myBestseller.view();4var Bestseller = function() {5 this.title = 'The Alchemist';6};7Bestseller.prototype.view = function() {8 console.log('The bestseller is ' + this.title);9};10module.exports = Bestseller;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Best automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful