iterami/Docs.htm/Tests/common/webgl.js
FunctionArgsExpectedResultTest
webgl_character_init()
{
  "id": "test-character-1",
  "level": 5
}
function(result){
    return webgl_characters['test-character-1']['life'] > 0;
}
undefined
true
webgl_character_level()
undefined
-1
-1
true
webgl_character_level()
"fake-character"
-3
-3
true
webgl_character_level()
{
  "camera-rotate-x": 0,
  "camera-rotate-y": 0,
  "camera-rotate-z": 0,
  "camera-x": 0,
  "camera-y": 0,
  "camera-z": 0,
  "change-position-x": 0,
  "change-position-y": 0,
  "change-position-z": 0,
  "change-rotate-x": 0,
  "change-rotate-y": 0,
  "change-rotate-z": 0,
  "camera-zoom": 0,
  "jump-allow": false,
  "keys": false,
  "life": 1,
  "pointer": false,
  "position-x": 23,
  "position-y": 0,
  "position-z": 0,
  "rotate-x": 0,
  "rotate-y": 0,
  "rotate-z": 0,
  "vehicle": false,
  "vehicle-stats": false,
  "id": "test-character-0",
  "level": 1,
  "spawn": {
    "position-x": 23
  },
  "automove": false,
  "camera-lock": true,
  "collide-bottom": 3,
  "collide-top": 3,
  "collide-xz": 2,
  "collides": false,
  "controls": "",
  "gravity": 0,
  "jump-height": 1,
  "level-xp": 0,
  "life-max": 1,
  "lives": -1,
  "lock": {},
  "path-direction": 1,
  "path-end": "",
  "path-id": "",
  "path-point": 0,
  "reticle": "#fff",
  "scale-x": 1,
  "scale-y": 1,
  "scale-z": 1,
  "speed": 1,
  "turn-speed": 5
}
1
1
true
webgl_color_set()
{
  "blue": 0.3,
  "green": 0.2,
  "red": 0.1
}
function(result){
    const clearcolor = webgl.getParameter(webgl.COLOR_CLEAR_VALUE);
    return webgl_properties['clear-color'][0] === .1
      && webgl_properties['clear-color'][1] === .2
      && webgl_properties['clear-color'][2] === .3
      && core_float_compare({
        'a': clearcolor[0],
        'b': .1,
        'precision': .001,
      })
      && core_float_compare({
        'a': clearcolor[1],
        'b': .2,
        'precision': .001,
      })
      && core_float_compare({
        'a': clearcolor[2],
        'b': .3,
        'precision': .001,
      });
}
undefined
true
webgl_cursor()
"help"
function(result){
    return webgl.canvas.style.cursor === 'help';
}
undefined
true
webgl_get_position()
{
  "camera-rotate-x": 0,
  "camera-rotate-y": 0,
  "camera-rotate-z": 0,
  "camera-x": 0,
  "camera-y": 0,
  "camera-z": 0,
  "change-position-x": 0,
  "change-position-y": 0,
  "change-position-z": 0,
  "change-rotate-x": 0,
  "change-rotate-y": 0,
  "change-rotate-z": 0,
  "camera-zoom": 0,
  "jump-allow": false,
  "keys": false,
  "life": 1,
  "pointer": false,
  "position-x": 23,
  "position-y": 0,
  "position-z": 0,
  "rotate-x": 0,
  "rotate-y": 0,
  "rotate-z": 0,
  "vehicle": false,
  "vehicle-stats": false,
  "id": "test-character-0",
  "level": 1,
  "spawn": {
    "position-x": 23
  },
  "automove": false,
  "camera-lock": true,
  "collide-bottom": 3,
  "collide-top": 3,
  "collide-xz": 2,
  "collides": false,
  "controls": "",
  "gravity": 0,
  "jump-height": 1,
  "level-xp": 0,
  "life-max": 1,
  "lives": -1,
  "lock": {},
  "path-direction": 1,
  "path-end": "",
  "path-id": "",
  "path-point": 0,
  "reticle": "#fff",
  "scale-x": 1,
  "scale-y": 1,
  "scale-z": 1,
  "speed": 1,
  "turn-speed": 5
}
function(result){
    return result['x'] === 23;
}
{
  "x": 23,
  "y": 0,
  "z": 0
}
true
webgl_move_to()
{
  "move": {
    "camera-rotate-x": 0,
    "camera-rotate-y": 0,
    "camera-rotate-z": 0,
    "camera-x": 0,
    "camera-y": 0,
    "camera-z": 0,
    "change-position-x": 0,
    "change-position-y": 0,
    "change-position-z": 0,
    "change-rotate-x": 0,
    "change-rotate-y": 0,
    "change-rotate-z": 0,
    "camera-zoom": 0,
    "jump-allow": false,
    "keys": false,
    "life": 1,
    "pointer": false,
    "position-x": 23,
    "position-y": 0,
    "position-z": 0,
    "rotate-x": 0,
    "rotate-y": 0,
    "rotate-z": 0,
    "vehicle": false,
    "vehicle-stats": false,
    "id": "test-character-0",
    "level": 1,
    "spawn": {
      "position-x": 23
    },
    "automove": false,
    "camera-lock": true,
    "collide-bottom": 3,
    "collide-top": 3,
    "collide-xz": 2,
    "collides": false,
    "controls": "",
    "gravity": 0,
    "jump-height": 1,
    "level-xp": 0,
    "life-max": 1,
    "lives": -1,
    "lock": {},
    "path-direction": 1,
    "path-end": "",
    "path-id": "",
    "path-point": 0,
    "reticle": "#fff",
    "scale-x": 1,
    "scale-y": 1,
    "scale-z": 1,
    "speed": 1,
    "turn-speed": 5
  },
  "y": 23
}
function(result){
    return webgl_characters['test-character-0']['position-y'] === 23;
}
undefined
true
webgl_normals()
{
  "rotate-x": 0,
  "rotate-y": 0,
  "rotate-z": 0,
  "vertices-length": 1
}
[
  0,
  1,
  0
]
[
  0,
  1,
  0
]
true
webgl_pick_color()
{
  "x": 0,
  "y": 0
}
[
  0,
  0,
  0,
  0
]
{
  "0": 0,
  "1": 0,
  "2": 0,
  "3": 0
}
true
webgl_stat_modify()
{
  "stat": "level",
  "target": {
    "camera-rotate-x": 0,
    "camera-rotate-y": 0,
    "camera-rotate-z": 0,
    "camera-x": 0,
    "camera-y": 0,
    "camera-z": 0,
    "change-position-x": 0,
    "change-position-y": 0,
    "change-position-z": 0,
    "change-rotate-x": 0,
    "change-rotate-y": 0,
    "change-rotate-z": 0,
    "camera-zoom": 0,
    "jump-allow": false,
    "keys": false,
    "life": 1,
    "pointer": false,
    "position-x": 0,
    "position-y": 23,
    "position-z": 0,
    "rotate-x": 0,
    "rotate-y": 0,
    "rotate-z": 0,
    "vehicle": false,
    "vehicle-stats": false,
    "id": "test-character-0",
    "level": 1,
    "spawn": {
      "position-x": 23
    },
    "automove": false,
    "camera-lock": true,
    "collide-bottom": 3,
    "collide-top": 3,
    "collide-xz": 2,
    "collides": false,
    "controls": "",
    "gravity": 0,
    "jump-height": 1,
    "level-xp": 0,
    "life-max": 1,
    "lives": -1,
    "lock": {},
    "path-direction": 1,
    "path-end": "",
    "path-id": "",
    "path-point": 0,
    "reticle": "#fff",
    "scale-x": 1,
    "scale-y": 1,
    "scale-z": 1,
    "speed": 1,
    "turn-speed": 5
  }
}
function(result){
    return webgl_characters['test-character-0']['level'] === -1;
}
undefined
false
webgl_vertexcolorarray()
{
  "colors": [
    0,
    1,
    0,
    1
  ],
  "vertexcount": 2
}
[
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1
]
[
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1
]
true