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
|
|
7
|
if (!String.prototype.codePointAt) {
|
8
|
(function() {
|
9
|
'use strict';
|
10
|
var codePointAt = function(position) {
|
11
|
if (this == null) {
|
12
|
throw TypeError();
|
13
|
}
|
14
|
var string = String(this);
|
15
|
var size = string.length;
|
16
|
|
17
|
var index = position ? Number(position) : 0;
|
18
|
if (index != index) {
|
19
|
index = 0;
|
20
|
}
|
21
|
|
22
|
if (index < 0 || index >= size) {
|
23
|
return undefined;
|
24
|
}
|
25
|
|
26
|
var first = string.charCodeAt(index);
|
27
|
var second;
|
28
|
if (
|
29
|
first >= 0xD800 && first <= 0xDBFF &&
|
30
|
size > index + 1
|
31
|
) {
|
32
|
second = string.charCodeAt(index + 1);
|
33
|
if (second >= 0xDC00 && second <= 0xDFFF) {
|
34
|
|
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
|
|
52
|
if (!String.fromCodePoint) {
|
53
|
(function() {
|
54
|
var defineProperty = (function() {
|
55
|
|
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) ||
|
80
|
codePoint < 0 ||
|
81
|
codePoint > 0x10FFFF ||
|
82
|
floor(codePoint) != codePoint
|
83
|
) {
|
84
|
throw RangeError('Invalid code point: ' + codePoint);
|
85
|
}
|
86
|
if (codePoint <= 0xFFFF) {
|
87
|
codeUnits.push(codePoint);
|
88
|
} else {
|
89
|
|
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>
|