public void ActivateKeyboard_SecondTime_NotCrash()
		{
			XklEngineResponder.SetGroupNames = new[] { KeyboardUSA };

			var adaptor = new XkbKeyboardRetrievingAdaptor(new XklEngineResponder());
			KeyboardController.Initialize(adaptor);
			adaptor.SwitchingAdaptor.ActivateKeyboard(KeyboardController.Instance.Keyboards.First());
			KeyboardController.Shutdown();

			adaptor = new XkbKeyboardRetrievingAdaptor(new XklEngineResponder());
			KeyboardController.Initialize(adaptor);
			Assert.That(() => adaptor.SwitchingAdaptor.ActivateKeyboard(
				KeyboardController.Instance.Keyboards.First()), Throws.Nothing);
		}
Exemplo n.º 2
0
 public override KeyboardDescription CreateKeyboardDefinition(string id)
 {
     return(XkbKeyboardRetrievingAdaptor.CreateKeyboardDefinition(id, SwitchingAdaptor));
 }
		public void CreateKeyboardDefinition()
		{
			// Setup
			XklEngineResponder.SetGroupNames = new[] { KeyboardUSA };
			var adaptor = new XkbKeyboardRetrievingAdaptor(new XklEngineResponder());
			KeyboardController.Initialize(adaptor);

			// This mimics a KMFL ibus keyboard (which come through as path to the keyman file)
			const string kmflKeyboard = "/some/keyboard/without/dash";
			const string expectedKeyboardName = "[Missing] /some/keyboard/without/dash ()";

			// Exercise
			var keyboard = XkbKeyboardRetrievingAdaptor.CreateKeyboardDefinition(kmflKeyboard,
				adaptor.SwitchingAdaptor);

			// Verify
			Assert.That(keyboard, Is.Not.Null);
			Assert.That(keyboard.Name, Is.EqualTo(expectedKeyboardName));
		}