Esempio n. 1
0
        public void TestGlueWithGluedControlInvisible_ChangedToVisible()
        {
            //---------------Set up test pack-------------------
            FlowLayoutManager manager = CreateFlowLayoutManager();
            IControlHabanero  ctl     = CreateControl(30, 10);
            IControlHabanero  ctl2    = CreateControl(50, 10);

            //---------------Execute Test ----------------------
            manager.AddControl(CreateControl(50, 10));
            ctl.Visible = false;
            manager.AddControl(ctl);
            manager.AddGlue();
            manager.AddControl(ctl2);

            //---------------Test Result -----------------------
            Assert.AreEqual(0, ctl.Left, "ctl is invisible so should be ignored");
            Assert.AreEqual(0, ctl.Top, "ctl is invisible so should be ignored");
            Assert.AreEqual(stdFirstPosLeft(), ctl2.Left,
                            "ctl2 should move to next line but still be at left border because ctl is invisible ");
            Assert.AreEqual(StdSecondRowTop(), ctl2.Top, "ctl2 should be in row 2");

            //---------------Execute Test ----------------------
            ctl.Visible = true;
            //---------------Test Result -----------------------
            Assert.AreEqual(stdFirstPosLeft(), ctl.Left);
            Assert.AreEqual(StdSecondRowTop(), ctl.Top, "ctl be in second row because of glue");
            Assert.AreEqual(_STD_BORDER + ctl.Width + _STD_GAP, ctl2.Left, "ctl2 should move accross because ctl is visible ");
            Assert.AreEqual(StdSecondRowTop(), ctl2.Top, "ctl2 should be in row 2");
        }
Esempio n. 2
0
        public void TestGlueSimpleCase_DontAddSecondControlToGlue_Resize()
        {
            //---------------Set up test pack-------------------
            FlowLayoutManager manager = CreateFlowLayoutManager();

            //---------------Execute Test ----------------------
            manager.AddControl(CreateControl(40, 10));
            IControlHabanero gluedCtl = CreateControl(35, 10);

            manager.AddControl(gluedCtl);
            manager.AddGlue();
            manager.ManagedControl.Width = 50;
            //---------------Test Result -----------------------
            Assert.AreEqual(stdFirstPosLeft(), gluedCtl.Left, "Glue should mean ctl moves with ctl2 (if space permits)");
            Assert.AreEqual(StdSecondRowTop(), gluedCtl.Top, "Glue should mean ctl moves to new row with ctl2 (if space permits)");
        }
Esempio n. 3
0
        public void TestGlueSimpleCase()
        {
            //---------------Set up test pack-------------------
            FlowLayoutManager manager = CreateFlowLayoutManager();
            IControlHabanero  ctl1    = CreateControl(35, 10);
            IControlHabanero  ctl2    = CreateControl(35, 10);

            //---------------Execute Test ----------------------
            manager.AddControl(CreateControl(40, 10));
            manager.AddControl(ctl1);
            manager.AddGlue();
            manager.AddControl(ctl2);
            //---------------Test Result -----------------------
            Assert.AreEqual(stdFirstPosLeft(), ctl1.Left, "Glue should mean ctl moves with ctl2 (if space permits)");
            Assert.AreEqual(StdSecondRowTop(), ctl1.Top, "Glue should mean ctl moves to new row with ctl2 (if space permits)");
            Assert.AreEqual(stdFirstPosLeft() + ctl1.Width + _STD_GAP, ctl2.Left, "ctl2 should be to the right of ctl on a new line because of glue");
            Assert.AreEqual(StdSecondRowTop(), ctl2.Top, "ctl2 should be in row 2");
        }
Esempio n. 4
0
        public void TestGlueWithGluedControlAtLeftBorder()
        {
            //---------------Set up test pack-------------------
            FlowLayoutManager manager = CreateFlowLayoutManager();
            //---------------Execute Test ----------------------
            IControlHabanero ctl = CreateControl(30, 10);

            manager.AddControl(ctl);
            manager.AddGlue();
            IControlHabanero ctl2 = CreateControl(90, 10);

            manager.AddControl(ctl2);

            //---------------Test Result -----------------------
            Assert.AreEqual(5, ctl.Left, "ctl should stay where it is in spite of glue");
            Assert.AreEqual(5, ctl.Top, "ctl should stay where it is in spite of glue");
            Assert.AreEqual(5, ctl2.Left,
                            "ctl2 should move to next line by itself (since ctl and ctl2 can't fit on one line.");
            Assert.AreEqual(StdSecondRowTop(), ctl2.Top, "ctl2 should be in row 2");
        }
Esempio n. 5
0
        public void TestGlueWithGluedControlTooWideToKeepOnSameLine()
        {
            //---------------Set up test pack-------------------
            FlowLayoutManager manager = CreateFlowLayoutManager();
            IControlHabanero  ctl1    = CreateControl(30, 10);
            IControlHabanero  ctl2    = CreateControl(50, 10);
            IControlHabanero  ctl3    = CreateControl(50, 10);

            //---------------Execute Test ----------------------
            manager.AddControl(ctl1);
            manager.AddControl(ctl2);
            manager.AddGlue();
            manager.AddControl(ctl3);

            //---------------Test Result -----------------------
            Assert.AreEqual(ctl1.Width + _STD_GAP + _STD_BORDER, ctl2.Left,
                            "ctl should stay where it is in spite of glue since it cant fit with ctl2 on one line");
            Assert.AreEqual(stdFirstRowTop(), ctl2.Top,
                            "ctl should stay where it is in spite of glue since it cant fit with ctl2 on one line");
            Assert.AreEqual(stdFirstPosLeft(), ctl3.Left,
                            "ctl2 should move to next line by itself (since ctl and ctl2 can't fit on one line.");
            Assert.AreEqual(StdSecondRowTop(), ctl3.Top, "ctl2 should be in row 2");
        }