예제 #1
0
        public void EnabledViewState()
        {
            WebControlTestClass c = new WebControlTestClass();

            c.SetTrackingVS();
            c.Enabled = false;
            object o = c.Save();

            c = new WebControlTestClass();
            c.Load(o);
            Assert.IsFalse(c.Enabled, "not enabled");
        }
예제 #2
0
        public void EnabledViewState2()
        {
            WebControlTestClass c = new WebControlTestClass();

            c.Enabled = false;
            c.SetTrackingVS();
            c.Width = 100;             // to cause saveviewstate return not null
            object o = c.Save();

            c         = new WebControlTestClass();
            c.Enabled = false;
            c.Load(o);
            Assert.IsFalse(c.Enabled, "not enabled");
        }
예제 #3
0
        public void CopyEnabled()
        {
            Label l = new Label(), ll = new Label();

            l.Enabled = false;
            ll.CopyBaseAttributes(l);
            Assert.IsFalse(ll.Enabled, "enabled should be copied");

            WebControlTestClass c = new WebControlTestClass();

            c.SetTrackingVS();
            c.CopyBaseAttributes(l);
            object o = c.Save();

            c = new WebControlTestClass();
            c.Load(o);
            Assert.IsFalse(c.Enabled, "enabled should be copied#2");
        }
예제 #4
0
        public void ViewState()
        {
            WebControlTestClass w;
            WebControlTestClass w_copy;
            object state;

            w      = new WebControlTestClass(HtmlTextWriterTag.Xml);
            w_copy = new WebControlTestClass(HtmlTextWriterTag.Xml);

            w.SetTrackingVS();
            w.BackColor          = Color.Red;
            w.Attributes["test"] = "testme";
            w.BorderColor        = Color.Green;
            w.BorderStyle        = BorderStyle.Dotted;
            w.BorderWidth        = new Unit("12px");
            w.Enabled            = false;
            w.ForeColor          = Color.BlueViolet;
            w.Height             = new Unit(6.5);
            w.TabIndex           = 10;
            w.ToolTip            = "I am a tip";
            w.Width   = new Unit(6.5, UnitType.Cm);
            w.Enabled = true;
            w.Attributes["PrivateTag"] = "blah";
            w.Attributes["Style"]      = "background-color: #ff00ff";

            state = w.Save();

            w_copy.Load(state);
            w_copy.SetTrackingVS();

            /* MS: <xml tabindex="10" title="I am a tip" test="testme" PrivateTag="blah"
             *      style="color:BlueViolet;background-color:Red;border-color:Green;border-width:12px;border-style:Dotted;height:6px;width:6.5cm;background-color: #ff00ff">
             *      </xml>
             */
            HtmlDiff.AssertAreEqual(w.Render(), w_copy.Render(), "VS1");
        }
예제 #5
0
		public void EnabledViewState2 () {
			WebControlTestClass c = new WebControlTestClass ();
			c.Enabled = false;
			c.SetTrackingVS ();
			c.Width = 100; // to cause saveviewstate return not null
			object o = c.Save ();
			c = new WebControlTestClass ();
			c.Enabled = false;
			c.Load (o);
			Assert.IsFalse (c.Enabled, "not enabled");
		}
예제 #6
0
		public void EnabledViewState ()
		{
			WebControlTestClass c = new WebControlTestClass ();
			c.SetTrackingVS ();
			c.Enabled = false;
			object o = c.Save ();
			c = new WebControlTestClass ();
			c.Load (o);
			Assert.IsFalse (c.Enabled, "not enabled");
		}
예제 #7
0
		public void ViewState() {
			WebControlTestClass	w;
			WebControlTestClass	w_copy;
			object			state;

			w = new WebControlTestClass(HtmlTextWriterTag.Xml);
			w_copy = new WebControlTestClass(HtmlTextWriterTag.Xml);

			w.SetTrackingVS ();
			w.BackColor = Color.Red;
			w.Attributes["test"] = "testme";
			w.BorderColor = Color.Green;
			w.BorderStyle = BorderStyle.Dotted;
			w.BorderWidth = new Unit("12px");
			w.Enabled = false;
			w.ForeColor = Color.BlueViolet;
			w.Height = new Unit(6.5);
			w.TabIndex = 10;
			w.ToolTip = "I am a tip";
			w.Width = new Unit(6.5, UnitType.Cm);
			w.Enabled = true;
			w.Attributes["PrivateTag"] = "blah";
			w.Attributes["Style"] = "background-color: #ff00ff";

			state = w.Save();

			w_copy.Load(state);
			w_copy.SetTrackingVS();
			/* MS: <xml tabindex="10" title="I am a tip" test="testme" PrivateTag="blah" 
				style="color:BlueViolet;background-color:Red;border-color:Green;border-width:12px;border-style:Dotted;height:6px;width:6.5cm;background-color: #ff00ff">
				</xml>
			*/
			HtmlDiff.AssertAreEqual (w.Render(), w_copy.Render(), "VS1");
		}
예제 #8
0
		public void CopyEnabled ()
		{
			Label l = new Label (), ll = new Label ();
			l.Enabled = false;
			ll.CopyBaseAttributes (l);
			Assert.IsFalse (ll.Enabled, "enabled should be copied");

			WebControlTestClass c = new WebControlTestClass ();
			c.SetTrackingVS ();
			c.CopyBaseAttributes (l);
			object o = c.Save ();
			c = new WebControlTestClass ();
			c.Load (o);
			Assert.IsFalse (c.Enabled, "enabled should be copied#2");
		}
예제 #9
0
		void RunAssignmentTests ()
		{
			WebControlTestClass	w;

			w = new WebControlTestClass(HtmlTextWriterTag.Small);

			w.BackColor = Color.Red;
			Assert.AreEqual (Color.Red, w.BackColor, "A1");

			w.Attributes["test"] = "testme";
			Assert.AreEqual (1, w.Attributes.Count, "A2");
			Assert.AreEqual ("testme", w.Attributes["test"], "A3");

			w.BorderColor = Color.Green;
			Assert.AreEqual (Color.Green, w.BorderColor, "A4");

			w.BorderStyle = BorderStyle.Dotted;
			Assert.AreEqual (BorderStyle.Dotted, w.BorderStyle, "A5");

			w.BorderWidth = new Unit("12px");
			Assert.AreEqual (12, w.BorderWidth.Value, "A6");

			Assert.AreEqual (string.Empty, w.CssClass, "A7");

			w.Enabled = false;
			Assert.AreEqual (false, w.Enabled, "A8");

			w.ForeColor = Color.BlueViolet;
			Assert.AreEqual (Color.BlueViolet, w.ForeColor, "A9");

			w.Height = new Unit(6.5);
			Assert.AreEqual (6, w.Height.Value, "A10");

			Assert.AreEqual (0, w.Style.Count, "A11");

			w.TabIndex = 10;
			Assert.AreEqual (10, w.TabIndex, "A12");

			w.ToolTip = "I am a tip";
			Assert.AreEqual ("I am a tip", w.ToolTip, "A13");

			w.Width = new Unit(6.5, UnitType.Cm);
			Assert.AreEqual (6.5, w.Width.Value, "A14");

			Assert.AreEqual(false, w.IsTrackingVS (), "A15");
			w.SetTrackingVS ();
			Assert.AreEqual(true, w.IsTrackingVS (), "A16");

			w.Enabled = true;
			Assert.AreEqual(true, w.Enabled, "A17");
			w.Save();

			w.Attributes["PrivateTag"] = "blah";
			Assert.AreEqual(2, w.Attributes.Count, "A18");

			w.Attributes.Clear();
			w.Attributes["Style"] = "background-color: #ff00ff";
			Assert.AreEqual(1, w.Attributes.Count, "A19");
			Assert.AreEqual(1, w.Style.Count, "A20");

			w.Attributes.Clear();
			w.Attributes.Add("Style", "foreground-color=#ff00ff");
			Assert.AreEqual(1, w.Attributes.Count, "A21");
			Assert.AreEqual(0, w.Style.Count, "A22");

			w.Attributes.Clear();
			w.Attributes.Add("Style", "background: black; text-align: left;");
			Assert.AreEqual(1, w.Attributes.Count, "A23");
			Assert.AreEqual(2, w.Style.Count, "A24");

			w.Attributes["Style"] = "background: black; text-align: left; foreground: white;";
			Assert.AreEqual(1, w.Attributes.Count, "A25");
			Assert.AreEqual(3, w.Style.Count, "A26");

			w.Style["background-color"] = Color.Purple.ToString();
			Assert.AreEqual(4, w.Style.Count, "A27");

			w.AccessKey = "I";
			Assert.AreEqual("I", w.AccessKey, "A28");

			// Check the bag
			string[]	expect = {
							  "BorderStyle=Dotted",
							  "Width=6.5cm",
							  "Height=6px",
							  "BorderWidth=12px",
							  "ForeColor=Color [BlueViolet]",
							  "BorderColor=Color [Green]",
							  "ToolTip=I am a tip",
							  "BackColor=Color [Red]",
							  "TabIndex=10",
							  "AccessKey=I",
							  "Enabled=True" };

			IsEqual(expect, w.KeyValuePairs(), "A29");
		}
예제 #10
0
        void RunAssignmentTests()
        {
            WebControlTestClass w;

            w = new WebControlTestClass(HtmlTextWriterTag.Small);

            w.BackColor = Color.Red;
            Assert.AreEqual(Color.Red, w.BackColor, "A1");

            w.Attributes["test"] = "testme";
            Assert.AreEqual(1, w.Attributes.Count, "A2");
            Assert.AreEqual("testme", w.Attributes["test"], "A3");

            w.BorderColor = Color.Green;
            Assert.AreEqual(Color.Green, w.BorderColor, "A4");

            w.BorderStyle = BorderStyle.Dotted;
            Assert.AreEqual(BorderStyle.Dotted, w.BorderStyle, "A5");

            w.BorderWidth = new Unit("12px");
            Assert.AreEqual(12, w.BorderWidth.Value, "A6");

            Assert.AreEqual(string.Empty, w.CssClass, "A7");

            w.Enabled = false;
            Assert.AreEqual(false, w.Enabled, "A8");

            w.ForeColor = Color.BlueViolet;
            Assert.AreEqual(Color.BlueViolet, w.ForeColor, "A9");

            w.Height = new Unit(6.5);
            Assert.AreEqual(6, w.Height.Value, "A10");

            Assert.AreEqual(0, w.Style.Count, "A11");

            w.TabIndex = 10;
            Assert.AreEqual(10, w.TabIndex, "A12");

            w.ToolTip = "I am a tip";
            Assert.AreEqual("I am a tip", w.ToolTip, "A13");

            w.Width = new Unit(6.5, UnitType.Cm);
            Assert.AreEqual(6.5, w.Width.Value, "A14");

            Assert.AreEqual(false, w.IsTrackingVS(), "A15");
            w.SetTrackingVS();
            Assert.AreEqual(true, w.IsTrackingVS(), "A16");

            w.Enabled = true;
            Assert.AreEqual(true, w.Enabled, "A17");
            w.Save();

            w.Attributes["PrivateTag"] = "blah";
            Assert.AreEqual(2, w.Attributes.Count, "A18");

            w.Attributes.Clear();
            w.Attributes["Style"] = "background-color: #ff00ff";
            Assert.AreEqual(1, w.Attributes.Count, "A19");
            Assert.AreEqual(1, w.Style.Count, "A20");

            w.Attributes.Clear();
            w.Attributes.Add("Style", "foreground-color=#ff00ff");
            Assert.AreEqual(1, w.Attributes.Count, "A21");
            Assert.AreEqual(0, w.Style.Count, "A22");

            w.Attributes.Clear();
            w.Attributes.Add("Style", "background: black; text-align: left;");
            Assert.AreEqual(1, w.Attributes.Count, "A23");
            Assert.AreEqual(2, w.Style.Count, "A24");

            w.Attributes["Style"] = "background: black; text-align: left; foreground: white;";
            Assert.AreEqual(1, w.Attributes.Count, "A25");
            Assert.AreEqual(3, w.Style.Count, "A26");

            w.Style["background-color"] = Color.Purple.ToString();
            Assert.AreEqual(4, w.Style.Count, "A27");

            w.AccessKey = "I";
            Assert.AreEqual("I", w.AccessKey, "A28");

            // Check the bag
            string[] expect =
            {
                "BorderStyle=Dotted",
                "Width=6.5cm",
                "Height=6px",
                "BorderWidth=12px",
                "ForeColor=Color [BlueViolet]",
                "BorderColor=Color [Green]",
                "ToolTip=I am a tip",
                "BackColor=Color [Red]",
                "TabIndex=10",
                "AccessKey=I",
                "Enabled=True"
            };

            IsEqual(expect, w.KeyValuePairs(), "A29");
        }