WebGLRenderer.tests.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /**
  2. * @author TristanVALCKE / https://github.com/Itee
  3. */
  4. /* global QUnit */
  5. import { WebGLRenderer } from '../../../../src/renderers/WebGLRenderer';
  6. var customDocument = function () {
  7. this.createElementNS = function ( namespace, elementName ) {
  8. if ( namespace === "http://www.w3.org/1999/xhtml" && elementName === "canvas" ) {
  9. return new customCanvas();
  10. } else {
  11. throw new Error( "customDocument.CreateElementNS has not implemented following element " + elementName + " from namespace " + namespace + "." );
  12. }
  13. };
  14. };
  15. var customCanvas = function () {
  16. this.width = 200;
  17. this.height = 200;
  18. this.addEventListener = function () {};
  19. this.getContext = function ( contextName ) {
  20. if ( contextName === "webgl" ) {
  21. return new customWebGLContext();
  22. } else {
  23. throw new Error( "customCanvas.getContext has not implemented following context " + contextName + "." );
  24. }
  25. };
  26. };
  27. var customWebGLContext = function () {
  28. this.DEPTH_BUFFER_BIT = 256;
  29. this.STENCIL_BUFFER_BIT = 1024;
  30. this.COLOR_BUFFER_BIT = 16384;
  31. this.POINTS = 0;
  32. this.LINES = 1;
  33. this.LINE_LOOP = 2;
  34. this.LINE_STRIP = 3;
  35. this.TRIANGLES = 4;
  36. this.TRIANGLE_STRIP = 5;
  37. this.TRIANGLE_FAN = 6;
  38. this.ZERO = 0;
  39. this.ONE = 1;
  40. this.SRC_COLOR = 768;
  41. this.ONE_MINUS_SRC_COLOR = 769;
  42. this.SRC_ALPHA = 770;
  43. this.ONE_MINUS_SRC_ALPHA = 771;
  44. this.DST_ALPHA = 772;
  45. this.ONE_MINUS_DST_ALPHA = 773;
  46. this.DST_COLOR = 774;
  47. this.ONE_MINUS_DST_COLOR = 775;
  48. this.SRC_ALPHA_SATURATE = 776;
  49. this.FUNC_ADD = 32774;
  50. this.BLEND_EQUATION = 32777;
  51. this.BLEND_EQUATION_RGB = 32777;
  52. this.BLEND_EQUATION_ALPHA = 34877;
  53. this.FUNC_SUBTRACT = 32778;
  54. this.FUNC_REVERSE_SUBTRACT = 32779;
  55. this.BLEND_DST_RGB = 32968;
  56. this.BLEND_SRC_RGB = 32969;
  57. this.BLEND_DST_ALPHA = 32970;
  58. this.BLEND_SRC_ALPHA = 32971;
  59. this.CONSTANT_COLOR = 32769;
  60. this.ONE_MINUS_CONSTANT_COLOR = 32770;
  61. this.CONSTANT_ALPHA = 32771;
  62. this.ONE_MINUS_CONSTANT_ALPHA = 32772;
  63. this.BLEND_COLOR = 32773;
  64. this.ARRAY_BUFFER = 34962;
  65. this.ELEMENT_ARRAY_BUFFER = 34963;
  66. this.ARRAY_BUFFER_BINDING = 34964;
  67. this.ELEMENT_ARRAY_BUFFER_BINDING = 34965;
  68. this.STREAM_DRAW = 35040;
  69. this.STATIC_DRAW = 35044;
  70. this.DYNAMIC_DRAW = 35048;
  71. this.BUFFER_SIZE = 34660;
  72. this.BUFFER_USAGE = 34661;
  73. this.CURRENT_VERTEX_ATTRIB = 34342;
  74. this.FRONT = 1028;
  75. this.BACK = 1029;
  76. this.FRONT_AND_BACK = 1032;
  77. this.TEXTURE_2D = 3553;
  78. this.CULL_FACE = 2884;
  79. this.BLEND = 3042;
  80. this.DITHER = 3024;
  81. this.STENCIL_TEST = 2960;
  82. this.DEPTH_TEST = 2929;
  83. this.SCISSOR_TEST = 3089;
  84. this.POLYGON_OFFSET_FILL = 32823;
  85. this.SAMPLE_ALPHA_TO_COVERAGE = 32926;
  86. this.SAMPLE_COVERAGE = 32928;
  87. this.NO_ERROR = 0;
  88. this.INVALID_ENUM = 1280;
  89. this.INVALID_VALUE = 1281;
  90. this.INVALID_OPERATION = 1282;
  91. this.OUT_OF_MEMORY = 1285;
  92. this.CW = 2304;
  93. this.CCW = 2305;
  94. this.LINE_WIDTH = 2849;
  95. this.ALIASED_POINT_SIZE_RANGE = 33901;
  96. this.ALIASED_LINE_WIDTH_RANGE = 33902;
  97. this.CULL_FACE_MODE = 2885;
  98. this.FRONT_FACE = 2886;
  99. this.DEPTH_RANGE = 2928;
  100. this.DEPTH_WRITEMASK = 2930;
  101. this.DEPTH_CLEAR_VALUE = 2931;
  102. this.DEPTH_FUNC = 2932;
  103. this.STENCIL_CLEAR_VALUE = 2961;
  104. this.STENCIL_FUNC = 2962;
  105. this.STENCIL_FAIL = 2964;
  106. this.STENCIL_PASS_DEPTH_FAIL = 2965;
  107. this.STENCIL_PASS_DEPTH_PASS = 2966;
  108. this.STENCIL_REF = 2967;
  109. this.STENCIL_VALUE_MASK = 2963;
  110. this.STENCIL_WRITEMASK = 2968;
  111. this.STENCIL_BACK_FUNC = 34816;
  112. this.STENCIL_BACK_FAIL = 34817;
  113. this.STENCIL_BACK_PASS_DEPTH_FAIL = 34818;
  114. this.STENCIL_BACK_PASS_DEPTH_PASS = 34819;
  115. this.STENCIL_BACK_REF = 36003;
  116. this.STENCIL_BACK_VALUE_MASK = 36004;
  117. this.STENCIL_BACK_WRITEMASK = 36005;
  118. this.VIEWPORT = 2978;
  119. this.SCISSOR_BOX = 3088;
  120. this.COLOR_CLEAR_VALUE = 3106;
  121. this.COLOR_WRITEMASK = 3107;
  122. this.UNPACK_ALIGNMENT = 3317;
  123. this.PACK_ALIGNMENT = 3333;
  124. this.MAX_TEXTURE_SIZE = 3379;
  125. this.MAX_VIEWPORT_DIMS = 3386;
  126. this.SUBPIXEL_BITS = 3408;
  127. this.RED_BITS = 3410;
  128. this.GREEN_BITS = 3411;
  129. this.BLUE_BITS = 3412;
  130. this.ALPHA_BITS = 3413;
  131. this.DEPTH_BITS = 3414;
  132. this.STENCIL_BITS = 3415;
  133. this.POLYGON_OFFSET_UNITS = 10752;
  134. this.POLYGON_OFFSET_FACTOR = 32824;
  135. this.TEXTURE_BINDING_2D = 32873;
  136. this.SAMPLE_BUFFERS = 32936;
  137. this.SAMPLES = 32937;
  138. this.SAMPLE_COVERAGE_VALUE = 32938;
  139. this.SAMPLE_COVERAGE_INVERT = 32939;
  140. this.COMPRESSED_TEXTURE_FORMATS = 34467;
  141. this.DONT_CARE = 4352;
  142. this.FASTEST = 4353;
  143. this.NICEST = 4354;
  144. this.GENERATE_MIPMAP_HINT = 33170;
  145. this.BYTE = 5120;
  146. this.UNSIGNED_BYTE = 5121;
  147. this.SHORT = 5122;
  148. this.UNSIGNED_SHORT = 5123;
  149. this.INT = 5124;
  150. this.UNSIGNED_INT = 5125;
  151. this.FLOAT = 5126;
  152. this.DEPTH_COMPONENT = 6402;
  153. this.ALPHA = 6406;
  154. this.RGB = 6407;
  155. this.RGBA = 6408;
  156. this.LUMINANCE = 6409;
  157. this.LUMINANCE_ALPHA = 6410;
  158. this.UNSIGNED_SHORT_4_4_4_4 = 32819;
  159. this.UNSIGNED_SHORT_5_5_5_1 = 32820;
  160. this.UNSIGNED_SHORT_5_6_5 = 33635;
  161. this.FRAGMENT_SHADER = 35632;
  162. this.VERTEX_SHADER = 35633;
  163. this.MAX_VERTEX_ATTRIBS = 34921;
  164. this.MAX_VERTEX_UNIFORM_VECTORS = 36347;
  165. this.MAX_VARYING_VECTORS = 36348;
  166. this.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661;
  167. this.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660;
  168. this.MAX_TEXTURE_IMAGE_UNITS = 34930;
  169. this.MAX_FRAGMENT_UNIFORM_VECTORS = 36349;
  170. this.SHADER_TYPE = 35663;
  171. this.DELETE_STATUS = 35712;
  172. this.LINK_STATUS = 35714;
  173. this.VALIDATE_STATUS = 35715;
  174. this.ATTACHED_SHADERS = 35717;
  175. this.ACTIVE_UNIFORMS = 35718;
  176. this.ACTIVE_ATTRIBUTES = 35721;
  177. this.SHADING_LANGUAGE_VERSION = 35724;
  178. this.CURRENT_PROGRAM = 35725;
  179. this.NEVER = 512;
  180. this.LESS = 513;
  181. this.EQUAL = 514;
  182. this.LEQUAL = 515;
  183. this.GREATER = 516;
  184. this.NOTEQUAL = 517;
  185. this.GEQUAL = 518;
  186. this.ALWAYS = 519;
  187. this.KEEP = 7680;
  188. this.REPLACE = 7681;
  189. this.INCR = 7682;
  190. this.DECR = 7683;
  191. this.INVERT = 5386;
  192. this.INCR_WRAP = 34055;
  193. this.DECR_WRAP = 34056;
  194. this.VENDOR = 7936;
  195. this.RENDERER = 7937;
  196. this.VERSION = 7938;
  197. this.NEAREST = 9728;
  198. this.LINEAR = 9729;
  199. this.NEAREST_MIPMAP_NEAREST = 9984;
  200. this.LINEAR_MIPMAP_NEAREST = 9985;
  201. this.NEAREST_MIPMAP_LINEAR = 9986;
  202. this.LINEAR_MIPMAP_LINEAR = 9987;
  203. this.TEXTURE_MAG_FILTER = 10240;
  204. this.TEXTURE_MIN_FILTER = 10241;
  205. this.TEXTURE_WRAP_S = 10242;
  206. this.TEXTURE_WRAP_T = 10243;
  207. this.TEXTURE = 5890;
  208. this.TEXTURE_CUBE_MAP = 34067;
  209. this.TEXTURE_BINDING_CUBE_MAP = 34068;
  210. this.TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
  211. this.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070;
  212. this.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071;
  213. this.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072;
  214. this.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073;
  215. this.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074;
  216. this.MAX_CUBE_MAP_TEXTURE_SIZE = 34076;
  217. this.TEXTURE0 = 33984;
  218. this.TEXTURE1 = 33985;
  219. this.TEXTURE2 = 33986;
  220. this.TEXTURE3 = 33987;
  221. this.TEXTURE4 = 33988;
  222. this.TEXTURE5 = 33989;
  223. this.TEXTURE6 = 33990;
  224. this.TEXTURE7 = 33991;
  225. this.TEXTURE8 = 33992;
  226. this.TEXTURE9 = 33993;
  227. this.TEXTURE10 = 33994;
  228. this.TEXTURE11 = 33995;
  229. this.TEXTURE12 = 33996;
  230. this.TEXTURE13 = 33997;
  231. this.TEXTURE14 = 33998;
  232. this.TEXTURE15 = 33999;
  233. this.TEXTURE16 = 34000;
  234. this.TEXTURE17 = 34001;
  235. this.TEXTURE18 = 34002;
  236. this.TEXTURE19 = 34003;
  237. this.TEXTURE20 = 34004;
  238. this.TEXTURE21 = 34005;
  239. this.TEXTURE22 = 34006;
  240. this.TEXTURE23 = 34007;
  241. this.TEXTURE24 = 34008;
  242. this.TEXTURE25 = 34009;
  243. this.TEXTURE26 = 34010;
  244. this.TEXTURE27 = 34011;
  245. this.TEXTURE28 = 34012;
  246. this.TEXTURE29 = 34013;
  247. this.TEXTURE30 = 34014;
  248. this.TEXTURE31 = 34015;
  249. this.ACTIVE_TEXTURE = 34016;
  250. this.REPEAT = 10497;
  251. this.CLAMP_TO_EDGE = 33071;
  252. this.MIRRORED_REPEAT = 33648;
  253. this.FLOAT_VEC2 = 35664;
  254. this.FLOAT_VEC3 = 35665;
  255. this.FLOAT_VEC4 = 35666;
  256. this.INT_VEC2 = 35667;
  257. this.INT_VEC3 = 35668;
  258. this.INT_VEC4 = 35669;
  259. this.BOOL = 35670;
  260. this.BOOL_VEC2 = 35671;
  261. this.BOOL_VEC3 = 35672;
  262. this.BOOL_VEC4 = 35673;
  263. this.FLOAT_MAT2 = 35674;
  264. this.FLOAT_MAT3 = 35675;
  265. this.FLOAT_MAT4 = 35676;
  266. this.SAMPLER_2D = 35678;
  267. this.SAMPLER_CUBE = 35680;
  268. this.VERTEX_ATTRIB_ARRAY_ENABLED = 34338;
  269. this.VERTEX_ATTRIB_ARRAY_SIZE = 34339;
  270. this.VERTEX_ATTRIB_ARRAY_STRIDE = 34340;
  271. this.VERTEX_ATTRIB_ARRAY_TYPE = 34341;
  272. this.VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922;
  273. this.VERTEX_ATTRIB_ARRAY_POINTER = 34373;
  274. this.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975;
  275. this.IMPLEMENTATION_COLOR_READ_TYPE = 35738;
  276. this.IMPLEMENTATION_COLOR_READ_FORMAT = 35739;
  277. this.COMPILE_STATUS = 35713;
  278. this.LOW_FLOAT = 36336;
  279. this.MEDIUM_FLOAT = 36337;
  280. this.HIGH_FLOAT = 36338;
  281. this.LOW_INT = 36339;
  282. this.MEDIUM_INT = 36340;
  283. this.HIGH_INT = 36341;
  284. this.FRAMEBUFFER = 36160;
  285. this.RENDERBUFFER = 36161;
  286. this.RGBA4 = 32854;
  287. this.RGB5_A1 = 32855;
  288. this.RGB565 = 36194;
  289. this.DEPTH_COMPONENT16 = 33189;
  290. this.STENCIL_INDEX8 = 36168;
  291. this.DEPTH_STENCIL = 34041;
  292. this.RENDERBUFFER_WIDTH = 36162;
  293. this.RENDERBUFFER_HEIGHT = 36163;
  294. this.RENDERBUFFER_INTERNAL_FORMAT = 36164;
  295. this.RENDERBUFFER_RED_SIZE = 36176;
  296. this.RENDERBUFFER_GREEN_SIZE = 36177;
  297. this.RENDERBUFFER_BLUE_SIZE = 36178;
  298. this.RENDERBUFFER_ALPHA_SIZE = 36179;
  299. this.RENDERBUFFER_DEPTH_SIZE = 36180;
  300. this.RENDERBUFFER_STENCIL_SIZE = 36181;
  301. this.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048;
  302. this.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049;
  303. this.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050;
  304. this.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051;
  305. this.COLOR_ATTACHMENT0 = 36064;
  306. this.DEPTH_ATTACHMENT = 36096;
  307. this.STENCIL_ATTACHMENT = 36128;
  308. this.DEPTH_STENCIL_ATTACHMENT = 33306;
  309. this.NONE = 0;
  310. this.FRAMEBUFFER_COMPLETE = 36053;
  311. this.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054;
  312. this.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055;
  313. this.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057;
  314. this.FRAMEBUFFER_UNSUPPORTED = 36061;
  315. this.FRAMEBUFFER_BINDING = 36006;
  316. this.RENDERBUFFER_BINDING = 36007;
  317. this.MAX_RENDERBUFFER_SIZE = 34024;
  318. this.INVALID_FRAMEBUFFER_OPERATION = 1286;
  319. this.UNPACK_FLIP_Y_WEBGL = 37440;
  320. this.UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441;
  321. this.CONTEXT_LOST_WEBGL = 37442;
  322. this.UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443;
  323. this.BROWSER_DEFAULT_WEBGL = 37444;
  324. this.activeTexture = function () {};
  325. this.attachShader = function () {};
  326. this.bindAttribLocation = function () {};
  327. this.bindBuffer = function () {};
  328. this.bindFramebuffer = function () {};
  329. this.bindRenderbuffer = function () {};
  330. this.bindTexture = function () {};
  331. this.blendColor = function () {};
  332. this.blendEquation = function () {};
  333. this.blendEquationSeparate = function () {};
  334. this.blendFunc = function () {};
  335. this.blendFuncSeparate = function () {};
  336. this.bufferData = function () {};
  337. this.bufferSubData = function () {};
  338. this.checkFramebufferStatus = function () {};
  339. this.clear = function () {};
  340. this.clearColor = function () {};
  341. this.clearDepth = function () {};
  342. this.clearStencil = function () {};
  343. this.colorMask = function () {};
  344. this.compileShader = function () {};
  345. this.compressedTexImage2D = function () {};
  346. this.compressedTexSubImage2D = function () {};
  347. this.copyTexImage2D = function () {};
  348. this.copyTexSubImage2D = function () {};
  349. this.createBuffer = function () {};
  350. this.createFramebuffer = function () {};
  351. this.createProgram = function () {};
  352. this.createRenderbuffer = function () {};
  353. this.createShader = function () {};
  354. this.createTexture = function () {};
  355. this.cullFace = function () {};
  356. this.deleteBuffer = function () {};
  357. this.deleteFramebuffer = function () {};
  358. this.deleteProgram = function () {};
  359. this.deleteRenderbuffer = function () {};
  360. this.deleteShader = function () {};
  361. this.deleteTexture = function () {};
  362. this.depthFunc = function () {};
  363. this.depthMask = function () {};
  364. this.depthRange = function () {};
  365. this.detachShader = function () {};
  366. this.disable = function () {};
  367. this.disableVertexAttribArray = function () {};
  368. this.drawArrays = function () {};
  369. this.drawElements = function () {};
  370. this.enable = function () {};
  371. this.enableVertexAttribArray = function () {};
  372. this.finish = function () {};
  373. this.flush = function () {};
  374. this.framebufferRenderbuffer = function () {};
  375. this.framebufferTexture2D = function () {};
  376. this.frontFace = function () {};
  377. this.generateMipmap = function () {};
  378. this.getActiveAttrib = function () {};
  379. this.getActiveUniform = function () {};
  380. this.getAttachedShaders = function () {};
  381. this.getAttribLocation = function () {};
  382. this.getBufferParameter = function () {};
  383. this.getContextAttributes = function () {};
  384. this.getError = function () {};
  385. this.getExtension = function () {};
  386. this.getFramebufferAttachmentParameter = function () {};
  387. var parameters = {};
  388. parameters[ this.VERSION ] = "Custom";
  389. this.getParameter = function ( parameterID ) {
  390. return parameters[ parameterID ];
  391. };
  392. this.getProgramParameter = function () {};
  393. this.getProgramInfoLog = function () {};
  394. this.getRenderbufferParameter = function () {};
  395. this.getShaderParameter = function () {};
  396. this.getShaderInfoLog = function () {};
  397. this.getShaderPrecisionFormat = function () {
  398. return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };
  399. };
  400. this.getShaderSource = function () {};
  401. this.getSupportedExtensions = function () {};
  402. this.getTexParameter = function () {};
  403. this.getUniform = function () {};
  404. this.getUniformLocation = function () {};
  405. this.getVertexAttrib = function () {};
  406. this.getVertexAttribOffset = function () {};
  407. this.hint = function () {};
  408. this.isBuffer = function () {};
  409. this.isContextLost = function () {};
  410. this.isEnabled = function () {};
  411. this.isFramebuffer = function () {};
  412. this.isProgram = function () {};
  413. this.isRenderbuffer = function () {};
  414. this.isShader = function () {};
  415. this.isTexture = function () {};
  416. this.lineWidth = function () {};
  417. this.linkProgram = function () {};
  418. this.pixelStorei = function () {};
  419. this.polygonOffset = function () {};
  420. this.readPixels = function () {};
  421. this.renderbufferStorage = function () {};
  422. this.sampleCoverage = function () {};
  423. this.scissor = function () {};
  424. this.shaderSource = function () {};
  425. this.stencilFunc = function () {};
  426. this.stencilFuncSeparate = function () {};
  427. this.stencilMask = function () {};
  428. this.stencilMaskSeparate = function () {};
  429. this.stencilOp = function () {};
  430. this.stencilOpSeparate = function () {};
  431. this.texParameterf = function () {};
  432. this.texParameteri = function () {};
  433. this.texImage2D = function () {};
  434. this.texSubImage2D = function () {};
  435. this.uniform1f = function () {};
  436. this.uniform1fv = function () {};
  437. this.uniform1i = function () {};
  438. this.uniform1iv = function () {};
  439. this.uniform2f = function () {};
  440. this.uniform2fv = function () {};
  441. this.uniform2i = function () {};
  442. this.uniform2iv = function () {};
  443. this.uniform3f = function () {};
  444. this.uniform3fv = function () {};
  445. this.uniform3i = function () {};
  446. this.uniform3iv = function () {};
  447. this.uniform4f = function () {};
  448. this.uniform4fv = function () {};
  449. this.uniform4i = function () {};
  450. this.uniform4iv = function () {};
  451. this.uniformMatrix2fv = function () {};
  452. this.uniformMatrix3fv = function () {};
  453. this.uniformMatrix4fv = function () {};
  454. this.useProgram = function () {};
  455. this.validateProgram = function () {};
  456. this.vertexAttrib1f = function () {};
  457. this.vertexAttrib1fv = function () {};
  458. this.vertexAttrib2f = function () {};
  459. this.vertexAttrib2fv = function () {};
  460. this.vertexAttrib3f = function () {};
  461. this.vertexAttrib3fv = function () {};
  462. this.vertexAttrib4f = function () {};
  463. this.vertexAttrib4fv = function () {};
  464. this.vertexAttribPointer = function () {};
  465. this.viewport = function () {};
  466. };
  467. export default QUnit.module( 'Renderers', () => {
  468. QUnit.module( 'WebGLRenderer', ( hooks ) => {
  469. // You can invoke the hooks methods more than once.
  470. hooks.beforeEach( function () {
  471. global.__old__document__ = global.document;
  472. global.document = new customDocument();
  473. } );
  474. hooks.afterEach( function () {
  475. global.document = global.__old__document__;
  476. global.__old__document__ = undefined;
  477. } );
  478. // INSTANCING
  479. QUnit.test( "Instancing", ( assert ) => {
  480. var webGLRenderer = new WebGLRenderer();
  481. assert.ok( webGLRenderer, "webGLRenderer instanciated" );
  482. assert.ok( webGLRenderer.domElement instanceof customCanvas, "webGLRenderer instanciated" );
  483. assert.ok( webGLRenderer.context instanceof customWebGLContext, "webGLRenderer instanciated" );
  484. var canvas = new customCanvas();
  485. webGLRenderer = new WebGLRenderer( { canvas: canvas } );
  486. assert.ok( webGLRenderer, "webGLRenderer instanciated" );
  487. assert.ok( webGLRenderer.domElement === canvas, "webGLRenderer instanciated" );
  488. assert.ok( webGLRenderer.context instanceof customWebGLContext, "webGLRenderer instanciated" );
  489. var context = new customWebGLContext();
  490. webGLRenderer = new WebGLRenderer( { canvas: canvas, context: context } );
  491. assert.ok( webGLRenderer, "webGLRenderer instanciated" );
  492. assert.ok( webGLRenderer.domElement === canvas, "webGLRenderer instanciated" );
  493. assert.ok( webGLRenderer.context === context, "webGLRenderer instanciated" );
  494. } );
  495. // PUBLIC STUFF
  496. QUnit.todo( "PrayForUs", ( assert ) => {
  497. assert.ok( false, "everything's gonna be alright" );
  498. } );
  499. } );
  500. } );