Esempio n. 1
0
        public void InitKeyboards_XkbAndIbus()
        {
            IDictionary <string, uint> registeredKeyboards = null;
            var installedKeyboards = new[] {
                "xkb;;us",
                "ibus;;km:/home/user/.local/share/keyman/khmer_angkor/khmer_angkor.kmx"
            };
            var sut = new UnityKeyboardRetrievingHelper(() => installedKeyboards);

            Assert.That(() => sut.InitKeyboards(s => true,
                                                (keyboards, _) => registeredKeyboards = keyboards),
                        Throws.Nothing);
            Assert.That(registeredKeyboards, Is.EquivalentTo(new Dictionary <string, int> {
                { "us", 0 },
                { "km:/home/user/.local/share/keyman/khmer_angkor/khmer_angkor.kmx", 1 }
            }));
        }
Esempio n. 2
0
        public void InitKeyboards_DuplicateKeyboard()
        {
            IDictionary <string, uint> registeredKeyboards = null;
            var installedKeyboards = new[] {
                "ibus;;km:/home/user/.local/share/keyman/khmer_angkor/khmer_angkor.kmx",
                "ibus;;km:/home/user/.local/share/keyman/khmer_angkor/khmer_angkor.kmx",
                "xkb;;us"
            };
            var sut = new UnityKeyboardRetrievingHelper(() => installedKeyboards);

            Assert.That(() => sut.InitKeyboards(s => true,
                                                (keyboards, _) => registeredKeyboards = keyboards),
                        Throws.Nothing);         // LT-20410
            Assert.That(registeredKeyboards, Is.EquivalentTo(new Dictionary <string, int> {
                { "km:/home/user/.local/share/keyman/khmer_angkor/khmer_angkor.kmx", 0 },
                { "us", 2 }                 // 2 is the 0-based index of the 'us' layout in `installedKeyboards`
            }));
        }