Project

General

Profile

test.html

Sergey Ivanovskiy, 08/01/2020 03:46 PM

Download (5.38 KB)

 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
<html>
3
<head>
4
<title>JS Key Event Tester for the web client to compare with Progress 4Gl generated codes</title>
5
<script type="text/javascript" >
6
/*! http://mths.be/codepointat v0.1.0 by @mathias */
7
if (!String.prototype.codePointAt) {
8
  (function() {
9
    'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
10
    var codePointAt = function(position) {
11
      if (this == null) {
12
        throw TypeError();
13
      }
14
      var string = String(this);
15
      var size = string.length;
16
      // `ToInteger`
17
      var index = position ? Number(position) : 0;
18
      if (index != index) { // better `isNaN`
19
        index = 0;
20
      }
21
      // Account for out-of-bounds indices:
22
      if (index < 0 || index >= size) {
23
        return undefined;
24
      }
25
      // Get the first code unit
26
      var first = string.charCodeAt(index);
27
      var second;
28
      if ( // check if it’s the start of a surrogate pair
29
        first >= 0xD800 && first <= 0xDBFF && // high surrogate
30
        size > index + 1 // there is a next code unit
31
      ) {
32
        second = string.charCodeAt(index + 1);
33
        if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
34
          // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
35
          return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
36
        }
37
      }
38
      return first;
39
    };
40
    if (Object.defineProperty) {
41
      Object.defineProperty(String.prototype, 'codePointAt', {
42
        'value': codePointAt,
43
        'configurable': true,
44
        'writable': true
45
      });
46
    } else {
47
      String.prototype.codePointAt = codePointAt;
48
    }
49
  }());
50
};
51
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
52
if (!String.fromCodePoint) {
53
  (function() {
54
    var defineProperty = (function() {
55
      // IE 8 only supports `Object.defineProperty` on DOM elements
56
      try {
57
        var object = {};
58
        var $defineProperty = Object.defineProperty;
59
        var result = $defineProperty(object, object, object) && $defineProperty;
60
      } catch(error) {}
61
      return result;
62
    }());
63
    var stringFromCharCode = String.fromCharCode;
64
    var floor = Math.floor;
65
    var fromCodePoint = function() {
66
      var MAX_SIZE = 0x4000;
67
      var codeUnits = [];
68
      var highSurrogate;
69
      var lowSurrogate;
70
      var index = -1;
71
      var length = arguments.length;
72
      if (!length) {
73
        return '';
74
      }
75
      var result = '';
76
      while (++index < length) {
77
        var codePoint = Number(arguments[index]);
78
        if (
79
          !isFinite(codePoint) ||       // `NaN`, `+Infinity`, or `-Infinity`
80
          codePoint < 0 ||              // not a valid Unicode code point
81
          codePoint > 0x10FFFF ||       // not a valid Unicode code point
82
          floor(codePoint) != codePoint // not an integer
83
        ) {
84
          throw RangeError('Invalid code point: ' + codePoint);
85
        }
86
        if (codePoint <= 0xFFFF) { // BMP code point
87
          codeUnits.push(codePoint);
88
        } else { // Astral code point; split in surrogate halves
89
          // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
90
          codePoint -= 0x10000;
91
          highSurrogate = (codePoint >> 10) + 0xD800;
92
          lowSurrogate = (codePoint % 0x400) + 0xDC00;
93
          codeUnits.push(highSurrogate, lowSurrogate);
94
        }
95
        if (index + 1 == length || codeUnits.length > MAX_SIZE) {
96
          result += stringFromCharCode.apply(null, codeUnits);
97
          codeUnits.length = 0;
98
        }
99
      }
100
      return result;
101
    };
102
    if (defineProperty) {
103
      defineProperty(String, 'fromCodePoint', {
104
        'value': fromCodePoint,
105
        'configurable': true,
106
        'writable': true
107
      });
108
    } else {
109
      String.fromCodePoint = fromCodePoint;
110
    }
111
  }());
112
}
113
</script>
114
<script type="text/javascript" src="src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js"></script>
115
<script type="text/javascript" src=keystrokes.js></script>
116
<script type="text/javascript" src="src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js"></script>
117
<script type="text/javascript" src="src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js"></script>
118
<script type="text/javascript" src=keyboard_testcases.js></script>
119
</head>
120
<body>
121
<form name="testform">
122
<div style="display:block;margin:4px;">
123
<input type="button" value="Run CHUI Test" onclick="void(run4GLKeyTest(false));"/>
124
<input type="button" value="Run GUI Test" onclick="void(run4GLKeyTest(true));"/>
125
<input type="button" value="Run GUI ALT + CTRL + . Test" onclick="void(run4GLCTRLKeyTest(true, true, false, false ));"/>
126
<input type="button" value="Run GUI SHIFT + CTRL + . Test" onclick="void(run4GLCTRLKeyTest(true, false, true, false ));"/>
127
<input type="button" value="GUI Manual Testing" onclick="void(testSimulator(true, true, false, false, false ));"/>
128
<input type="button" value="CHUI Manual Testing" onclick="void(testSimulator(false, true, false, false, false ));"/>
129
</div>
130
<label for="testArea">Test area</label>
131
<textarea id="testArea" name="testArea" rows="4" cols="90" style="display:block;margin:4px;"></textarea>
132
<label for="results">Test's results</label>
133
<textarea id="results" name="results" rows="25" cols="90" style="display:block;margin:4px;"></textarea>
134
<label for="errors">Test's errors</label>
135
<textarea id="errors" name="errors" rows="4" cols="90" style="display:block;margin:4px;"></textarea>
136
<br>
137
</form>
138
</body>
139
</html>