예제 #1
0
        public void TestSetter_TaskListInstance()
        {
            FPnl = new TPnlCollapsible(THostedControlKind.hckTaskList, TTestTaskList.GetTestXmlNode());
            FPnl.RealiseTaskListNow();

            TTaskList TLst1        = FPnl.TaskListInstance;
            int       ExpandedSize = FPnl.ExpandedSize;

            TTaskList TLst2 = new TTaskList(TTestTaskList.GetTestXmlNode2());

            FPnl.TaskListInstance = TLst2;

            Assert.AreNotEqual(TLst1, FPnl.TaskListInstance, "FPnl.TaskListInstance");

            Assert.AreNotEqual(ExpandedSize, FPnl.ExpandedSize, "ExpandedSize");

            assertIsStable2(FPnl);
        }
예제 #2
0
        public void TestSetter_VisualStyleEnum()
        {
            FPnl = new TPnlCollapsible(THostedControlKind.hckTaskList, TTestTaskList.GetTestXmlNode());

            Assert.AreEqual(TVisualStylesEnum.vsAccordionPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsTaskPanel;
            Assert.AreEqual(TVisualStylesEnum.vsTaskPanel, FPnl.VisualStyleEnum);

            FPnl.Collapse();           // To ensure Unit Test code coverage only - nothing to assert here...
            FPnl.Expand();             // To ensure Unit Test code coverage only - nothing to assert here...
            FPnl.RealiseTaskListNow(); // To ensure Unit Test code coverage only - nothing to assert here...

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsAccordionPanel;
            Assert.AreEqual(TVisualStylesEnum.vsAccordionPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsDashboard;
            Assert.AreEqual(TVisualStylesEnum.vsDashboard, FPnl.VisualStyleEnum);
            FPnl.Expand();  // To ensure Unit Test code coverage only - nothing to assert here...

            // The following Tests should work with 'Assert.AreNotEqual' because the Visual Style we try to assign is only valid
            // for a different CollapseDirection: cdHorizontal or cdHorizontalRight
            FPnl.VisualStyleEnum = TVisualStylesEnum.vsHorizontalCollapse;
            Assert.AreNotEqual(TVisualStylesEnum.vsHorizontalCollapse, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsShepherd;
            Assert.AreNotEqual(TVisualStylesEnum.vsShepherd, FPnl.VisualStyleEnum);


            // Specifiying 'TVisualStylesEnum.vsHorizontalCollapse' in the next statement, which is invalid and...
            FPnl = new TPnlCollapsible(THostedControlKind.hckUserControl, HOSTEDUSERCONTROL, TVisualStylesEnum.vsHorizontalCollapse);

            // ...gets automatically corrected to TVisualStylesEnum.vsDashboard by the Control!
            Assert.AreEqual(TVisualStylesEnum.vsDashboard, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsAccordionPanel;
            Assert.AreEqual(TVisualStylesEnum.vsAccordionPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsTaskPanel;
            Assert.AreEqual(TVisualStylesEnum.vsTaskPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsDashboard;
            Assert.AreEqual(TVisualStylesEnum.vsDashboard, FPnl.VisualStyleEnum);

            // The following Tests should work with 'Assert.AreNotEqual' because the Visual Style we try to assign is only valid
            // for a different CollapseDirection: cdHorizontal or cdHorizontalRight
            FPnl.VisualStyleEnum = TVisualStylesEnum.vsHorizontalCollapse;
            Assert.AreNotEqual(TVisualStylesEnum.vsHorizontalCollapse, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsShepherd;
            Assert.AreNotEqual(TVisualStylesEnum.vsShepherd, FPnl.VisualStyleEnum);


            FPnl = new TPnlCollapsible(THostedControlKind.hckCollapsiblePanelHoster, TTestTaskList.GetTestXmlNode());

            Assert.AreEqual(TVisualStylesEnum.vsAccordionPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsTaskPanel;
            Assert.AreEqual(TVisualStylesEnum.vsTaskPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsAccordionPanel;
            Assert.AreEqual(TVisualStylesEnum.vsAccordionPanel, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsDashboard;
            Assert.AreEqual(TVisualStylesEnum.vsDashboard, FPnl.VisualStyleEnum);

            // The following Tests should work with 'Assert.AreNotEqual' because the Visual Style we try to assign is only valid
            // for a different CollapseDirection: cdHorizontal or cdHorizontalRight
            FPnl.VisualStyleEnum = TVisualStylesEnum.vsHorizontalCollapse;
            Assert.AreNotEqual(TVisualStylesEnum.vsHorizontalCollapse, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsShepherd;
            Assert.AreNotEqual(TVisualStylesEnum.vsShepherd, FPnl.VisualStyleEnum);


            FPnl = new TPnlCollapsible(THostedControlKind.hckTaskList,
                                       TTestTaskList.GetTestXmlNode(), TVisualStylesEnum.vsShepherd, TCollapseDirection.cdHorizontal);

            Assert.AreEqual(TVisualStylesEnum.vsShepherd, FPnl.VisualStyleEnum);

            FPnl.VisualStyleEnum = TVisualStylesEnum.vsHorizontalCollapse;
            Assert.AreEqual(TVisualStylesEnum.vsHorizontalCollapse, FPnl.VisualStyleEnum);


            // To ensure Unit Test code coverage only - nothing to assert here...
            FPnl.RealiseTaskListNow();
            FPnl.VisualStyleEnum = TVisualStylesEnum.vsShepherd;


            // To ensure Unit Test code coverage only - nothing to assert here...
            FPnl = new TPnlCollapsible(THostedControlKind.hckTaskList,
                                       TTestTaskList.GetTestXmlNode(), TVisualStylesEnum.vsHorizontalCollapse, TCollapseDirection.cdHorizontal);
            FPnl.VisualStyleEnum = TVisualStylesEnum.vsHorizontalCollapse_InfoPanelWithGradient;
        }