public void Constructor_StateBag()
        {
            TestTableStyle ts = new TestTableStyle(new StateBag());

            Assert.IsNotNull(ts.StateBag, "StateBag");
            DefaultProperties(ts);
            NullProperties(ts);
        }
Example #2
0
        public void FillStyleAttributes_Css_WithoutResolution()
        {
            CssStyleCollection css = GetCssCollection();
            TestTableStyle     ts  = new TestTableStyle();

            ts.BackImageUrl = "http://www.go-mono.com";
            ts.Fill(css, null);
            Assert.AreEqual(1, css.Count, "Count");
            Assert.AreEqual("http://www.go-mono.com", css["background-image"], "css[string]");
            Assert.AreEqual("http://www.go-mono.com", css[HtmlTextWriterStyle.BackgroundImage], "css[HtmlTextWriterStyle]");
            Assert.AreEqual("background-image:url(http://www.go-mono.com);", css.Value, "css.Value");
        }
Example #3
0
        public void FillStyleAttributes_NotCss()
        {
            CssStyleCollection css = GetCssCollection();
            TestTableStyle     ts  = new TestTableStyle();

            ts.CellPadding     = 1;
            ts.CellSpacing     = 1;
            ts.GridLines       = GridLines.Both;
            ts.HorizontalAlign = HorizontalAlign.Justify;
            ts.Fill(css, new TestResolutionService());
            Assert.AreEqual(0, css.Count, "Count");
        }
Example #4
0
        public void GridLines_VS()
        {
            TestTableStyle ts = new TestTableStyle();

            ts.TrackVS();
            ts.GridLines = GridLines.Both;
            object o = ts.SaveVS();

            ts = new TestTableStyle();
            ts.LoadVS(o);
            Assert.AreEqual(GridLines.Both, ts.GridLines, "GL");
        }
Example #5
0
        public void CopyFrom_IsEmpty()
        {
            TestTableStyle c = new TestTableStyle();
            TableStyle     s = new TableStyle();


            s.BorderWidth = Unit.Empty;
            c.CopyFrom(s);
            Assert.IsTrue(c.Empty, "A1");

            s.GridLines = GridLines.Both;
            c.CopyFrom(s);
            Assert.IsFalse(c.Empty, "A2");
        }
Example #6
0
        private void DefaultProperties(TestTableStyle ts)
        {
            Assert.AreEqual(0, ts.StateBag.Count, "ViewState.Count");

            Assert.AreEqual(String.Empty, ts.BackImageUrl, "BackImageUrl");
            Assert.AreEqual(-1, ts.CellPadding, "CellPadding");
            Assert.AreEqual(-1, ts.CellSpacing, "CellSpacing");
            // LAMESPEC: default is document to be GridLines.Both
            Assert.AreEqual(GridLines.None, ts.GridLines, "GridLines");
            Assert.AreEqual(HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign");

            Assert.AreEqual(0, ts.StateBag.Count, "ViewState.Count-2");
            ts.Reset();
            Assert.AreEqual(0, ts.StateBag.Count, "Reset");
        }
Example #7
0
        private void NullProperties(TestTableStyle ts)
        {
            Assert.IsTrue(ts.Empty, "Empty");
            ts.BackImageUrl = String.Empty;             // doesn't accept null, see specific test
            Assert.AreEqual(String.Empty, ts.BackImageUrl, "BackImageUrl");
            Assert.IsFalse(ts.Empty, "!Empty");

            ts.CellPadding = -1;
            Assert.AreEqual(-1, ts.CellPadding, "CellPadding");
            ts.CellSpacing = -1;
            Assert.AreEqual(-1, ts.CellSpacing, "CellSpacing");
            ts.GridLines = GridLines.None;
            Assert.AreEqual(GridLines.None, ts.GridLines, "GridLines");
            ts.HorizontalAlign = HorizontalAlign.NotSet;
            Assert.AreEqual(HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign");

            Assert.AreEqual(5, ts.StateBag.Count, "ViewState.Count-1");
            ts.Reset();
            Assert.AreEqual(0, ts.StateBag.Count, "Reset");
            Assert.IsTrue(ts.Empty, "Empty/Reset");
        }
Example #8
0
		public void GridLines_VS ()
		{
			TestTableStyle ts = new TestTableStyle ();
			ts.TrackVS ();
			ts.GridLines = GridLines.Both;
			object o = ts.SaveVS ();
			ts = new TestTableStyle ();
			ts.LoadVS (o);
			Assert.AreEqual (GridLines.Both, ts.GridLines, "GL");
		}
Example #9
0
		public void MergeWith_Empty ()
		{
			TestTableStyle ts = new TestTableStyle ();
			ts.MergeWith (new TableStyle ());
			DefaultProperties (ts);
		}
Example #10
0
		public void CopyFrom_IsEmpty ()
		{
			TestTableStyle c = new TestTableStyle ();
			TableStyle s = new TableStyle ();

			
			s.BorderWidth = Unit.Empty;
			c.CopyFrom (s);
			Assert.IsTrue (c.Empty, "A1");
			
			s.GridLines = GridLines.Both;
			c.CopyFrom (s);
			Assert.IsFalse (c.Empty, "A2");
		}
Example #11
0
		public void CopyFrom_Empty ()
		{
			TestTableStyle ts = new TestTableStyle ();
			ts.CopyFrom (new TableStyle ());
			DefaultProperties (ts);
		}
Example #12
0
		public void FillStyleAttributes_Css_WithResolution ()
		{
			CssStyleCollection css = GetCssCollection ();
			TestTableStyle ts = new TestTableStyle ();
			ts.BackImageUrl = "http://www.go-mono.com";
			ts.Fill (css, new TestResolutionService ());
			Assert.AreEqual (1, css.Count, "Count");
			Assert.AreEqual ("http://www.mono-project.com", css["background-image"], "css[string]");
			Assert.AreEqual ("http://www.mono-project.com", css[HtmlTextWriterStyle.BackgroundImage], "css[HtmlTextWriterStyle]");
			Assert.AreEqual ("background-image:url(http://www.mono-project.com);", css.Value, "css.Value");
			Assert.AreEqual ("http://www.go-mono.com", ts.BackImageUrl, "BackImageUrl");
		}
Example #13
0
		public void FillStyleAttributes_Empty ()
		{
			CssStyleCollection css = GetCssCollection ();
			TestTableStyle ts = new TestTableStyle ();
			ts.Fill (css, new TestResolutionService ());
			Assert.AreEqual (0, css.Count, "Count");
		}
Example #14
0
		private void DefaultProperties (TestTableStyle ts)
		{
			Assert.AreEqual (0, ts.StateBag.Count, "ViewState.Count");

			Assert.AreEqual (String.Empty, ts.BackImageUrl, "BackImageUrl");
			Assert.AreEqual (-1, ts.CellPadding, "CellPadding");
			Assert.AreEqual (-1, ts.CellSpacing, "CellSpacing");
			// LAMESPEC: default is document to be GridLines.Both
			Assert.AreEqual (GridLines.None, ts.GridLines, "GridLines");
			Assert.AreEqual (HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign");

			Assert.AreEqual (0, ts.StateBag.Count, "ViewState.Count-2");
			ts.Reset ();
			Assert.AreEqual (0, ts.StateBag.Count, "Reset");
		}
Example #15
0
		public void FillStyleAttributes_Null_Resolver ()
		{
			TestTableStyle ts = new TestTableStyle ();
			ts.Fill (null, new TestResolutionService ());
			// no exception
		}
Example #16
0
		public void FillStyleAttributes_Css_Null ()
		{
			TestTableStyle ts = new TestTableStyle ();
			ts.Fill (GetCssCollection (), null);
			// no exception
		}
Example #17
0
		private void NullProperties (TestTableStyle ts)
		{
			Assert.IsTrue (ts.Empty, "Empty");
			ts.BackImageUrl = String.Empty; // doesn't accept null, see specific test
			Assert.AreEqual (String.Empty, ts.BackImageUrl, "BackImageUrl");
			Assert.IsFalse (ts.Empty, "!Empty");

			ts.CellPadding = -1;
			Assert.AreEqual (-1, ts.CellPadding, "CellPadding");
			ts.CellSpacing = -1;
			Assert.AreEqual (-1, ts.CellSpacing, "CellSpacing");
			ts.GridLines = GridLines.None;
			Assert.AreEqual (GridLines.None, ts.GridLines, "GridLines");
			ts.HorizontalAlign = HorizontalAlign.NotSet;
			Assert.AreEqual (HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign");

			Assert.AreEqual (5, ts.StateBag.Count, "ViewState.Count-1");
			ts.Reset ();
			Assert.AreEqual (0, ts.StateBag.Count, "Reset");
			Assert.IsTrue (ts.Empty, "Empty/Reset");
		}
Example #18
0
		public void FillStyleAttributes_NotCss ()
		{
			CssStyleCollection css = GetCssCollection ();
			TestTableStyle ts = new TestTableStyle ();
			ts.CellPadding = 1;
			ts.CellSpacing = 1;
			ts.GridLines = GridLines.Both;
			ts.HorizontalAlign = HorizontalAlign.Justify;
			ts.Fill (css, new TestResolutionService ());
			Assert.AreEqual (0, css.Count, "Count");
		}
Example #19
0
		public void Constructor_Default ()
		{
			TestTableStyle ts = new TestTableStyle ();
			DefaultProperties (ts);
			NullProperties (ts);
		}
Example #20
0
		public void SetBitCalledWhenSetProperty () {
			TestTableStyle s = new TestTableStyle ();

			s.SetBitCalledFlag = false;
			s.BackImageUrl = "http://www.mono-project.com";
			Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : BackImageUrl");
			Assert.AreEqual (0x10000, s.SetBitCalledValue, "SetBit() was called with wrong argument : BackImageUrl");

			s.SetBitCalledFlag = false;
			s.CellPadding = 1;
			Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : CellPadding");
			Assert.AreEqual (0x20000, s.SetBitCalledValue, "SetBit() was called with wrong argument : CellPadding");

			s.SetBitCalledFlag = false;
			s.CellSpacing = 1;
			Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : CellSpacing");
			Assert.AreEqual (0x40000, s.SetBitCalledValue, "SetBit() was called with wrong argument : CellSpacing");

			s.SetBitCalledFlag = false;
			s.GridLines = GridLines.Vertical;
			Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : GridLines");
			Assert.AreEqual (0x80000, s.SetBitCalledValue, "SetBit() was called with wrong argument : GridLines");

			s.SetBitCalledFlag = false;
			s.HorizontalAlign = HorizontalAlign.Right;
			Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : HorizontalAlign");
			Assert.AreEqual (0x100000, s.SetBitCalledValue, "SetBit() was called with wrong argument : HorizontalAlign");
		}
Example #21
0
		public void Constructor_StateBag ()
		{
			TestTableStyle ts = new TestTableStyle (new StateBag ());
			Assert.IsNotNull (ts.StateBag, "StateBag");
			DefaultProperties (ts);
			NullProperties (ts);
		}