mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-13 11:07:42 +00:00
change(web): more recorder spec renaming
This commit is contained in:
parent
bdd41ec696
commit
b8aabfdbb4
6 changed files with 25 additions and 25 deletions
|
|
@ -98,7 +98,7 @@ namespace KMWRecorder {
|
|||
|
||||
// Execution of a test sequence depends on the testing environment; integrated
|
||||
// testing requires browser-specific code.
|
||||
simulateSequence(sequence: InputTestSequence): string {
|
||||
simulateSequence(sequence: InputEventSpecSequence): string {
|
||||
let ele = this.target;
|
||||
|
||||
for(var i=0; i < sequence.inputs.length; i++) {
|
||||
|
|
|
|||
|
|
@ -56,13 +56,13 @@ namespace KMWRecorder {
|
|||
|
||||
// We only need to filter test cases when performing tests in an integrated
|
||||
// environment.
|
||||
matchesTestSet(testSet: InputTestSet) {
|
||||
matchesTestSet(testSet: EventSpecTestSet) {
|
||||
return testSet.isValidForDevice(this.device, this.usingOSK);
|
||||
}
|
||||
|
||||
// Execution of a test sequence depends on the testing environment; this handles
|
||||
// the browser-specific aspects.
|
||||
simulateSequence(sequence: InputTestSequence): string {
|
||||
simulateSequence(sequence: InputEventSpecSequence): string {
|
||||
let driver = new BrowserDriver(this.target);
|
||||
|
||||
// Yes, it's pretty simple for now... but this is only one of two code paths
|
||||
|
|
|
|||
|
|
@ -84,12 +84,12 @@ namespace KMWRecorder {
|
|||
}
|
||||
}
|
||||
|
||||
export class InputTestSequence {
|
||||
export class InputEventSpecSequence {
|
||||
inputs: InputEventSpec[];
|
||||
output: string;
|
||||
msg?: string;
|
||||
|
||||
constructor(ins?: InputEventSpec[] | InputTestSequence, outs?: string, msg?: string) {
|
||||
constructor(ins?: InputEventSpec[] | InputEventSpecSequence, outs?: string, msg?: string) {
|
||||
if(ins) {
|
||||
if(ins instanceof Array) {
|
||||
this.inputs = [].concat(ins);
|
||||
|
|
@ -322,41 +322,41 @@ namespace KMWRecorder {
|
|||
|
||||
export class TestFailure {
|
||||
constraint: Constraint;
|
||||
test: InputTestSequence;
|
||||
test: InputEventSpecSequence;
|
||||
result: string;
|
||||
|
||||
constructor(constraint: Constraint, test: InputTestSequence, output: string) {
|
||||
constructor(constraint: Constraint, test: InputEventSpecSequence, output: string) {
|
||||
this.constraint = constraint;
|
||||
this.test = test;
|
||||
this.result = output;
|
||||
}
|
||||
}
|
||||
|
||||
export class InputTestSet {
|
||||
export class EventSpecTestSet {
|
||||
constraint: Constraint;
|
||||
testSet: InputTestSequence[];
|
||||
testSet: InputEventSpecSequence[];
|
||||
|
||||
constructor(constraint: Constraint|InputTestSet) {
|
||||
constructor(constraint: Constraint|EventSpecTestSet) {
|
||||
if("target" in constraint) {
|
||||
this.constraint = constraint as Constraint;
|
||||
this.testSet = [];
|
||||
} else {
|
||||
var json = constraint as InputTestSet;
|
||||
var json = constraint as EventSpecTestSet;
|
||||
this.constraint = new Constraint(json.constraint);
|
||||
this.testSet = [];
|
||||
|
||||
// Clone each test sequence / reconstruct from methodless JSON object.
|
||||
for(var i=0; i < json.testSet.length; i++) {
|
||||
this.testSet.push(new InputTestSequence(json.testSet[i]));
|
||||
this.testSet.push(new InputEventSpecSequence(json.testSet[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addTest(seq: InputTestSequence) {
|
||||
addTest(seq: InputEventSpecSequence) {
|
||||
this.testSet.push(seq);
|
||||
}
|
||||
|
||||
// Used to determine if the current InputTestSet is applicable to be run on a device.
|
||||
// Used to determine if the current EventSpecTestSet is applicable to be run on a device.
|
||||
isValidForDevice(device: com.keyman.text.EngineDeviceSpec, usingOSK?: boolean) {
|
||||
return this.constraint.matchesClient(device, usingOSK);
|
||||
}
|
||||
|
|
@ -389,7 +389,7 @@ namespace KMWRecorder {
|
|||
* The master array of test sets, each of which specifies constraints a client must fulfill for
|
||||
* the tests contained therein to be valid.
|
||||
*/
|
||||
inputTestSets: InputTestSet[];
|
||||
inputTestSets: EventSpecTestSet[];
|
||||
|
||||
/**
|
||||
* Reconstructs a KeyboardTest object from its JSON representation, restoring its methods.
|
||||
|
|
@ -414,11 +414,11 @@ namespace KMWRecorder {
|
|||
this.inputTestSets = [];
|
||||
|
||||
for(var i=0; i < fromJSON.inputTestSets.length; i++) {
|
||||
this.inputTestSets[i] = new InputTestSet(fromJSON.inputTestSets[i]);
|
||||
this.inputTestSets[i] = new EventSpecTestSet(fromJSON.inputTestSets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
addTest(constraint: Constraint, seq: InputTestSequence) {
|
||||
addTest(constraint: Constraint, seq: InputEventSpecSequence) {
|
||||
for(var i=0; i < this.inputTestSets.length; i++) {
|
||||
if(this.inputTestSets[i].constraint.equals(constraint)) {
|
||||
this.inputTestSets[i].addTest(seq);
|
||||
|
|
@ -426,7 +426,7 @@ namespace KMWRecorder {
|
|||
}
|
||||
}
|
||||
|
||||
var newSet = new InputTestSet(new Constraint(constraint));
|
||||
var newSet = new EventSpecTestSet(new Constraint(constraint));
|
||||
this.inputTestSets.push(newSet);
|
||||
newSet.addTest(seq);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ function saveInputRecord() {
|
|||
}
|
||||
|
||||
reviseInputRecord = function() {
|
||||
recorderScribe.currentSequence = new KMWRecorder.InputTestSequence(JSON.parse(ta_inputJSON.value));
|
||||
recorderScribe.currentSequence = new KMWRecorder.InputEventSpecSequence(JSON.parse(ta_inputJSON.value));
|
||||
}
|
||||
|
||||
onTestDefinitionChanged = function(testDefJSON) {
|
||||
|
|
|
|||
|
|
@ -98,16 +98,16 @@ namespace KMWRecorder {
|
|||
//#endregion
|
||||
|
||||
_currentEvent: InputEventSpec;
|
||||
_currentSequence: InputTestSequence = new InputTestSequence();
|
||||
_currentSequence: InputEventSpecSequence = new InputEventSpecSequence();
|
||||
_testDefinition: KeyboardTest = new KeyboardTest();
|
||||
|
||||
keyboardJustActivated: boolean = false;
|
||||
|
||||
get currentSequence(): InputTestSequence {
|
||||
get currentSequence(): InputEventSpecSequence {
|
||||
return this._currentSequence;
|
||||
}
|
||||
|
||||
set currentSequence(value: InputTestSequence) {
|
||||
set currentSequence(value: InputEventSpecSequence) {
|
||||
this._currentSequence = value;
|
||||
this.raiseRecordChanged();
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ namespace KMWRecorder {
|
|||
|
||||
resetInputRecord() {
|
||||
window['keyman'].resetContext();
|
||||
this.currentSequence = new KMWRecorder.InputTestSequence();
|
||||
this.currentSequence = new KMWRecorder.InputEventSpecSequence();
|
||||
|
||||
this.emit('record-reset', null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function runEngineRuleSet(ruleSet, defaultNoun) {
|
|||
for(var j = 0; j < matchDefs.length; j++) {
|
||||
// Prepare the context!
|
||||
var matchTest = matchDefs[j];
|
||||
var ruleSeq = new KMWRecorder.InputTestSequence(matchTest.sequence);
|
||||
var ruleSeq = new KMWRecorder.InputEventSpecSequence(matchTest.sequence);
|
||||
let proctor = new KMWRecorder.BrowserProctor(inputElem, keyman.util.device.coreSpec, false);
|
||||
ruleSeq.test(proctor);
|
||||
|
||||
|
|
@ -825,7 +825,7 @@ describe('Engine', function() {
|
|||
var ruleDef = FULL_RULE_SET[i];
|
||||
|
||||
// Prepare the context!
|
||||
var ruleSeq = new KMWRecorder.InputTestSequence(ruleDef.baseSequence);
|
||||
var ruleSeq = new KMWRecorder.InputEventSpecSequence(ruleDef.baseSequence);
|
||||
let proctor = new KMWRecorder.BrowserProctor(inputElem, keyman.util.device.coreSpec, false);
|
||||
ruleSeq.test(proctor);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue