Exemple #1
0
        public void TBESG_Select_SameIndex()
        {
            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");

            bool result = grp.Select(1);

            Assert.AreEqual(true, result, "Selection of index 1 should work");

            result = grp.Select(1);
            Assert.AreEqual(false, result, "Selection of index 1 should not work twice since it's already selected");
        }
Exemple #2
0
        public void TBESG_Select_WithControl()
        {
            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");

            bool result = grp.Select(toAdd);

            Assert.AreEqual(true, result, "Selection of index 0 should work after first test");
            Assert.AreEqual(true, toAdd.Active, "control 1 should be active after first test");
            Assert.AreEqual(false, toAdd3.Active, "control 3 should not be active after first test");

            result = grp.Select(toAdd3);
            Assert.AreEqual(true, result, "Selection of index 2 should work after second test");
            Assert.AreEqual(false, toAdd.Active, "control 1 should not be active after second test");
            Assert.AreEqual(true, toAdd3.Active, "control 3 should be active after second test");
        }
Exemple #3
0
        public void TBESG_Select_LikeUnselected()
        {
            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");

            bool result = grp.Select(-1);

            Assert.AreEqual(false, result, "Selection of index -1 should not work");
        }
Exemple #4
0
        public void TBESG_Select_TooHigh()
        {
            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");

            bool result = grp.Select(6);

            Assert.AreEqual(false, result, "Selection of index 6 is too high");
        }
Exemple #5
0
        public void TBESG_Select_ControlNotExist()
        {
            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");

            bool result = grp.Select(toAddX);

            Assert.AreEqual(false, result, "Selection of control X should not work after first test");
            Assert.AreEqual(false, toAddX.Active, "control 3 should not be active after first test");
        }
Exemple #6
0
        public void TBESG_Unselect_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");

            bool result = grp.Select(toAdd2);

            Assert.AreEqual(true, result, "Selection of index 1 should work");
            Assert.AreEqual(true, toAdd2.Active, "control 2 should be active");

            result = grp.Unselect();
            Assert.AreEqual(true, result, "Unselection should be sucessful");
            Assert.AreEqual(false, toAdd2.Active, "control 2 should no longer be active");
        }
Exemple #7
0
        public void TBESG_AddRemove_RemoveAll()
        {
            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");
            grp.Select(toAdd3);
            Assert.AreEqual(true, toAdd3.Active, "Control 3 should be selected.");

            grp.RemoveAll();
            Assert.AreEqual(0, grp.GetCountButton(), "There should be no button in the group");
            Assert.AreEqual(false, toAdd3.Active, "Control 3 should no longer be selected.");
        }