public void TBESG_AddRemove_Remove_BigList() { ToggleButtonExclusiveSelectionGroup grp = new ToggleButtonExclusiveSelectionGroup(); Gtk.ToggleButton toAdd = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd2 = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd3 = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd4 = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd5 = new Gtk.ToggleButton(); grp.Append(toAdd); grp.Append(toAdd2); grp.Append(toAdd3); grp.Append(toAdd4); grp.Append(toAdd5); Assert.AreEqual(5, grp.GetCountButton(), "There should be 5 buttons in the group"); // remove the 3rd one bool result = grp.Remove(toAdd3); Assert.AreEqual(true, result, "3rd button removal should work"); Assert.AreEqual(4, grp.GetCountButton(), "There should be 4 buttons in the group"); // make sure the 3 is no longer there int pos = grp.FindInGroup(toAdd3); Assert.AreEqual(-1, pos, "The button should not be found anymore"); }
public void TBESG_FindInGroup_Normal() { ToggleButtonExclusiveSelectionGroup grp = new ToggleButtonExclusiveSelectionGroup(); Gtk.ToggleButton toAdd = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd2 = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd3 = new Gtk.ToggleButton(); grp.Append(toAdd); grp.Append(toAdd2); grp.Append(toAdd3); Assert.AreEqual(3, grp.GetCountButton(), "There should be 3 buttons in the group"); int result = grp.FindInGroup(toAdd2); Assert.AreEqual(1, result, "The FindInGroup method should return the right control index"); }
public void TBESG_FindInGroup_NotExist() { ToggleButtonExclusiveSelectionGroup grp = new ToggleButtonExclusiveSelectionGroup(); Gtk.ToggleButton toAdd = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd2 = new Gtk.ToggleButton(); Gtk.ToggleButton toAdd3 = new Gtk.ToggleButton(); Gtk.ToggleButton toAddX = new Gtk.ToggleButton(); grp.Append(toAdd); grp.Append(toAdd2); grp.Append(toAdd3); Assert.AreEqual(3, grp.GetCountButton(), "There should be 3 buttons in the group"); int result = grp.FindInGroup(toAddX); Assert.AreEqual(-1, result, "The FindInGroup method shouldn't find the control requested, returning -1"); }