Exemple #1
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");
        }
Exemple #2
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");
        }
Exemple #3
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
        }