-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(developer): support
store(&version) '17.0'
Fixes #9541. Also adds version 16.0 support to the kmcmplib compiler constants, and unit tests for both versions. Does not add any support for automatic version feature detection, because that forces an inverted dependency on the touch layout compilation phase (done in kmc-kmw), which would be a significant refactor. This may be something we need to support in the future.
- Loading branch information
Showing
9 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
c Description: Verifies that kmcmplib can compile a v16.0 keyboard | ||
|
||
store(&NAME) 'version_160' | ||
store(&VERSION) '16.0' | ||
|
||
begin unicode > use(main) | ||
|
||
group(main) using keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
c Description: Verifies that kmcmplib can compile a v17.0 keyboard | ||
|
||
store(&NAME) 'version_170' | ||
store(&VERSION) '17.0' | ||
|
||
begin unicode > use(main) | ||
|
||
group(main) using keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import 'mocha'; | ||
import { assert } from 'chai'; | ||
import { KmnCompiler } from '../src/main.js'; | ||
import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers'; | ||
import { makePathToFixture } from './helpers/index.js'; | ||
import { KMX, KmxFileReader } from '@keymanapp/common-types'; | ||
|
||
describe('Keyboard compiler features', async function() { | ||
let compiler: KmnCompiler = null; | ||
let callbacks: TestCompilerCallbacks = null; | ||
|
||
this.beforeAll(async function() { | ||
compiler = new KmnCompiler(); | ||
callbacks = new TestCompilerCallbacks(); | ||
assert(await compiler.init(callbacks)); | ||
assert(compiler.verifyInitialized()); | ||
}); | ||
|
||
beforeEach(function() { | ||
callbacks.clear(); | ||
}); | ||
|
||
// Test each Keyman file version target | ||
|
||
const versions = [ | ||
// TODO(lowpri): we should add a test for each version + also test automatic feature detection | ||
['16.0', '160', KMX.KMXFile.VERSION_160], | ||
['17.0', '170', KMX.KMXFile.VERSION_170], | ||
]; | ||
|
||
for(const v of versions) { | ||
it(`should build a version ${v[0]} keyboard`, function() { | ||
const fixtureName = makePathToFixture('features', `version_${v[1]}.kmn`); | ||
|
||
const result = compiler.runCompiler(fixtureName, `version_${v[1]}.kmx`, {saveDebug: true}); | ||
if(result === null) callbacks.printMessages(); | ||
assert.isNotNull(result); | ||
|
||
const reader = new KmxFileReader(); | ||
const keyboard = reader.read(result.kmx.data); | ||
assert.equal(keyboard.fileVersion, v[2]); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters