From b8aabfdbb45fc709f92d06781249f050ef3b7e87 Mon Sep 17 00:00:00 2001 From: jahorton Date: Tue, 28 Apr 2020 12:30:57 +0700 Subject: [PATCH] change(web): more recorder spec renaming --- web/tools/recorder/browserDriver.ts | 2 +- web/tools/recorder/browserProctor.ts | 4 +-- web/tools/recorder/recorder_InputEvents.ts | 30 ++++++++++----------- web/tools/recorder/recorder_ui_and_stubs.js | 2 +- web/tools/recorder/scribe.ts | 8 +++--- web/unit_tests/cases/engine.js | 4 +-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/web/tools/recorder/browserDriver.ts b/web/tools/recorder/browserDriver.ts index 41dd03af7d..9820cabc0e 100644 --- a/web/tools/recorder/browserDriver.ts +++ b/web/tools/recorder/browserDriver.ts @@ -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++) { diff --git a/web/tools/recorder/browserProctor.ts b/web/tools/recorder/browserProctor.ts index b6ae3a266c..a48f1f1f38 100644 --- a/web/tools/recorder/browserProctor.ts +++ b/web/tools/recorder/browserProctor.ts @@ -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 diff --git a/web/tools/recorder/recorder_InputEvents.ts b/web/tools/recorder/recorder_InputEvents.ts index 8fc9940583..1ba30a6b8a 100644 --- a/web/tools/recorder/recorder_InputEvents.ts +++ b/web/tools/recorder/recorder_InputEvents.ts @@ -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); } diff --git a/web/tools/recorder/recorder_ui_and_stubs.js b/web/tools/recorder/recorder_ui_and_stubs.js index 70aa140887..c61e564e72 100644 --- a/web/tools/recorder/recorder_ui_and_stubs.js +++ b/web/tools/recorder/recorder_ui_and_stubs.js @@ -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) { diff --git a/web/tools/recorder/scribe.ts b/web/tools/recorder/scribe.ts index 19ff2284cd..b1241aa2cf 100644 --- a/web/tools/recorder/scribe.ts +++ b/web/tools/recorder/scribe.ts @@ -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); } diff --git a/web/unit_tests/cases/engine.js b/web/unit_tests/cases/engine.js index 7cefa92966..2f1646bd2c 100644 --- a/web/unit_tests/cases/engine.js +++ b/web/unit_tests/cases/engine.js @@ -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);