fix(developer): tighten touch layout file structural validity checks - #16347
Conversation
User Test ResultsTest specification and instructions User tests are not required |
| // Transform the layout keys with displayMap | ||
| if(displayMap) { | ||
| Osk.remapTouchLayout(data, displayMap); | ||
| } | ||
|
|
||
| // If not debugging, then this strips out formatting for a big saving in file size | ||
| // This also normalises any values such as Pad or Width which should be strings | ||
| const writer = new TouchLayoutFileWriter({formatted: FDebug}); | ||
|
|
||
| sLayoutFile = writer.compile(data); | ||
|
|
||
| sLayoutFile = TransformSpecialKeys14(FDebug, sLayoutFile); | ||
|
|
||
| sLayoutFile = TransformSpecialKeys17(FDebug, sLayoutFile); | ||
|
|
||
| return { | ||
| output: sLayoutFile, | ||
| result | ||
| } |
There was a problem hiding this comment.
No changes to this code, just factored the validation out of this function to simplify test.
Fixes: #16214 Fixes: KEYMAN-DEVELOPER-39Q Test-bot: skip
e56351a to
cd674fd
Compare
There was a problem hiding this comment.
This might be worth a function comment since the name is fairly similar to validateLayoutFileContent.
| if(typeof(key.flick) != "object") { | ||
| callbacks.reportMessage(KmwCompilerMessages.Error_InvalidTouchLayoutFileFormat({msg: 'platform.layer must be an array'})); |
There was a problem hiding this comment.
Hmm, the check is different, but the message is still the same as above?
| assert.isNull(unitTestEndpoints.validateLayoutFileContent(fixture.data, [])); | ||
| assert.isTrue(callbacks.hasMessage(KmwCompilerMessages.ERROR_InvalidTouchLayoutFileFormat)); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
For completeness we might want to add happy path tests as well. But that might be too complicated to setup, probably tested elsewhere and not worth doing here.
There was a problem hiding this comment.
Yeah, happy path tests are mostly covered I think in existing unit tests.
Rename `ValidateLayoutFile()` to `CompileLayoutFile()` to better reflect the transform steps it performs, add documentation, and address review comments. Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
|
Changes in this pull request will be available for download in Keyman version 19.0.271-alpha |
Fixes: #16214
Fixes: KEYMAN-DEVELOPER-39Q
Test-bot: skip