spiegel-keyman/web/source/kmwRecorder.html
2018-03-07 12:36:45 +07:00

215 lines
No EOL
8.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- Set the viewport width to match phone and tablet device widths -->
<meta name="viewport" content="width=device-width,user-scalable=no" />
<!-- Allow KeymanWeb to be saved to the iPhone home screen -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- Enable IE9 Standards mode -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>KeymanWeb - Test Input Recorder</title>
<!-- Your page CSS -->
<style type='text/css'>
body {
font-family: Tahoma, helvetica;
}
h3 {
font-size: 1em;
font-weight: normal;
color: darkred;
margin-bottom: 4px
}
.test {
font-size: 1.5em;
width: 80%;
min-height: 30px;
border: 1px solid gray;
}
#KeymanWebControl {
width: 50%;
min-width: 600px;
}
td {
vertical-align:top;
padding:15px;
}
</style>
<script src="../release/unminified/web/keymanweb.js" type="application/javascript"></script>
<script src="../release/unminified/web/kmwuitoggle.js"></script>
<script src="recorder_KeyboardScripts.js" type="application/javascript"></script>
<script src="../release/recorder/recorder_InputEvents.js" type="application/javascript"></script>
<script src="recorder_ui_and_stubs.js" type="application/javascript"></script>
<!-- Initialization: set paths to keyboards, resources and fonts as required -->
<script>
// keyman.init({
// attachType: 'auto',
// });
window.addEventListener("onload", function() {
keyman.init({
attachType: 'auto'
});
document.getElementById("body").focus();
});
</script>
</head>
<!-- Sample page HTML -->
<body id="body" onload='loadKeyboards();'>
<table style="width:100%">
<tr>
<td colspan="2">
<h1>KeymanWeb - Test Input Recorder</h1>
<p>This page is designed to record KeymanWeb input for use in test case development.</p>
</td>
</tr>
</table>
<hr/>
<table width="100%">
<tr>
<td style="width:100%">
<h2>Load Existing JSON</h2>
Please ensure that the keyboard(s) being loaded are stored within ../unit_tests/json/keyboards, if applicable.
<p>
Testing File:
<input type="file" id="existingFile" accept=".json" value="../unit_tests/json/engine_tests/" onchange="loadExistingTest(this.files);" />
</p>
<p>
Keyboard Stubs:
<input type="file" id="existingStubs" accept=".json" value="../unit_tests/json/keyboards/" onchange="loadExistingStubs(this.files);" multiple/>
</p>
</td>
</tr>
</table>
<hr>
<table width="100%">
<tr>
<td style="width:50%">
<h2>Load a Keyboard</h2>
<h3>Add a keyboard by keyboard stub (to addKeyboards):</h3>
<textarea style="width:90%; height:100px" id='kbd_stub_add' class='kmw-disabled' onkeypress="clickOnEnter(event,4);"></textarea><br>
<input type='button' id='btn4' onclick='addKeyboard(4);' style="width:90%" value='Add' />
</td>
<td style="vertical-align: bottom;">
<h3>Add a keyboard by keyboard name:</h3>
<input type='input' id='kbd_id1' class='kmw-disabled' onkeypress="clickOnEnter(event,1);"/>
<input type='button' id='btn1' onclick='addKeyboard(1);' value='Add' />
<h3>Add a keyboard by BCP-47 language code:</h3>
<input type='input' id='kbd_id2' class='kmw-disabled' onkeypress="clickOnEnter(event,2);"/>
<input type='button' id='btn2' onclick='addKeyboard(2);' value='Add' />
<h3>Add a keyboard by language name:</h3>
<input type='input' id='kbd_id3' class='kmw-disabled' onkeypress="clickOnEnter(event,3);"/>
<input type='button' id='btn3' onclick='addKeyboard(3);' value='Add' />
</td>
</tr>
</table>
<hr/>
<table style="width:100%">
<tr>
<td style="width:50%;" >
<h2>Keyboard Selection</h2>
<p>Each defined test set should utilize the same keyboard.</p>
<p>Select a keyboard: <select id='KMW_Keyboard' onchange='KMW_KeyboardChange()'><option value=''>-disabled-</option></select></p>
<p>Please ensure a copy of this keyboard's *.js resides at the specified location within the <code>unit_tests/</code> folder.</p>
</td>
<td style="width:50%;">
<p>Currently active stub (for use with addKeyboards):</p>
<textarea id='activeStub' style="width:80%; height:100px" readonly></textarea>
</td>
</tr>
</table>
<hr/>
<table style="width:100%">
<tr>
<td style="width:50%">
<h2>Constraint Selection</h2>
<p>Active form factor: <span style="font-weight: bold;" id="activeFormFactor"/></p>
<p>Touch availablility: <span style="font-weight: bold;" id="activeTouch"/></p>
<p>Current OS: <span style="font-weight: bold;" id="activeOS"/></p>
<p>Current browser: <span style="font-weight: bold;" id="activeBrowser"/></p>
</td>
<td style="width:50%">
<p style="font-weight: bold;">Valid OS:</p>
<nobr><input type="checkbox" id="platform_any" checked onclick="clearPlatforms();">
<label for="platform_any">Any</label></nobr>
<nobr><input type="checkbox" id="platform_windows" onclick="setPlatformAny();" value="windows">
<label for="platform_windows">Windows</label></nobr>
<nobr><input type="checkbox" id="platform_macosx" onclick="setPlatformAny();" value="macosx">
<label for="platform_macosx">Mac OS X</label></nobr>
<nobr><input type="checkbox" id="platform_linux" onclick="setPlatformAny();" value="linux">
<label for="platform_linux">Linux</label></nobr>
<nobr><input type="checkbox" id="platform_android" onclick="setPlatformAny();" value="android">
<label for="platform_android">Android</label></nobr>
<nobr><input type="checkbox" id="platform_ios" onclick="setPlatformAny();" value="ios">
<label for="platform_ios">iOS</label></nobr>
<p style="font-weight: bold">Valid browser:</p>
<nobr><input type="checkbox" id="browser_any" checked onclick="clearBrowsers();">
<label for="browser_any">Any</label></nobr>
<nobr><input type="checkbox" id="browser_chrome" onclick="setBrowserAny();" value="chrome">
<label for="browser_chrome">Chrome</label></nobr>
<nobr><input type="checkbox" id="browser_firefox" onclick="setBrowserAny();" value="firefox">
<label for="browser_firefox">Firefox</label></nobr>
<nobr><input type="checkbox" id="browser_safari" onclick="setBrowserAny();" value="safari">
<label for="browser_safari">Safari</label></nobr>
<nobr><input type="checkbox" id="browser_ie" onclick="setBrowserAny();" value="ie">
<label for="browser_ie">IE</label></nobr>
<nobr><input type="checkbox" id="browser_opera" onclick="setBrowserAny();" value="opera">
<label for="browser_opera">Opera</label></nobr>
</td>
</tr>
</table>
<hr/>
<table style="width:100%">
<tr>
<td style="width:50%">
<h2>Input Recording</h2>
<p>Error message here:</p>
<input type='text' id='errorText' onchange="errorUpdate();"/>
<p>Record input here:</p>
<input type='text' id='receiver'/>
<p>You must click 'Set Sequence' to save any changes to an input sequence above
before continuing input recording, or they will be lost upon new input.</p>
</td>
<td style="width:50%">
<p>Current test sequence JSON:</p>
<textarea id='inputRecord' style="width:90%; height:180px"></textarea>
<button id='btnSave' type="button" onclick="saveInputRecord();">Save Test Sequence</button>
<button id='btnCopy' type="button" onclick="copyInputRecord();">Copy Sequence</button>
<button id='btnSet' type="button" onclick="reviseInputRecord();">Set Sequence</button>
<button id='btnClear' type="button" onclick="resetInputRecord();">Clear Sequence</button>
<!-- Add 'add to set' button -->
</td>
</tr>
</table>
<hr/>
<table style="width:100%">
<tr>
<td width="100%">
<h2>Test suite JSON:</h2>
<button id='btnClearMaster' type="reset" onclick="setTestDefinition(new KMWRecorder.KeyboardTest(null));">Clear Test Set</button>
<button id='btnCopyTestDef' type="button" onclick="copyTestDefinition();">Copy Test Set</button>
<textarea id="masterJSON" class="kmw-disabled" style="width:100%; height:600px"></textarea>
</td>
</tr>
</table>
</body>
</html>