feat(developer): dup_5_5, amb_5_5 swap dk and prev_dk output

This commit is contained in:
Sabine 2026-06-26 09:27:48 +02:00
parent 49c07a413f
commit 1fab254022
3 changed files with 13 additions and 13 deletions

View file

@ -536,9 +536,9 @@ export class KmnFileWriter {
const textsegment = (
((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: '
+ (inObj.earlier_later[0] ? "earlier" : "later")
+ ': dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") + ["
+ ': dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] + ") + ["
+ inObj.Dk_modifier + " " + inObj.Dk_key + "] > "
+ 'dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] + ") ");
+ 'dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") ");
if (outMsg[1].indexOf(textsegment) === -1)
outMsg[1] += textsegment;
@ -712,7 +712,7 @@ export class KmnFileWriter {
if (amb_2_1.length > 0) {
ambiguousWarnings.compare_type = 'amb_2_1';
ambiguousWarnings.earlier_later = [false, true];
ambiguousWarnings.dk_prefix = ['C', 'A'];
ambiguousWarnings.dk_prefix = ['', 'A'];
ambiguousWarnings.dk_id = [amb_2_1[0].idPrevDeadkey, amb_2_1[0].idDeadkey];
ambiguousWarnings.Dk_modifier = amb_2_1[0].modifierDeadkey;
ambiguousWarnings.Dk_key = amb_2_1[0].deadkey;
@ -988,7 +988,7 @@ export class KmnFileWriter {
if (amb_5_5.length > 0) {
ambiguousWarnings.compare_type = 'amb_5_5';
ambiguousWarnings.earlier_later = [true, false];
ambiguousWarnings.dk_prefix = ['B', 'B'];
ambiguousWarnings.dk_prefix = ['C', 'B'];
ambiguousWarnings.dk_id = [amb_5_5[0].idPrevDeadkey, amb_5_5[0].idDeadkey];
ambiguousWarnings.Dk_modifier = amb_5_5[0].modifierDeadkey;
ambiguousWarnings.Dk_key = amb_5_5[0].deadkey;
@ -998,7 +998,7 @@ export class KmnFileWriter {
if (dup_5_5.length > 0) {
duplicateWarnings.compare_type = 'dup_5_5';
duplicateWarnings.earlier_later = [true, false];
duplicateWarnings.dk_prefix = ['B', 'B'];
duplicateWarnings.dk_prefix = ['C', 'B'];
duplicateWarnings.dk_id = [dup_5_5[0].idPrevDeadkey, dup_5_5[0].idDeadkey];
duplicateWarnings.Dk_modifier = rule[index].modifierDeadkey;

View file

@ -64,9 +64,9 @@ describe('KeylayoutToKmnConverter', function () {
assert.isTrue(compilerTestCallbacks.messages.length === 0);
await sut.run(makePathToFixture(files[0]));
assert.equal(compilerTestCallbacks.messages.length, 0);
});
});
});
});
});
});
describe('RunTestFiles resulting in errors ', function () {
const sut = new KeylayoutToKmnConverter(compilerTestCallbacks, compilerTestOptions);
[
@ -96,7 +96,7 @@ describe('KeylayoutToKmnConverter', function () {
['../data/Test_undefinedAction.keylayout'],
].forEach(function (files) {
it(files + " should give Error: undefined action detected", async function () {
sut.run(makePathToFixture(files[0]));
sut.run(makePathToFixture(files[0]));
assert.equal(compilerTestCallbacks.messages.length, 1);
assert.equal(compilerTestCallbacks.messages[0].code, 5292040);
});

View file

@ -134,7 +134,7 @@ describe('KmnFileWriter', function () {
['c WARNING: unavailable superior rule ( [UNAVAILABLE_prev_dk K_D] > dk(A1) ) : unavailable modifier here: '],
['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(B0) ) : here: ']],
[[new Rule("C3", 'CAPS', 'K_D',1, 1, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)],
[[new Rule("C3", 'CAPS', 'K_D', 1, 1, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)],
[''],
[''],
['']],
@ -163,7 +163,7 @@ describe('KmnFileWriter', function () {
new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),
new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),],
['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '],
["c WARNING: duplicate rule: earlier: dk(B0) + [SHIFT K_B] > dk(B0) here: "],
["c WARNING: duplicate rule: earlier: dk(C0) + [SHIFT K_B] > dk(B0) here: "],
["c WARNING: duplicate rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]],
//6-6 dup
@ -187,7 +187,7 @@ describe('KmnFileWriter', function () {
new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),
new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 1, 'RALT', 'K_F', new TextEncoder().encode('X')),],
['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '],
["c WARNING: ambiguous rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], [''],
["c WARNING: ambiguous rule: earlier: dk(C0) + [NCAPS K_B] > dk(B0) here: "], [''],
],
// 5-5 dup
@ -195,7 +195,7 @@ describe('KmnFileWriter', function () {
new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),
new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('X')),],
['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '],
["c WARNING: duplicate rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "],
["c WARNING: duplicate rule: earlier: dk(C0) + [NCAPS K_B] > dk(B0) here: "],
['']],
// 4-2 amb