public void DefaultForWritingSystem_OldPalasoKeymanKeyboard() { var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); KeyboardDescription expectedKeyboard; if (Keyboard.Controller.AllAvailableKeyboards.Any(kbd => kbd.Layout == "IPA Unicode 1.1.1")) { expectedKeyboard = Keyboard.Controller.AllAvailableKeyboards.First(kbd => kbd.Layout == "IPA Unicode 1.1.1") as KeyboardDescription; } else { expectedKeyboard = new KeyboardDescription("IPA Unicode 1.1.1 - English (US)", "IPA Unicode 1.1.1", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); } // Palaso sets the keyboard property for Keyman keyboards to <layoutname> var ws = new MockWritingSystemDefinition { Keyboard = "IPA Unicode 1.1.1" }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_NoLegacyKeyboardSet_ReturnsSystemDefault() { var ws = new MockWritingSystemDefinition(); Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(KeyboardController.Adaptors[0].DefaultKeyboard)); }
public void DefaultForWritingSystem_OldFwKeymanKeyboard() { var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); var expectedKeyboard = new KeyboardDescription("IPA Unicode 1.1.1 - English (US)", "IPA Unicode 1.1.1", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // FieldWorks sets the keyboard property for Keyman keyboards to <layoutname> and WindowsLcid to <lcid> var ws = new MockWritingSystemDefinition { Keyboard = "IPA Unicode 1.1.1", WindowsLcid = 0x409.ToString() }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldFwKeymanKeyboard() { var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); var expectedKeyboard = new KeyboardDescription("IPA Unicode 1.1.1 - English (US)", "IPA Unicode 1.1.1", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // FieldWorks sets the keyboard property for Keyman keyboards to <layoutname> and WindowsLcid to <lcid> var ws = new MockWritingSystemDefinition { Keyboard = "IPA Unicode 1.1.1", WindowsLcid = 0x409.ToString() }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldPalasoWinIMEKeyboard() { var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); var expectedKeyboard = new KeyboardDescription("foo - English (US)", "foo", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // Palaso sets the keyboard property for Windows system keyboards to <layoutname>-<locale> var ws = new MockWritingSystemDefinition { Keyboard = "foo-en-US" }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldNonexistingFwSystemKeyboard() { // 0x001C is Albanian. Make sure it's not installed on current system. if (InputLanguage.InstalledInputLanguages.Cast <InputLanguage>().Any(lang => lang.Culture.LCID == 0x041C)) { Assert.Ignore("Input language 'Albanian (Albania)' is installed on current system. Can't run this test."); } // FieldWorks sets the WindowsLcid property for System keyboards to <lcid> var ws = new MockWritingSystemDefinition { WindowsLcid = 0x041C.ToString() }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(KeyboardController.Adaptors[0].DefaultKeyboard)); }
public void DefaultForWritingSystem_OldFwSystemKeyboard() { // 0x001C is Albanian (see http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx). // Make sure it's not installed on current system. if (InputLanguage.InstalledInputLanguages.Cast<InputLanguage>().Any(lang => lang.Culture.LCID == 0x041C)) Assert.Ignore("Input language 'Albanian (Albania)' is installed on current system. Can't run this test."); var inputLanguage = new InputLanguageWrapper("sq-AL", IntPtr.Zero, "US"); var expectedKeyboard = new KeyboardDescription("US - Albanian (Albania)", "US", "sq-AL", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // FieldWorks sets the WindowsLcid property for System keyboards to <lcid> var ws = new MockWritingSystemDefinition { WindowsLcid = 0x041C.ToString() }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldPalasoIbusKeyboard() { #if __MonoCS__ // For this test on Linux we only use the XkbKeyboardAdaptor and simulate an available // IBus keyboard. This is necessary because otherwise the test might return an // installed Danish IBus keyboard (m17n:da:post) instead of our expected dummy one. KeyboardController.Manager.SetKeyboardAdaptors(new[] { new Palaso.UI.WindowsForms.Keyboarding.Linux.XkbKeyboardAdaptor() }); #endif var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); var expectedKeyboard = new KeyboardDescription("m17n:da:post - English (US)", "m17n:da:post", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // Palaso sets the keyboard property for Ibus keyboards to <ibus longname> var ws = new MockWritingSystemDefinition { Keyboard = "m17n:da:post" }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldFwSystemKeyboard() { // 0x001C is Albanian (see http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx). // Make sure it's not installed on current system. if (InputLanguage.InstalledInputLanguages.Cast <InputLanguage>().Any(lang => lang.Culture.LCID == 0x041C)) { Assert.Ignore("Input language 'Albanian (Albania)' is installed on current system. Can't run this test."); } var inputLanguage = new InputLanguageWrapper("sq-AL", IntPtr.Zero, "US"); var expectedKeyboard = new KeyboardDescription("US - Albanian (Albania)", "US", "sq-AL", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // FieldWorks sets the WindowsLcid property for System keyboards to <lcid> var ws = new MockWritingSystemDefinition { WindowsLcid = 0x041C.ToString() }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldNonexistingFwSystemKeyboard() { // 0x001C is Albanian. Make sure it's not installed on current system. if (InputLanguage.InstalledInputLanguages.Cast<InputLanguage>().Any(lang => lang.Culture.LCID == 0x041C)) Assert.Ignore("Input language 'Albanian (Albania)' is installed on current system. Can't run this test."); // FieldWorks sets the WindowsLcid property for System keyboards to <lcid> var ws = new MockWritingSystemDefinition { WindowsLcid = 0x041C.ToString() }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(KeyboardController.Adaptors[0].DefaultKeyboard)); }
public void DefaultForWritingSystem_NoLegacyKeyboardSet_ReturnsSystemDefault() { var ws = new MockWritingSystemDefinition(); Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(KeyboardController.Adaptors[0].DefaultKeyboard)); }
public void DefaultForWritingSystem_OldPalasoWinIMEKeyboard() { var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); var expectedKeyboard = new KeyboardDescription("foo - English (US)", "foo", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // Palaso sets the keyboard property for Windows system keyboards to <layoutname>-<locale> var ws = new MockWritingSystemDefinition { Keyboard = "foo-en-US" }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldPalasoKeymanKeyboard() { var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); KeyboardDescription expectedKeyboard; if (Keyboard.Controller.AllAvailableKeyboards.Any(kbd => kbd.Layout == "IPA Unicode 1.1.1")) { expectedKeyboard = Keyboard.Controller.AllAvailableKeyboards.First(kbd => kbd.Layout == "IPA Unicode 1.1.1") as KeyboardDescription; } else { expectedKeyboard = new KeyboardDescription("IPA Unicode 1.1.1 - English (US)", "IPA Unicode 1.1.1", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); } // Palaso sets the keyboard property for Keyman keyboards to <layoutname> var ws = new MockWritingSystemDefinition { Keyboard = "IPA Unicode 1.1.1" }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }
public void DefaultForWritingSystem_OldPalasoIbusKeyboard() { #if __MonoCS__ // For this test on Linux we only use the XkbKeyboardAdaptor and simulate an available // IBus keyboard. This is necessary because otherwise the test might return an // installed Danish IBus keyboard (m17n:da:post) instead of our expected dummy one. KeyboardController.Manager.SetKeyboardAdaptors(new[] { new Palaso.UI.WindowsForms.Keyboarding.Linux.XkbKeyboardAdaptor() }); #endif var inputLanguage = new InputLanguageWrapper(new CultureInfo("en-US"), IntPtr.Zero, "foo"); var expectedKeyboard = new KeyboardDescription("m17n:da:post - English (US)", "m17n:da:post", "en-US", inputLanguage, KeyboardController.Adaptors[0]); KeyboardController.Manager.RegisterKeyboard(expectedKeyboard); // Palaso sets the keyboard property for Ibus keyboards to <ibus longname> var ws = new MockWritingSystemDefinition { Keyboard = "m17n:da:post" }; Assert.That(Keyboard.Controller.DefaultForWritingSystem(ws), Is.EqualTo(expectedKeyboard)); }