Exemplo n.º 1
0
        public virtual void Test_AddLeafMenuItem_ShouldIncreaseMinSizeOfCollapsiblePanel()
        {
            //---------------Set up test pack-------------------
            string name = TestUtil.GetRandomString();

            HabaneroMenu.Item                ownerItem   = new HabaneroMenu.Item(null, name);
            CollapsibleSubMenuItemVWG        subMenuItem = new CollapsibleSubMenuItemVWG(GetControlFactory(), ownerItem);
            CollapsibleMenuItemCollectionVWG collapsibleMenuItemCollection = new CollapsibleMenuItemCollectionVWG
                                                                                 (subMenuItem);

            HabaneroMenu.Item      item         = new HabaneroMenu.Item(null, name);
            CollapsibleMenuItemVWG menuLeafItem = new CollapsibleMenuItemVWG(GetControlFactory(), item);

            //---------------Assert Precondition----------------
            Assert.AreSame(subMenuItem, collapsibleMenuItemCollection.OwnerMenuItem);
            Assert.IsInstanceOf(typeof(CollapsibleMenuItemVWG), menuLeafItem);
            Assert.AreEqual(subMenuItem.CollapseButton.Height, subMenuItem.MinimumSize.Height);
            //---------------Execute Test ----------------------
            collapsibleMenuItemCollection.Add(menuLeafItem);
            //---------------Test Result -----------------------
            int expectedHeight = subMenuItem.CollapseButton.Height + menuLeafItem.Height;

            Assert.AreEqual(expectedHeight, subMenuItem.Height);
            Assert.AreEqual
                (expectedHeight, subMenuItem.ExpandedHeight, "this will be zero untill the first time this is collapsed");
        }
 public virtual void Test_AddLeafMenuItem_ShouldAddButtonToCollapsiblePanel()
 {
     //---------------Set up test pack-------------------
     string name = TestUtil.GetRandomString();
     HabaneroMenu.Item ownerItem = new HabaneroMenu.Item(null, name);
     CollapsibleSubMenuItemVWG subMenuItem = new CollapsibleSubMenuItemVWG(GetControlFactory(), ownerItem);
     CollapsibleMenuItemCollectionVWG collapsibleMenuItemCollection = new CollapsibleMenuItemCollectionVWG
         (subMenuItem);
     HabaneroMenu.Item item = new HabaneroMenu.Item(null, name);
     CollapsibleMenuItemVWG menuLeafItem = new CollapsibleMenuItemVWG(GetControlFactory(), item);
     //---------------Assert Precondition----------------
     Assert.AreSame(subMenuItem, collapsibleMenuItemCollection.OwnerMenuItem);
     Assert.IsInstanceOf(typeof(CollapsibleMenuItemVWG), menuLeafItem);
     Assert.AreEqual(1, subMenuItem.Controls.Count, "CollapsiblePanel always has header button");
     Assert.AreEqual(0, collapsibleMenuItemCollection.Count);
     //---------------Execute Test ----------------------
     collapsibleMenuItemCollection.Add(menuLeafItem);
     //---------------Test Result -----------------------
     Assert.AreEqual(1, collapsibleMenuItemCollection.Count);
     Assert.AreEqual(2, subMenuItem.Controls.Count, "Should have additional button control");
     IControlHabanero contentControl = subMenuItem.ContentControl;
     Assert.IsInstanceOf(typeof(IPanel), contentControl);
     Assert.AreEqual(1, contentControl.Controls.Count);
     Assert.IsInstanceOf(typeof(IButton), contentControl.Controls[0]);
     Assert.AreEqual(menuLeafItem.Dock, DockStyleVWG.GetDockStyle(DockStyle.Top));
 }
Exemplo n.º 3
0
        public virtual void Test_AddLeafMenuItem_ShouldAddButtonToCollapsiblePanel()
        {
            //---------------Set up test pack-------------------
            string name = TestUtil.GetRandomString();

            HabaneroMenu.Item                ownerItem   = new HabaneroMenu.Item(null, name);
            CollapsibleSubMenuItemVWG        subMenuItem = new CollapsibleSubMenuItemVWG(GetControlFactory(), ownerItem);
            CollapsibleMenuItemCollectionVWG collapsibleMenuItemCollection = new CollapsibleMenuItemCollectionVWG
                                                                                 (subMenuItem);

            HabaneroMenu.Item      item         = new HabaneroMenu.Item(null, name);
            CollapsibleMenuItemVWG menuLeafItem = new CollapsibleMenuItemVWG(GetControlFactory(), item);

            //---------------Assert Precondition----------------
            Assert.AreSame(subMenuItem, collapsibleMenuItemCollection.OwnerMenuItem);
            Assert.IsInstanceOf(typeof(CollapsibleMenuItemVWG), menuLeafItem);
            Assert.AreEqual(1, subMenuItem.Controls.Count, "CollapsiblePanel always has header button");
            Assert.AreEqual(0, collapsibleMenuItemCollection.Count);
            //---------------Execute Test ----------------------
            collapsibleMenuItemCollection.Add(menuLeafItem);
            //---------------Test Result -----------------------
            Assert.AreEqual(1, collapsibleMenuItemCollection.Count);
            Assert.AreEqual(2, subMenuItem.Controls.Count, "Should have additional button control");
            IControlHabanero contentControl = subMenuItem.ContentControl;

            Assert.IsInstanceOf(typeof(IPanel), contentControl);
            Assert.AreEqual(1, contentControl.Controls.Count);
            Assert.IsInstanceOf(typeof(IButton), contentControl.Controls[0]);
            Assert.AreEqual(menuLeafItem.Dock, DockStyleVWG.GetDockStyle(DockStyle.Top));
        }
 public virtual void Test_AddLeafMenuItem_ShouldIncreaseMinSizeOfCollapsiblePanel()
 {
     //---------------Set up test pack-------------------
     string name = TestUtil.GetRandomString();
     HabaneroMenu.Item ownerItem = new HabaneroMenu.Item(null, name);
     CollapsibleSubMenuItemVWG subMenuItem = new CollapsibleSubMenuItemVWG(GetControlFactory(), ownerItem);
     CollapsibleMenuItemCollectionVWG collapsibleMenuItemCollection = new CollapsibleMenuItemCollectionVWG
         (subMenuItem);
     HabaneroMenu.Item item = new HabaneroMenu.Item(null, name);
     CollapsibleMenuItemVWG menuLeafItem = new CollapsibleMenuItemVWG(GetControlFactory(), item);
     //---------------Assert Precondition----------------
     Assert.AreSame(subMenuItem, collapsibleMenuItemCollection.OwnerMenuItem);
     Assert.IsInstanceOf(typeof(CollapsibleMenuItemVWG), menuLeafItem);
     Assert.AreEqual(subMenuItem.CollapseButton.Height, subMenuItem.MinimumSize.Height);
     //---------------Execute Test ----------------------
     collapsibleMenuItemCollection.Add(menuLeafItem);
     //---------------Test Result -----------------------
     int expectedHeight = subMenuItem.CollapseButton.Height + menuLeafItem.Height;
     Assert.AreEqual(expectedHeight, subMenuItem.Height);
     Assert.AreEqual
         (expectedHeight, subMenuItem.ExpandedHeight, "this will be zero untill the first time this is collapsed");
 }