mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-05 01:36:28 +00:00
18967dadbf
fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/417 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1317>
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import { expect } from "chai";
|
|
|
|
import getKeysymString from "../src/keysyms.js";
|
|
|
|
describe("getKeysymString tests", () => {
|
|
it("should return mapped keySym value from codesToKeySyms", () => {
|
|
const key = "Shift";
|
|
const code = "ShiftLeft";
|
|
const result = getKeysymString(key, code);
|
|
expect(result).to.equal("Shift_L");
|
|
});
|
|
|
|
it("should return the keysym for a single-character key from uniToKeySyms", () => {
|
|
const key = "A";
|
|
const code = "KeyA";
|
|
const result = getKeysymString(key, code);
|
|
expect(result).to.equal("A");
|
|
});
|
|
|
|
it("should handle non-ASCII characters from uniToKeySyms", () => {
|
|
const key = "ф";
|
|
const code = "KeyA";
|
|
const result = getKeysymString(key, code);
|
|
expect(result).to.equal("Cyrillic_ef");
|
|
});
|
|
|
|
it("should return the valid keySym from knownKeysyms", () => {
|
|
const key = "Tab";
|
|
const code = "Tab";
|
|
const result = getKeysymString(key, code);
|
|
expect(result).to.equal(code);
|
|
});
|
|
|
|
it("should return the default keySym if no match is found", () => {
|
|
const key = "InvalidKey";
|
|
const code = "InvalidCode";
|
|
const result = getKeysymString(key, code);
|
|
expect(result).to.equal("Unidentified");
|
|
});
|
|
});
|