Exemplo n.º 1
0
 internal KeyboardDescription(KeyboardDescription other)
     : base(other)
 {
     InternalName  = other.Name;
     Engine        = other.Engine;
     IsAvailable   = other.IsAvailable;
     InputLanguage = other.InputLanguage;
 }
Exemplo n.º 2
0
		internal KeyboardDescription(KeyboardDescription other)
			:base(other)
		{
			InternalName = other.Name;
			Engine = other.Engine;
			IsAvailable = other.IsAvailable;
			InputLanguage = other.InputLanguage;
		}
        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 CreateKeyboardDefinition_ExistingKeyboard_ReturnsReference()
 {
     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);
     var keyboard = Keyboard.Controller.CreateKeyboardDefinition("foo", "en-US");
     Assert.That(keyboard, Is.SameAs(expectedKeyboard));
     Assert.That(keyboard, Is.TypeOf<KeyboardDescription>());
     Assert.That((keyboard as KeyboardDescription).InputLanguage, Is.EqualTo(inputLanguage));
 }
        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));
        }
Exemplo n.º 6
0
		/// <summary>
		/// overload unfortunately required by IEquatable
		/// </summary>
		/// <param name="other"></param>
		/// <returns></returns>
		public bool Equals(KeyboardDescription other)
		{
			return Equals((IKeyboardDefinition) other);
		}
Exemplo n.º 7
0
 /// <summary>
 /// overload unfortunately required by IEquatable
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(KeyboardDescription other)
 {
     return(Equals((IKeyboardDefinition)other));
 }
        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));
        }