public void Caption() { TestTable t = new TestTable(); t.Caption = "CaptionText"; string html = t.Render(); string orig = "<table border=\"0\"><caption>CaptionText</caption></table>"; HtmlDiff.AssertAreEqual(orig, html, "Caption"); }
public void Caption() { TestTable t = new TestTable(); t.Caption = "CaptionText"; string html = t.Render(); string orig = "<table>\n\t<caption>\n\t\tCaptionText\n\t</caption>\n</table>"; HtmlDiff.AssertAreEqual(orig, html, "Caption"); }
public void Caption() { TestTable t = new TestTable(); t.Caption = "CaptionText"; string html = t.Render(); #if NET_4_0 string orig = "<table>\n\t<caption>\n\t\tCaptionText\n\t</caption>\n</table>"; #else string orig = "<table border=\"0\">\n\t<caption>\n\t\tCaptionText\n\t</caption>\n</table>"; #endif HtmlDiff.AssertAreEqual(orig, html, "Caption"); }
public void Rows() { TestTable t = new TestTable(); Assert.AreEqual(0, t.Rows.Count, "0"); TableRow tr = new TableRow(); t.Rows.Add(tr); Assert.AreEqual(1, t.Rows.Count, "r1"); Assert.AreEqual(1, t.Controls.Count, "c1"); string s = t.Render(); Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr>\n\n\t</tr>\n</table>"), Adjust(s), "tr-1"); // change instance properties tr.HorizontalAlign = HorizontalAlign.Justify; s = t.Render(); Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr align=\"justify\">\n\n\t</tr>\n</table>"), Adjust(s), "tr-1j"); // add it again (same instance) t.Rows.Add(tr); Assert.AreEqual(1, t.Rows.Count, "t1bis"); Assert.AreEqual(1, t.Controls.Count, "c1bis"); s = t.Render(); Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr align=\"justify\">\n\n\t</tr>\n</table>"), Adjust(s), "tr-1bis"); tr.HorizontalAlign = HorizontalAlign.NotSet; tr = new TableRow(); tr.HorizontalAlign = HorizontalAlign.Justify; t.Rows.Add(tr); Assert.AreEqual(2, t.Rows.Count, "r2"); Assert.AreEqual(2, t.Controls.Count, "c2"); s = t.Render(); Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr>\n\n\t</tr><tr align=\"justify\">\n\n\t</tr>\n</table>"), Adjust(s), "tr-2"); tr = new TableRow(); tr.VerticalAlign = VerticalAlign.Bottom; t.Controls.Add(tr); Assert.AreEqual(3, t.Rows.Count, "r3"); Assert.AreEqual(3, t.Controls.Count, "c3"); s = t.Render(); Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr>\n\n\t</tr><tr align=\"justify\">\n\n\t</tr><tr valign=\"bottom\">\n\n\t</tr>\n</table>"), Adjust(s), "tr-3"); t.Caption = "caption"; s = t.Render(); Assert.AreEqual(Adjust("<table border=\"0\">\n\t<caption>\n\t\tcaption\n\t</caption><tr>\n\n\t</tr><tr align=\"justify\">\n\n\t</tr><tr valign=\"bottom\">\n\n\t</tr>\n</table>"), Adjust(s), "tr-2c"); }
public void Render() { TestTable t = new TestTable(); string s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\n</table>", s, "empty/default"); t.CellPadding = 1; s = t.Render(); Assert.AreEqual("<table cellpadding=\"1\" border=\"0\">\n\n</table>", s, "CellPadding"); t.CellPadding = -1; t.CellSpacing = 2; s = t.Render(); Assert.AreEqual("<table cellspacing=\"2\" border=\"0\">\n\n</table>", s, "CellSpacing"); t.CellSpacing = -1; t.GridLines = GridLines.Horizontal; s = t.Render(); Assert.AreEqual("<table rules=\"rows\" border=\"1\">\n\n</table>", s, "GridLines.Horizontal"); t.GridLines = GridLines.Vertical; s = t.Render(); Assert.AreEqual("<table rules=\"cols\" border=\"1\">\n\n</table>", s, "GridLines.Vertical"); t.GridLines = GridLines.Both; s = t.Render(); Assert.AreEqual("<table rules=\"all\" border=\"1\">\n\n</table>", s, "GridLines.Both"); t.GridLines = GridLines.None; t.BorderWidth = new Unit(2); s = t.Render(); Assert.IsTrue((s.IndexOf("border=\"0\"") > 0), "border=0/2"); t.GridLines = GridLines.Horizontal; s = t.Render(); Assert.IsTrue((s.IndexOf("rules=\"rows\" border=\"2\"") > 0), "2/GridLines.Horizontal"); t.GridLines = GridLines.Vertical; s = t.Render(); Assert.IsTrue((s.IndexOf("rules=\"cols\" border=\"2\"") > 0), "2/GridLines.Vertical"); t.GridLines = GridLines.Both; s = t.Render(); Assert.IsTrue((s.IndexOf("rules=\"all\" border=\"2\"") > 0), "2/GridLines.Both"); t.GridLines = GridLines.None; t.BorderWidth = new Unit(); t.HorizontalAlign = HorizontalAlign.Left; s = t.Render(); Assert.AreEqual("<table align=\"left\" border=\"0\">\n\n</table>", s.ToLower(), "HorizontalAlign.Left"); t.HorizontalAlign = HorizontalAlign.Center; s = t.Render(); Assert.AreEqual("<table align=\"center\" border=\"0\">\n\n</table>", s.ToLower(), "HorizontalAlign.Center"); t.HorizontalAlign = HorizontalAlign.Right; s = t.Render(); Assert.AreEqual("<table align=\"right\" border=\"0\">\n\n</table>", s.ToLower(), "HorizontalAlign.Right"); t.HorizontalAlign = HorizontalAlign.Justify; s = t.Render(); Assert.AreEqual("<table align=\"justify\" border=\"0\">\n\n</table>", s.ToLower(), "HorizontalAlign.Justify"); t.HorizontalAlign = HorizontalAlign.NotSet; t.Caption = "mono"; s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\t<caption>\n\t\tmono\n\t</caption>\n</table>", s.ToLower(), "Caption"); t.CaptionAlign = TableCaptionAlign.Top; s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\t<caption align=\"top\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower(), "Caption/Top"); t.CaptionAlign = TableCaptionAlign.Bottom; s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\t<caption align=\"bottom\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower(), "Caption/Bottom"); t.CaptionAlign = TableCaptionAlign.Right; s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\t<caption align=\"right\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower(), "Caption/Right"); t.CaptionAlign = TableCaptionAlign.Left; s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\t<caption align=\"left\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower(), "Caption/Left"); t.Caption = null; s = t.Render(); Assert.AreEqual("<table border=\"0\">\n\n</table>", s, "CaptionAlign without Caption"); t.CaptionAlign = TableCaptionAlign.NotSet; t.BackImageUrl = imageUrl; s = t.Render(); Assert.AreEqual("<table border=\"0\" style=\"background-image:url(http://www.mono-project.com/stylesheets/images.wiki.png);\">\n\n</table>", s, "BackImageUrl"); t.BackImageUrl = localImageUrl; s = t.Render(); Assert.AreEqual("<table border=\"0\" style=\"background-image:url(foo.jpg);\">\n\n</table>", s, "BackImageUrl"); t.BackImageUrl = String.Empty; }
public void Rows () { TestTable t = new TestTable (); Assert.AreEqual (0, t.Rows.Count, "0"); TableRow tr = new TableRow (); t.Rows.Add (tr); Assert.AreEqual (1, t.Rows.Count, "r1"); Assert.AreEqual (1, t.Controls.Count, "c1"); string s = t.Render (); Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr>\n\n\t</tr>\n</table>"), Adjust (s), "tr-1"); // change instance properties tr.HorizontalAlign = HorizontalAlign.Justify; s = t.Render (); Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr align=\"justify\">\n\n\t</tr>\n</table>"), Adjust (s), "tr-1j"); // add it again (same instance) t.Rows.Add (tr); Assert.AreEqual (1, t.Rows.Count, "t1bis"); Assert.AreEqual (1, t.Controls.Count, "c1bis"); s = t.Render (); Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr align=\"justify\">\n\n\t</tr>\n</table>"), Adjust (s), "tr-1bis"); tr.HorizontalAlign = HorizontalAlign.NotSet; tr = new TableRow (); tr.HorizontalAlign = HorizontalAlign.Justify; t.Rows.Add (tr); Assert.AreEqual (2, t.Rows.Count, "r2"); Assert.AreEqual (2, t.Controls.Count, "c2"); s = t.Render (); Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr>\n\n\t</tr><tr align=\"justify\">\n\n\t</tr>\n</table>"), Adjust (s), "tr-2"); tr = new TableRow (); tr.VerticalAlign = VerticalAlign.Bottom; t.Controls.Add (tr); Assert.AreEqual (3, t.Rows.Count, "r3"); Assert.AreEqual (3, t.Controls.Count, "c3"); s = t.Render (); Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr>\n\n\t</tr><tr align=\"justify\">\n\n\t</tr><tr valign=\"bottom\">\n\n\t</tr>\n</table>"), Adjust (s), "tr-3"); t.Caption = "caption"; s = t.Render (); Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<caption>\n\t\tcaption\n\t</caption><tr>\n\n\t</tr><tr align=\"justify\">\n\n\t</tr><tr valign=\"bottom\">\n\n\t</tr>\n</table>"), Adjust (s), "tr-2c"); }
public void Render () { TestTable t = new TestTable (); string s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\n</table>", s, "empty/default"); t.CellPadding = 1; s = t.Render (); Assert.AreEqual ("<table cellpadding=\"1\" border=\"0\">\n\n</table>", s, "CellPadding"); t.CellPadding = -1; t.CellSpacing = 2; s = t.Render (); Assert.AreEqual ("<table cellspacing=\"2\" border=\"0\">\n\n</table>", s, "CellSpacing"); t.CellSpacing = -1; t.GridLines = GridLines.Horizontal; s = t.Render (); Assert.AreEqual ("<table rules=\"rows\" border=\"1\">\n\n</table>", s, "GridLines.Horizontal"); t.GridLines = GridLines.Vertical; s = t.Render (); Assert.AreEqual ("<table rules=\"cols\" border=\"1\">\n\n</table>", s, "GridLines.Vertical"); t.GridLines = GridLines.Both; s = t.Render (); Assert.AreEqual ("<table rules=\"all\" border=\"1\">\n\n</table>", s, "GridLines.Both"); t.GridLines = GridLines.None; t.BorderWidth = new Unit (2); s = t.Render (); Assert.IsTrue ((s.IndexOf ("border=\"0\"") > 0), "border=0/2"); t.GridLines = GridLines.Horizontal; s = t.Render (); Assert.IsTrue ((s.IndexOf ("rules=\"rows\" border=\"2\"") > 0), "2/GridLines.Horizontal"); t.GridLines = GridLines.Vertical; s = t.Render (); Assert.IsTrue ((s.IndexOf ("rules=\"cols\" border=\"2\"") > 0), "2/GridLines.Vertical"); t.GridLines = GridLines.Both; s = t.Render (); Assert.IsTrue ((s.IndexOf ("rules=\"all\" border=\"2\"") > 0), "2/GridLines.Both"); t.GridLines = GridLines.None; t.BorderWidth = new Unit (); t.HorizontalAlign = HorizontalAlign.Left; s = t.Render (); Assert.AreEqual ("<table align=\"left\" border=\"0\">\n\n</table>", s.ToLower (), "HorizontalAlign.Left"); t.HorizontalAlign = HorizontalAlign.Center; s = t.Render (); Assert.AreEqual ("<table align=\"center\" border=\"0\">\n\n</table>", s.ToLower (), "HorizontalAlign.Center"); t.HorizontalAlign = HorizontalAlign.Right; s = t.Render (); Assert.AreEqual ("<table align=\"right\" border=\"0\">\n\n</table>", s.ToLower (), "HorizontalAlign.Right"); t.HorizontalAlign = HorizontalAlign.Justify; s = t.Render (); Assert.AreEqual ("<table align=\"justify\" border=\"0\">\n\n</table>", s.ToLower (), "HorizontalAlign.Justify"); t.HorizontalAlign = HorizontalAlign.NotSet; t.Caption = "mono"; s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\t<caption>\n\t\tmono\n\t</caption>\n</table>", s.ToLower (), "Caption"); t.CaptionAlign = TableCaptionAlign.Top; s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\t<caption align=\"top\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower (), "Caption/Top"); t.CaptionAlign = TableCaptionAlign.Bottom; s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\t<caption align=\"bottom\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower (), "Caption/Bottom"); t.CaptionAlign = TableCaptionAlign.Right; s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\t<caption align=\"right\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower (), "Caption/Right"); t.CaptionAlign = TableCaptionAlign.Left; s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\t<caption align=\"left\">\n\t\tmono\n\t</caption>\n</table>", s.ToLower (), "Caption/Left"); t.Caption = null; s = t.Render (); Assert.AreEqual ("<table border=\"0\">\n\n</table>", s, "CaptionAlign without Caption"); t.CaptionAlign = TableCaptionAlign.NotSet; t.BackImageUrl = imageUrl; s = t.Render (); Assert.AreEqual ("<table border=\"0\" style=\"background-image:url(http://www.mono-project.com/stylesheets/images.wiki.png);\">\n\n</table>", s, "BackImageUrl"); t.BackImageUrl = localImageUrl; s = t.Render (); Assert.AreEqual ("<table border=\"0\" style=\"background-image:url(foo.jpg);\">\n\n</table>", s, "BackImageUrl"); t.BackImageUrl = String.Empty; }
public void CaptionAlign () { TestTable t = new TestTable (); t.Caption = "CaptionText"; t.CaptionAlign = TableCaptionAlign.Left; string html = t.Render (); string orig = "<table border=\"0\"><caption align=\"Left\">CaptionText</caption></table>"; HtmlDiff.AssertAreEqual (orig, html, "CaptionAlign"); }
public void CaptionAlign () { TestTable t = new TestTable (); t.Caption = "CaptionText"; t.CaptionAlign = TableCaptionAlign.Left; string html = t.Render (); #if NET_4_0 string orig = "<table>\n\t<caption align=\"Left\">\n\t\tCaptionText\n\t</caption>\n</table>"; #else string orig = "<table border=\"0\">\n\t<caption align=\"Left\">\n\t\tCaptionText\n\t</caption>\n</table>"; #endif HtmlDiff.AssertAreEqual (orig, html, "CaptionAlign"); }
public void Caption () { TestTable t = new TestTable (); t.Caption = "CaptionText"; string html = t.Render (); string orig = "<table>\n\t<caption>\n\t\tCaptionText\n\t</caption>\n</table>"; HtmlDiff.AssertAreEqual (orig, html, "Caption"); }