Merge branch 'feat/developer/7394-verify-normalization-epic-ldml' into feat/developer/10649-local-imports

This commit is contained in:
Steven R. Loomis 2024-12-04 13:52:32 -06:00 • committed by GitHub
commit dcc4c2b570
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 5832 additions and 59 deletions

View file

@ -1,5 +1,21 @@
# Keyman Version History
## 18.0.152 alpha 2024-12-04
* refactor(mac): pass kmx data blob to keyman core instead of file path (#12760)
* fix(developer): honour provided script when checking for matching scripts (#12768)
* chore(common): rename test files (#12709)
* fix(common): rename test file (#12770)
## 18.0.151 alpha 2024-12-03
* feat(android): Enhance how ENTER key is handled for FV and KMSample2 (#12745)
* feat(developer): report on mismatching lang tag scripts when building keyboard-info (#12753)
## 18.0.150 alpha 2024-12-02
* fix(core,developer): use `NDEBUG` flag to disable assertions in release build (#12715)
## 18.0.149 alpha 2024-12-01
* refactor(developer): unify test action (#12736)

View file

@ -1 +1 @@
18.0.150
18.0.153

View file

@ -130,6 +130,11 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
super.onStartInput(attribute, restarting);
KMManager.onStartInput(attribute, restarting);
KMManager.resetContext(KeyboardType.KEYBOARD_TYPE_SYSTEM);
// Determine special handling for ENTER key
int inputType = attribute.inputType;
KMManager.setEnterMode(attribute.imeOptions, inputType);
// User switched to a new input field so we should extract the text from input field
// and pass it to Keyman Engine together with selection range
InputConnection ic = getCurrentInputConnection();

View file

@ -1,13 +1,13 @@
module.exports = {
parserOptions: {
project: ["./tsconfig.json", "./test/tsconfig.json"],
project: ["./tsconfig.json", "./tests/tsconfig.json"],
},
ignorePatterns: [
".*/*",
"build/*",
"coverage/*",
"node_modules/*",
"test/fixtures/*",
"tests/fixtures/*",
"tools/*",
"src/schemas/*"
],

View file

@ -88,7 +88,7 @@ function do_test() {
fi
eslint .
tsc --build test
tsc --build tests
readonly C8_THRESHOLD=60

View file

@ -23,7 +23,7 @@
"build": "tsc -b",
"build:schema": "ajv compile",
"lint": "eslint .",
"test": "npm run lint && cd test && tsc -b && cd .. && c8 --skip-full --reporter=lcov --reporter=text mocha"
"test": "npm run lint && cd tests && tsc -b && cd .. && c8 --skip-full --reporter=lcov --reporter=text mocha"
},
"author": "Marc Durdin <marc@keyman.com> (https://github.com/mcdurdin)",
"license": "MIT",
@ -48,7 +48,7 @@
"typescript": "^5.4.5"
},
"mocha": {
"spec": "build/test/**/test-*.js",
"spec": "build/tests/**/*.tests.js",
"require": [
"source-map-support/register"
]
@ -76,7 +76,7 @@
"src/keyman-touch-layout/keyman-touch-layout-file-writer.ts",
"src/osk/osk.ts",
"src/schemas/*",
"test/"
"tests/"
]
},
"sideEffects": false

View file

@ -9,5 +9,5 @@ import { fileURLToPath } from "url";
* @param components One or more path components.
*/
export function makePathToFixture(...components: string[]): string {
return fileURLToPath(new URL(path.join('..', '..', '..', 'test', 'fixtures', ...components), import.meta.url));
return fileURLToPath(new URL(path.join('..', '..', '..', 'tests', 'fixtures', ...components), import.meta.url));
}

View file

@ -2,7 +2,7 @@ import * as fs from 'fs';
import 'mocha';
import { makePathToFixture } from '../helpers/index.js';
import KvkFileReader from "../../src/kvk/kvk-file-reader.js";
import { verify_balochi_inpage, verify_khmer_angkor } from './test-kvk-utils.js';
import { verify_balochi_inpage, verify_khmer_angkor } from './kvk-utils.tests.js';
describe('kvk-file-reader', function () {
it('kvk-file-reader should read a valid file', function() {

View file

@ -1,8 +1,8 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*
*
* Created by Dr Mark C. Sinclair on 2024-11-29
*
*
* Test code for unicodeset-parser-api.ts
*/

View file

@ -4,13 +4,12 @@
"compilerOptions": {
"rootDir": ".",
"rootDirs": ["./", "../src/"],
"outDir": "../build/test",
"outDir": "../build/tests",
"baseUrl": ".",
"strictNullChecks": false, // TODO: get rid of this as some point
"allowSyntheticDefaultImports": true
},
"include": [
"**/test-*.ts",
"**/*.tests.ts",
"./helpers/*.ts",
],

View file

@ -2,7 +2,7 @@ import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m
const Namespace = CompilerErrorNamespace.KeyboardInfoCompiler;
// const SevInfo = CompilerErrorSeverity.Info | Namespace;
// const SevHint = CompilerErrorSeverity.Hint | Namespace;
const SevHint = CompilerErrorSeverity.Hint | Namespace;
// const SevWarn = CompilerErrorSeverity.Warn | Namespace;
const SevError = CompilerErrorSeverity.Error | Namespace;
const SevFatal = CompilerErrorSeverity.Fatal | Namespace;
@ -61,5 +61,10 @@ export class KeyboardInfoCompilerMessages {
static Error_DescriptionIsMissing = (o:{filename:string}) => m(
this.ERROR_DescriptionIsMissing,
`The Info.Description field in the package ${def(o.filename)} is required, but is missing or empty.`);
static HINT_ScriptDoesNotMatch = SevHint | 0x0011;
static Hint_ScriptDoesNotMatch = (o:{script: string, bcp47:string, commonScript: string}) => m(
this.HINT_ScriptDoesNotMatch,
`The script '${def(o.script)}' associated with language tag '${def(o.bcp47)}' does not match the script '${def(o.commonScript)}' for the first language in the package.`);
}

View file

@ -502,6 +502,8 @@ export class KeyboardInfoCompiler implements KeymanCompiler {
const fontSource = [].concat(...kmpJsonData.keyboards.map(e => e.displayFont ? [e.displayFont] : []), ...kmpJsonData.keyboards.map(e => e.webDisplayFonts ?? []));
const oskFontSource = [].concat(...kmpJsonData.keyboards.map(e => e.oskFont ? [e.oskFont] : []), ...kmpJsonData.keyboards.map(e => e.webOskFonts ?? []));
let commonScript = null;
for(const bcp47 of Object.keys(keyboard_info.languages)) {
const language = keyboard_info.languages[bcp47];
@ -572,6 +574,15 @@ export class KeyboardInfoCompiler implements KeymanCompiler {
` (${language.regionName})` :
''
);
const resolvedScript = locale.script ?? langtagsByTag[bcp47]?.script ?? langtagsByTag[locale.language]?.script ?? undefined;
if(commonScript === null) {
commonScript = resolvedScript;
} else {
if(resolvedScript !== commonScript) {
this.callbacks.reportMessage(KeyboardInfoCompilerMessages.Hint_ScriptDoesNotMatch({commonScript, bcp47, script: resolvedScript}))
}
}
}
return true;
}

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-2022 SIL International
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1 @@
khmer_angkor.js -text

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="utf-8"?>
<KeymanDeveloperProject>
<Options>
<BuildPath>$PROJECTPATH\build</BuildPath>
<CompilerWarningsAsErrors>True</CompilerWarningsAsErrors>
<WarnDeprecatedCode>True</WarnDeprecatedCode>
<CheckFilenameConventions>False</CheckFilenameConventions>
<ProjectType>keyboard</ProjectType>
</Options>
<Files>
<File>
<ID>id_f347675c33d2e6b1c705c787fad4941a</ID>
<Filename>khmer_angkor.kmn</Filename>
<Filepath>source\khmer_angkor.kmn</Filepath>
<FileVersion>1.3</FileVersion>
<FileType>.kmn</FileType>
<Details>
<Name>Khmer Angkor</Name>
<Copyright>© 2015-2022 SIL International</Copyright>
<Message>More than just a Khmer Unicode keyboard.</Message>
</Details>
</File>
<File>
<ID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ID>
<Filename>khmer_angkor.kps</Filename>
<Filepath>source\khmer_angkor.kps</Filepath>
<FileVersion></FileVersion>
<FileType>.kps</FileType>
<Details>
<Name>Khmer Angkor</Name>
<Copyright>© 2015-2022 SIL International</Copyright>
</Details>
</File>
<File>
<ID>id_8a1efc7c4ab7cfece8aedd847679ca27</ID>
<Filename>khmer_angkor.ico</Filename>
<Filepath>source\khmer_angkor.ico</Filepath>
<FileVersion></FileVersion>
<FileType>.ico</FileType>
<ParentFileID>id_f347675c33d2e6b1c705c787fad4941a</ParentFileID>
</File>
<File>
<ID>id_8dc195db32d1fd0514de0ad51fff5df0</ID>
<Filename>khmer_angkor.js</Filename>
<Filepath>source\..\build\khmer_angkor.js</Filepath>
<FileVersion></FileVersion>
<FileType>.js</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_10596632fcbf4138d24bcccf53e6ae01</ID>
<Filename>khmer_angkor.kvk</Filename>
<Filepath>source\..\build\khmer_angkor.kvk</Filepath>
<FileVersion></FileVersion>
<FileType>.kvk</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_0a851f95ce553ecd62cbee6c32ced68f</ID>
<Filename>khmer_angkor.kmx</Filename>
<Filepath>source\..\build\khmer_angkor.kmx</Filepath>
<FileVersion></FileVersion>
<FileType>.kmx</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_d8b6eb05f4b7e2945c10e04c1f49e4c8</ID>
<Filename>keyboard_layout.png</Filename>
<Filepath>source\welcome\keyboard_layout.png</Filepath>
<FileVersion></FileVersion>
<FileType>.png</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_724e5b4c63f10bc0abf7077f7c3172fc</ID>
<Filename>welcome.htm</Filename>
<Filepath>source\welcome\welcome.htm</Filepath>
<FileVersion></FileVersion>
<FileType>.htm</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_35857cb2b54f123612735ec948400082</ID>
<Filename>FONTLOG.txt</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\FONTLOG.txt</Filepath>
<FileVersion></FileVersion>
<FileType>.txt</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_7e3afe5bb59b888b08b48cd5817d8de4</ID>
<Filename>Mondulkiri-B.ttf</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\Mondulkiri-B.ttf</Filepath>
<FileVersion></FileVersion>
<FileType>.ttf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_b9734e80f86c69ea5ae4dfa9f0083d09</ID>
<Filename>Mondulkiri-BI.ttf</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\Mondulkiri-BI.ttf</Filepath>
<FileVersion></FileVersion>
<FileType>.ttf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_25abe4d2b0abc03a5be5b666a8de776e</ID>
<Filename>Mondulkiri-I.ttf</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\Mondulkiri-I.ttf</Filepath>
<FileVersion></FileVersion>
<FileType>.ttf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_b766568498108eee46ed1601ff69c47d</ID>
<Filename>Mondulkiri-R.ttf</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\Mondulkiri-R.ttf</Filepath>
<FileVersion></FileVersion>
<FileType>.ttf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_84544d04133cab3dbfc86b91ad1a4e17</ID>
<Filename>OFL.txt</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\OFL.txt</Filepath>
<FileVersion></FileVersion>
<FileType>.txt</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_0c33fbefd1c20f487b1bea2343b3bb2c</ID>
<Filename>OFL-FAQ.txt</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\mondulkiri\OFL-FAQ.txt</Filepath>
<FileVersion></FileVersion>
<FileType>.txt</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_a59d89fca36a310147645fa2604e521b</ID>
<Filename>KAK_Documentation_EN.pdf</Filename>
<Filepath>source\welcome\KAK_Documentation_EN.pdf</Filepath>
<FileVersion></FileVersion>
<FileType>.pdf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_5643c4cd3933b3ada0b4af6579305ec4</ID>
<Filename>KAK_Documentation_KH.pdf</Filename>
<Filepath>source\welcome\KAK_Documentation_KH.pdf</Filepath>
<FileVersion></FileVersion>
<FileType>.pdf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_8da344c4cea6f467013357fe099006f5</ID>
<Filename>readme.htm</Filename>
<Filepath>source\readme.htm</Filepath>
<FileVersion></FileVersion>
<FileType>.htm</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_acb0dd94c60e345d999670e999cbd159</ID>
<Filename>image002.png</Filename>
<Filepath>source\welcome\image002.png</Filepath>
<FileVersion></FileVersion>
<FileType>.png</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_4edf70bc019f05b5ad39a2ea727ad547</ID>
<Filename>khmer_busra_kbd.ttf</Filename>
<Filepath>source\..\..\..\shared\fonts\khmer\busrakbd\khmer_busra_kbd.ttf</Filepath>
<FileVersion></FileVersion>
<FileType>.ttf</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
<File>
<ID>id_bc823844e4399751e1867016801f7327</ID>
<Filename>splash.gif</Filename>
<Filepath>source\splash.gif</Filepath>
<FileVersion></FileVersion>
<FileType>.gif</FileType>
<ParentFileID>id_8d4eb765f80c9f2b0f769cf4e4aaa456</ParentFileID>
</File>
</Files>
</KeymanDeveloperProject>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Package>
<System>
<KeymanDeveloperVersion>15.0.266.0</KeymanDeveloperVersion>
<FileVersion>7.0</FileVersion>
</System>
<Options>
<LicenseFile>..\LICENSE.md</LicenseFile>
<FollowKeyboardVersion/>
</Options>
<Info>
<Name URL="">Khmer Angkor</Name>
<Copyright URL="">© 2015-2022 SIL International</Copyright>
<Author URL="mailto:makara_sok@sil.org">Makara Sok</Author>
<Version URL=""></Version>
<WebSite URL="https://keyman.com/keyboards/khmer_angkor">https://keyman.com/keyboards/khmer_angkor</WebSite>
<Description URL="">Khmer Unicode keyboard layout based on the NiDA keyboard layout. Automatically corrects many common keying errors.</Description>
</Info>
<Files>
<File>
<Name>..\LICENSE.md</Name>
<Description>File LICENSE.md</Description>
<CopyLocation>0</CopyLocation>
<FileType>.md</FileType>
</File>
<File>
<Name>..\build\khmer_angkor.kmx</Name>
<Description>Keyboard Khmer Angkor</Description>
<CopyLocation>0</CopyLocation>
<FileType>.kmx</FileType>
</File>
<File>
<Name>..\build\khmer_angkor.js</Name>
<Description>Keyboard Khmer Angkor</Description>
<CopyLocation>0</CopyLocation>
<FileType>.js</FileType>
</File>
</Files>
<Keyboards>
<Keyboard>
<Name>Khmer Angkor</Name>
<ID>khmer_angkor</ID>
<Version>1.3</Version>
<Languages>
<Language ID="en">English</Language>
<Language ID="de">German</Language>
<Language ID="zhd">Dai Zhuang</Language>
</Languages>
</Keyboard>
</Keyboards>
</Package>

View file

@ -5,15 +5,11 @@ import { TestCompilerCallbacks, verifyCompilerMessagesObject } from '@keymanapp/
import { KmpJsonFile, KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
import { makePathToFixture } from './helpers/index.js';
import { KeyboardInfoCompiler, KeyboardInfoCompilerResult } from '../src/keyboard-info-compiler.js';
import { KeyboardInfoCompiler } from '../src/keyboard-info-compiler.js';
import { KeyboardInfoFile } from '../src/keyboard-info-file.js';
const callbacks = new TestCompilerCallbacks();
beforeEach(function() {
callbacks.clear();
});
const KHMER_ANGKOR_JS = makePathToFixture('khmer_angkor', 'build', 'khmer_angkor.js');
const KHMER_ANGKOR_KPS = makePathToFixture('khmer_angkor', 'source', 'khmer_angkor.kps');
const KHMER_ANGKOR_KMP = makePathToFixture('khmer_angkor', 'build', 'khmer_angkor.kmp');
@ -27,6 +23,17 @@ const KHMER_ANGKOR_SOURCES = {
};
describe('KeyboardInfoCompilerMessages', function () {
this.beforeEach(function() {
callbacks.clear();
});
this.afterEach(function() {
if(this.currentTest?.isFailed()) {
callbacks.printMessages();
}
})
it('should have a valid KeyboardInfoCompilerMessages object', function() {
return verifyCompilerMessagesObject(KeyboardInfoCompilerMessages, CompilerErrorNamespace.KeyboardInfoCompiler);
});
@ -43,13 +50,7 @@ describe('KeyboardInfoCompilerMessages', function () {
const compiler = new KeyboardInfoCompiler();
assert.isTrue(await compiler.init(callbacks, {sources}));
let result: KeyboardInfoCompilerResult = null;
try {
result = await compiler.run(KHMER_ANGKOR_KMP, null);
} catch(e) {
callbacks.printMessages();
throw e;
}
const result = await compiler.run(KHMER_ANGKOR_KMP, null);
assert.isNull(result);
assert.isTrue(callbacks.hasMessage(KeyboardInfoCompilerMessages.ERROR_FileDoesNotExist),
@ -77,13 +78,7 @@ describe('KeyboardInfoCompilerMessages', function () {
assert.isTrue(await compiler.init(callbacks, {sources}));
// stubbing fillLanguages internal function to avoid pulling in font resources in fixture
compiler['fillLanguages'] = async (_kpsFilename: string, _keyboard_info: KeyboardInfoFile, _kmpJsonData: KmpJsonFile.KmpJsonFile): Promise<boolean> => true;
let result: KeyboardInfoCompilerResult = null;
try {
result = await compiler.run(kmpFilename, null);
} catch(e) {
callbacks.printMessages();
throw e;
}
const result = await compiler.run(kmpFilename, null);
assert.isNull(result);
assert.isTrue(callbacks.hasMessage(KeyboardInfoCompilerMessages.ERROR_FileDoesNotExist),
@ -216,13 +211,7 @@ describe('KeyboardInfoCompilerMessages', function () {
const compiler = new KeyboardInfoCompiler();
assert.isTrue(await compiler.init(callbacks, {sources}));
let result: KeyboardInfoCompilerResult = null;
try {
result = await compiler.run(kmpFilename, null);
} catch(e) {
callbacks.printMessages();
throw e;
}
const result = await compiler.run(kmpFilename, null);
assert.isNull(result);
assert.isTrue(callbacks.hasMessage(KeyboardInfoCompilerMessages.ERROR_CannotBuildWithoutKmpFile),
@ -246,13 +235,7 @@ describe('KeyboardInfoCompilerMessages', function () {
const compiler = new KeyboardInfoCompiler();
assert.isTrue(await compiler.init(callbacks, {sources}));
let result: KeyboardInfoCompilerResult = null;
try {
result = await compiler.run(kmpFilename, null);
} catch(e) {
callbacks.printMessages();
throw e;
}
const result = await compiler.run(kmpFilename, null);
assert.isNull(result);
assert.isTrue(callbacks.hasMessage(KeyboardInfoCompilerMessages.ERROR_NoLicenseFound),
@ -305,19 +288,35 @@ describe('KeyboardInfoCompilerMessages', function () {
const compiler = new KeyboardInfoCompiler();
assert.isTrue(await compiler.init(callbacks, {sources}));
let result: KeyboardInfoCompilerResult = null;
try {
result = await compiler.run(kmpFilename, null);
} catch(e) {
callbacks.printMessages();
throw e;
}
const result = await compiler.run(kmpFilename, null);
assert.isNull(result);
assert.isTrue(callbacks.hasMessage(KeyboardInfoCompilerMessages.ERROR_InvalidAuthorEmail),
`ERROR_InvalidAuthorEmail not generated, instead got: `+JSON.stringify(callbacks.messages,null,2));
});
// HINT_ScriptDoesNotMatch
it('should generate HINT_ScriptDoesNotMatch if there is a mismatching language script in .kps', async function() {
const jsFilename = makePathToFixture('hint_script_does_not_match', 'build', 'khmer_angkor.js');
const kpsFilename = makePathToFixture('hint_script_does_not_match', 'source', 'khmer_angkor.kps');
const kmpFilename = makePathToFixture('hint_script_does_not_match', 'build', 'khmer_angkor.kmp');
const sources = {
kmpFilename,
sourcePath: 'release/h/hint_script_does_not_match',
kpsFilename,
jsFilename: jsFilename,
forPublishing: true,
};
const compiler = new KeyboardInfoCompiler();
assert.isTrue(await compiler.init(callbacks, {sources}));
const result = await compiler.run(kmpFilename, null);
assert.isNotNull(result);
assert.isTrue(callbacks.hasMessage(KeyboardInfoCompilerMessages.HINT_ScriptDoesNotMatch));
});
});
function nodeCompilerMessage(ncb: TestCompilerCallbacks, code: number): string {

View file

@ -110,11 +110,23 @@ const int CORE_ENVIRONMENT_ARRAY_LENGTH = 6;
-(void)loadKeyboardUsingCore:(NSString*) path {
km_core_path_name keyboardPath = [path UTF8String];
km_core_status result = km_core_keyboard_load(keyboardPath, &_coreKeyboard);
NSError* dataError = nil;
NSData *data = [NSData dataWithContentsOfFile:path options:0 error:&dataError];
if (result != KM_CORE_STATUS_OK) {
NSString *message = [NSString stringWithFormat:@"Unexpected Keyman Core result: %u", result];
[NSException raise:@"LoadKeyboardException" format:@"%@", message];
if (dataError != nil) {
os_log_error([KMELogs coreLog], "loadKeyboardUsingCore, path: %{public}@\n dataError: %{public}@", path, dataError);
[NSException raise:@"LoadKeyboardException" format:@"%@", dataError];
} else {
NSUInteger dataLength = data.length;
os_log_info([KMELogs coreLog], "loadKeyboardUsingCore, path: %{public}@\n dataLength: %lu", path, dataLength);
km_core_status result = km_core_keyboard_load_from_blob(keyboardPath,
data.bytes, dataLength, &_coreKeyboard);
if (result != KM_CORE_STATUS_OK) {
NSString *message = [NSString stringWithFormat:@"Unexpected Keyman Core result: %u", result];
os_log_error([KMELogs coreLog], "loadKeyboardUsingCore, path: %{public}@\n core result: %{public}@", path, message);
[NSException raise:@"LoadKeyboardException" format:@"%@", message];
}
}
}
@ -126,7 +138,7 @@ const int CORE_ENVIRONMENT_ARRAY_LENGTH = 6;
if (result==KM_CORE_STATUS_OK) {
_keyboardVersion = [self.coreHelper createNSStringFromUnicharString:keyboardAttributes->version_string];
_keyboardId = [self.coreHelper createNSStringFromUnicharString:keyboardAttributes->id];
os_log_debug([KMELogs coreLog], "readKeyboardAttributesUsingCore, keyboardVersion: %{public}@\n, keyboardId: %{public}@\n", _keyboardVersion, _keyboardId);
os_log_debug([KMELogs coreLog], "readKeyboardAttributesUsingCore, keyboardVersion: %{public}@, keyboardId: %{public}@\n", _keyboardVersion, _keyboardId);
} else {
os_log_error([KMELogs coreLog], "km_core_keyboard_get_attrs() failed with result = %u\n", result);
}

View file

@ -150,6 +150,10 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
KMManager.setBannerOptions(mayPredict);
}
}
// Determine special handling for ENTER key
KMManager.setEnterMode(attribute.imeOptions, inputType);
// User switched to a new input field so we should extract the text from input field
// and pass it to Keyman Engine together with selection range
InputConnection ic = getCurrentInputConnection();