Beispiel #1
0
        public void CleanProperties()
        {
            ITableRowTest tr = GetNewTestTableRow();

            tr.HorizontalAlign = HorizontalAlign.Justify;
            Assert.AreEqual(HorizontalAlign.Justify, tr.HorizontalAlign, "HorizontalAlign");
            tr.VerticalAlign = VerticalAlign.Bottom;
            Assert.AreEqual(VerticalAlign.Bottom, tr.VerticalAlign, "VerticalAlign");
            Assert.AreEqual(0, tr.Attributes.Count, "Attributes.Count");
            Assert.AreEqual(2, tr.StateBag.Count, "ViewState.Count");

            tr.HorizontalAlign = HorizontalAlign.NotSet;
            Assert.AreEqual(HorizontalAlign.NotSet, tr.HorizontalAlign, "HorizontalAlign");
            tr.VerticalAlign = VerticalAlign.NotSet;
            Assert.AreEqual(VerticalAlign.NotSet, tr.VerticalAlign, "VerticalAlign");
#if NET_2_0
            tr.TableSection = TableRowSection.TableFooter;
            Assert.AreEqual(TableRowSection.TableFooter, tr.TableSection, "TableFooter");
            tr.TableSection = TableRowSection.TableHeader;
            Assert.AreEqual(TableRowSection.TableHeader, tr.TableSection, "TableHeader");
            tr.TableSection = TableRowSection.TableBody;
            Assert.AreEqual(TableRowSection.TableBody, tr.TableSection, "TableBody");
            Assert.AreEqual(3, tr.StateBag.Count, "ViewState.Count-1");
#else
            Assert.AreEqual(2, tr.StateBag.Count, "ViewState.Count-1");
#endif
            Assert.AreEqual(0, tr.Attributes.Count, "Attributes.Count");
        }
        public void NullProperties()
        {
            ITableRowTest tr = GetNewTestTableRow();

            tr.HorizontalAlign = HorizontalAlign.NotSet;
            Assert.AreEqual(HorizontalAlign.NotSet, tr.HorizontalAlign, "HorizontalAlign");
            tr.VerticalAlign = VerticalAlign.NotSet;
            Assert.AreEqual(VerticalAlign.NotSet, tr.VerticalAlign, "VerticalAlign");
            tr.TableSection = TableRowSection.TableBody;
            Assert.AreEqual(TableRowSection.TableBody, tr.TableSection, "TableSection");
            Assert.AreEqual(3, tr.StateBag.Count, "ViewState.Count-1");
            Assert.AreEqual(0, tr.Attributes.Count, "Attributes.Count");
        }
Beispiel #3
0
        public void CreateControlStyle()
        {
            ITableRowTest tr = GetNewTestTableRow();

            tr.HorizontalAlign = HorizontalAlign.Left;
            tr.VerticalAlign   = VerticalAlign.Bottom;

            TableItemStyle tis = (TableItemStyle)tr.GetStyle();

            // is it live ?
            tis.HorizontalAlign = HorizontalAlign.Right;
            Assert.AreEqual(HorizontalAlign.Right, tr.HorizontalAlign, "HorizontalAlign-2");
            tis.VerticalAlign = VerticalAlign.Top;
            Assert.AreEqual(VerticalAlign.Top, tr.VerticalAlign, "VerticalAlign-2");
        }
        public void DefaultProperties()
        {
            ITableRowTest tr = GetNewTestTableRow();

            Assert.AreEqual(0, tr.Attributes.Count, "Attributes.Count");
            Assert.AreEqual(0, tr.StateBag.Count, "ViewState.Count");

            Assert.AreEqual(0, tr.Cells.Count, "Cells.Count");
            Assert.AreEqual(HorizontalAlign.NotSet, tr.HorizontalAlign, "HorizontalAlign");
            Assert.AreEqual(VerticalAlign.NotSet, tr.VerticalAlign, "VerticalAlign");
            Assert.AreEqual(TableRowSection.TableBody, tr.TableSection, "TableSection");
            Assert.AreEqual("tr", tr.Tag, "TagName");
            Assert.AreEqual(0, tr.Attributes.Count, "Attributes.Count-2");
            Assert.AreEqual(0, tr.StateBag.Count, "ViewState.Count-2");
        }
Beispiel #5
0
        public void Render_Style()
        {
            ITableRowTest tr = GetNewTestTableRow();

            tr.BackColor = Color.Aqua;
            string s = tr.Render();

            Assert.AreEqual("<tr style=\"background-color:Aqua;\">\n\n</tr>", s, "direct");

            TableItemStyle tis = new TableItemStyle();

            tis.BackColor = Color.Red;
            tr.ControlStyle.CopyFrom(tis);
            s = tr.Render();
            Assert.AreEqual("<tr style=\"background-color:Red;\">\n\n</tr>", s, "CopyFrom");
        }
Beispiel #6
0
        public void Cells()
        {
            ITableRowTest tr = GetNewTestTableRow();

            Assert.AreEqual(0, tr.Cells.Count, "0");
            TableCell td = new TableCell();

            tr.Cells.Add(td);
            Assert.AreEqual(1, tr.Cells.Count, "c1");
            Assert.AreEqual(1, tr.Controls.Count, "k1");
            string s = tr.Render();

            Assert.AreEqual(Adjust("<tr>\n\t<td></td>\n</tr>"), Adjust(s), "td-1");

            // change instance properties
            td.RowSpan = 1;
            s          = tr.Render();
            Assert.AreEqual(Adjust("<tr>\n\t<td rowspan=\"1\"></td>\n</tr>"), Adjust(s), "td-1r");

            // add it again (same instance)
            tr.Cells.Add(td);
            Assert.AreEqual(1, tr.Cells.Count, "c1bis");
            Assert.AreEqual(1, tr.Controls.Count, "k1bis");
            s = tr.Render();
            Assert.AreEqual(Adjust("<tr>\n\t<td rowspan=\"1\"></td>\n</tr>"), Adjust(s), "tr-1bis");

            td = new TableCell();
            td.VerticalAlign = VerticalAlign.Top;
            tr.Cells.Add(td);
            Assert.AreEqual(2, tr.Cells.Count, "c2");
            Assert.AreEqual(2, tr.Controls.Count, "k2");
            s = tr.Render();
            Assert.AreEqual(Adjust("<tr>\n\t<td rowspan=\"1\"></td><td valign=\"top\"></td>\n</tr>"), Adjust(s), "tr-2");

            td = new TableCell();
            td.HorizontalAlign = HorizontalAlign.Center;
            tr.Cells.Add(td);
            Assert.AreEqual(3, tr.Cells.Count, "c3");
            Assert.AreEqual(3, tr.Controls.Count, "k3");
            s = tr.Render();
            Assert.AreEqual(Adjust("<tr>\n\t<td rowspan=\"1\"></td><td valign=\"top\"></td><td align=\"center\"></td>\n</tr>"), Adjust(s), "tr-3");

            tr.HorizontalAlign = HorizontalAlign.Right;
            s = tr.Render();
            Assert.AreEqual(Adjust("<tr align=\"right\">\n\t<td rowspan=\"1\"></td><td valign=\"top\"></td><td align=\"center\"></td>\n</tr>"), Adjust(s), "tr-3a");
        }
Beispiel #7
0
        public void Render()
        {
            ITableRowTest tr = GetNewTestTableRow();
            string        s  = tr.Render();

            Assert.AreEqual("<tr>\n\n</tr>", s, "empty/default");

            // case varies with fx versions
            tr.HorizontalAlign = HorizontalAlign.Left;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" align=\"left\"") > 0), "HorizontalAlign.Left");
            tr.HorizontalAlign = HorizontalAlign.Center;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" align=\"center\"") > 0), "HorizontalAlign.Center");
            tr.HorizontalAlign = HorizontalAlign.Right;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" align=\"right\"") > 0), "HorizontalAlign.Justify");
            tr.HorizontalAlign = HorizontalAlign.Justify;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" align=\"justify\"") > 0), "HorizontalAlign.Justify");
            tr.HorizontalAlign = HorizontalAlign.NotSet;

            tr.VerticalAlign = VerticalAlign.Top;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" valign=\"top\"") > 0), "VerticalAlign.Top");
            tr.VerticalAlign = VerticalAlign.Middle;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" valign=\"middle\"") > 0), "VerticalAlign.Middle");
            tr.VerticalAlign = VerticalAlign.Bottom;
            s = tr.Render();
            Assert.IsTrue((s.ToLower().IndexOf(" valign=\"bottom\"") > 0), "VerticalAlign.Bottom");
            tr.VerticalAlign = VerticalAlign.NotSet;
#if NET_2_0
            // TableSection has no influence over the "row" rendering
            tr.TableSection = TableRowSection.TableFooter;
            s = tr.Render();
            Assert.AreEqual("<tr>\n\n</tr>", s, "TableRowSection.TableFooter");
            tr.TableSection = TableRowSection.TableHeader;
            s = tr.Render();
            Assert.AreEqual("<tr>\n\n</tr>", s, "TableRowSection.TableHeader");
            tr.TableSection = TableRowSection.TableBody;
            s = tr.Render();
            Assert.AreEqual("<tr>\n\n</tr>", s, "TableRowSection.TableBody");
#endif
        }