public void ActivatingIbusKeyboardAlsoActivatesXkbKeyboard( string name, string language, string layout) { const int DeKeyboardGroup = 1; const int EnKeyboardGroup = 2; const int FrKeyboardGroup = 3; // Setup var ibusKeyboardAdapter = new IbusKeyboardAdaptorDouble(new DoNothingIbusCommunicator()); var xklEngineMock = new Mock <IXklEngine>(); var xkbKeyboardAdapter = new XkbKeyboardAdaptorDouble(xklEngineMock.Object); KeyboardController.Manager.SetKeyboardAdaptors(new IKeyboardAdaptor[] { xkbKeyboardAdapter, ibusKeyboardAdapter }); var ibusKeyboard = CreateMockIbusKeyboard(ibusKeyboardAdapter, name, language, layout); var deKeyboard = CreateMockXkbKeyboard("German - German (Germany)", "de", "de-DE", "German", DeKeyboardGroup, xkbKeyboardAdapter); CreateMockXkbKeyboard("English (US) - English (United States)", "us", "en-US", "English", EnKeyboardGroup, xkbKeyboardAdapter); CreateMockXkbKeyboard("French - French (France)", "fr", "fr-FR", "French", FrKeyboardGroup, xkbKeyboardAdapter); deKeyboard.Activate(); // Exercise ibusKeyboard.Activate(); // Verify xklEngineMock.Verify(x => x.SetGroup(layout == "fr" ? FrKeyboardGroup : EnKeyboardGroup), string.Format("Switching to the ibus keyboard should activate the {0} xkb keyboard.", layout == "fr" ? "French" : "English")); }
public void ActivatingIbusKeyboardAlsoActivatesXkbKeyboard( string name, string language, string layout) { const int DeKeyboardGroup = 1; const int EnKeyboardGroup = 2; const int FrKeyboardGroup = 3; // Setup var ibusKeyboardAdapter = new IbusKeyboardAdaptorDouble(new DoNothingIbusCommunicator()); var xklEngineMock = new Mock<IXklEngine>(); var xkbKeyboardAdapter = new XkbKeyboardAdaptorDouble(xklEngineMock.Object); KeyboardController.Manager.SetKeyboardAdaptors(new IKeyboardAdaptor[] { xkbKeyboardAdapter, ibusKeyboardAdapter}); var ibusKeyboard = CreateMockIbusKeyboard(ibusKeyboardAdapter, name, language, layout); var deKeyboard = CreateMockXkbKeyboard("German - German (Germany)", "de", "de-DE", "German", DeKeyboardGroup, xkbKeyboardAdapter); CreateMockXkbKeyboard("English (US) - English (United States)", "us", "en-US", "English", EnKeyboardGroup, xkbKeyboardAdapter); CreateMockXkbKeyboard("French - French (France)", "fr", "fr-FR", "French", FrKeyboardGroup, xkbKeyboardAdapter); deKeyboard.Activate(); // Exercise ibusKeyboard.Activate(); // Verify xklEngineMock.Verify(x => x.SetGroup(layout == "fr" ? FrKeyboardGroup : EnKeyboardGroup), string.Format("Switching to the ibus keyboard should activate the {0} xkb keyboard.", layout == "fr" ? "French" : "English")); }