public void TestKeyBindingSetEqualsParent() { var cmd1 = new ActionCommand("Command1", "Test Command 1"); var cmd2 = new ActionCommand("Command2", "Test Command 2"); var cmd3 = new ActionCommand("Command3", "Test Command 3"); var parent = new KeyBindingSet(); parent.SetBinding(cmd1, "Ctrl+1"); var set2 = new KeyBindingSet(parent); var set3 = new KeyBindingSet(parent); //UNDONE: this is not a full IEquatable<KeyBindingSet> implementation // an empty set must be equal to its parent Assert.IsTrue(set2.Equals(parent)); set2.SetBinding(cmd2, "Ctrl+2"); set3.SetBinding(cmd2, "Ctrl+2"); // sets sharing the same parent and declaring same bindings are equal Assert.IsTrue(set3.Equals(set2)); Assert.IsTrue(set2.Equals(set3)); // set defines an additional binding, hence not equal to its parent Assert.IsFalse(set3.Equals(parent)); // sets with different binding and same parent are not equal set3.SetBinding(cmd2, "Alt+2"); Assert.IsFalse(set3.Equals(set2)); }
public void TestKeyBindingSetEquals1() { var cmd1 = new ActionCommand("Command1", "Test Command 1"); var cmd2 = new ActionCommand("Command2", "Test Command 2"); var cmd3 = new ActionCommand("Command3", "Test Command 3"); var set1 = new KeyBindingSet(); set1.SetBinding(cmd1, "Ctrl+1"); set1.SetBinding(cmd2, "Ctrl+2"); var set2 = new KeyBindingSet(); set2.SetBinding(cmd1, "Ctrl+1"); set2.SetBinding(cmd2, "Ctrl+2"); Assert.IsTrue(set1.Equals(set2)); Assert.IsTrue(set2.Equals(set1)); set2.SetBinding(cmd3, "Ctrl+3"); Assert.IsFalse(set2.Equals(set1)); //UNDONE: a set equals an other set if its a subset, this may/shold change in the future Assert.IsTrue(set1.Equals(set2)); }
public void TestKeyBindingSetEquals1() { var cmd1 = new ActionCommand("Command1", "Test Command 1"); var cmd2 = new ActionCommand("Command2", "Test Command 2"); var cmd3 = new ActionCommand("Command3", "Test Command 3"); var set1 = new KeyBindingSet(); set1.SetBinding(cmd1, "Ctrl+1"); set1.SetBinding(cmd2, "Ctrl+2"); var set2 = new KeyBindingSet(); set2.SetBinding(cmd1, "Ctrl+1"); set2.SetBinding(cmd2, "Ctrl+2"); Assert.IsTrue(set1.Equals(set2)); Assert.IsTrue(set2.Equals(set1)); set2.SetBinding(cmd3, "Ctrl+3"); Assert.IsFalse(set2.Equals(set1)); Assert.IsFalse(set1.Equals(set2)); }
void SelectCurrentScheme() { try { internalUpdate = true; for (int n = 0; n < schemes.Count; n++) { KeyBindingScheme s = schemes [n]; if (currentBindings.Equals(s.GetKeyBindingSet())) { schemeCombo.Active = n + 1; return; } } schemeCombo.Active = 0; } finally { internalUpdate = false; } }
public void TestKeyBindingSetEquals2() { var cmd1 = new ActionCommand("Command1", "Test Command 1"); var cmd2 = new ActionCommand("Command2", "Test Command 2"); var set1 = new KeyBindingSet(); set1.SetBinding(cmd1, "Ctrl+1"); var set2 = new KeyBindingSet(); set2.SetBinding(cmd1, "Ctrl+1"); // add an empty binding to set2 which shouldn't change equality (bug #57111) set2.SetBinding(cmd2, string.Empty); Assert.IsTrue(set2.Equals(set1)); Assert.IsTrue(set1.Equals(set2)); }
public void TestKeyBindingSetEquals2() { var cmd1 = new ActionCommand("Command1", "Test Command 1"); var cmd2 = new ActionCommand("Command2", "Test Command 2"); var set1 = new KeyBindingSet(); set1.SetBinding(cmd1, "Ctrl+1"); var set2 = new KeyBindingSet(); set2.SetBinding(cmd1, "Ctrl+1"); // add an empty binding to set2 which shouldn't change equality (bug #57111) set2.SetBinding(cmd2, string.Empty); Assert.IsFalse(set2.Equals(set1)); //UNDONE: a set equals an other set if its a subset, this may/shold change in the future Assert.IsTrue(set1.Equals(set2)); }