示例#1
0
        public void RenderEnabled()
        {
            TestImage img = new TestImage();

            img.Enabled = false;

            string html = img.Render();

            Assert.IsTrue(html.IndexOf(" disabled=\"") > 0, "#");
        }
示例#2
0
        public void RenderEnabled()
        {
            TestImage img = new TestImage();

            img.Enabled = false;

            string html = img.Render();

#if NET_4_0
            Assert.IsTrue(html.IndexOf(" class=\"aspNetDisabled\"") > 0, "#");
#else
            Assert.IsTrue(html.IndexOf(" disabled=\"") > 0, "#");
#endif
        }
示例#3
0
        public void Render()
        {
            TestImage i = new TestImage();
            // fx 2.0 (beta2) like to add: style="border-width:0px;",
            // while 1.x adds: border="0". Both aren't coming from Image
            // so we're testing subparts of the string here
            string s = i.Render();

            Assert.IsTrue(i.Render().IndexOf(" src=\"\"") > 0, "src");

            i.GenerateEmptyAlternateText = true;
            s = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" alt=\"\"") > 0, "alt/GenerateEmptyAlternateText-true");

            i.GenerateEmptyAlternateText = false;
            s = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" alt=\"\"") < 0, "alt/GenerateEmptyAlternateText-false");

            i.AlternateText = "alt";
            s = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" alt=\"alt\"") > 0, "alt");
            i.AlternateText = String.Empty;
#if NET_4_0
            s = i.Render();
            Assert.IsTrue(s.IndexOf(" class=\"aspNetDisabled\"") < 0, "enabled");
            i.Enabled = false;
            s         = i.Render();
            Assert.IsTrue(s.IndexOf(" class=\"aspNetDisabled\"") > 0, "disabled");
            i.Enabled = true;
#else
            s = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" disabled=\"disabled\"") < 0, "enabled");
            i.Enabled = false;
            s         = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" disabled=\"disabled\"") > 0, "disabled");
            i.Enabled = true;
#endif

            // note: align is in mixed-case in 1.x so we lower everything to test
            i.ImageAlign = ImageAlign.AbsBottom;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"absbottom\"") > 0, "absbottom");
            i.ImageAlign = ImageAlign.AbsMiddle;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"absmiddle\"") > 0, "absmiddle");
            i.ImageAlign = ImageAlign.Baseline;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"baseline\"") > 0, "baseline");
            i.ImageAlign = ImageAlign.Bottom;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"bottom\"") > 0, "bottom");
            i.ImageAlign = ImageAlign.Left;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"left\"") > 0, "left");
            i.ImageAlign = ImageAlign.Middle;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"middle\"") > 0, "middle");
            i.ImageAlign = ImageAlign.Right;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"right\"") > 0, "right");
            i.ImageAlign = ImageAlign.TextTop;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"texttop\"") > 0, "texttop");
            i.ImageAlign = ImageAlign.Top;
            s            = i.Render();
            Assert.IsTrue(i.Render().ToLower().IndexOf(" align=\"top\"") > 0, "top");

            i.ImageAlign = ImageAlign.NotSet;
            s            = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" align=\"") < 0, "align/none");

            i.ImageUrl = imageUrl;
            s          = i.Render();
            Assert.IsTrue(i.Render().IndexOf(" src=\"" + imageUrl + "\"") > 0, "ImageUrl");
        }
		public void Render ()
		{
			TestImage i = new TestImage ();
			// fx 2.0 (beta2) like to add: style="border-width:0px;", 
			// while 1.x adds: border="0". Both aren't coming from Image
			// so we're testing subparts of the string here
			string s = i.Render ();
#if NET_2_0
			Assert.IsTrue (i.Render ().IndexOf (" src=\"\"") > 0, "src");

			i.GenerateEmptyAlternateText = true;
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" alt=\"\"") > 0, "alt/GenerateEmptyAlternateText-true");

			i.GenerateEmptyAlternateText = false;
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" alt=\"\"") < 0, "alt/GenerateEmptyAlternateText-false");
#else
			i.DescriptionUrl = "description";
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" longdesc=\"description\"") > 0, "longdesc");
			i.DescriptionUrl = null;
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" longdesc=\"") < 0, "longdesc/none");

			Assert.IsTrue (i.Render ().IndexOf (" src=\"\"") < 0, "src"); // absent
			Assert.IsTrue (i.Render ().IndexOf (" alt=\"\"") > 0, "alt-empty"); // present
#endif
			i.AlternateText = "alt";
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" alt=\"alt\"") > 0, "alt");
			i.AlternateText = String.Empty;

			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" disabled=\"disabled\"") < 0, "enabled");
			i.Enabled = false;
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" disabled=\"disabled\"") > 0, "disabled");
			i.Enabled = true;

			// note: align is in mixed-case in 1.x so we lower everything to test
			i.ImageAlign = ImageAlign.AbsBottom;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"absbottom\"") > 0, "absbottom");
			i.ImageAlign = ImageAlign.AbsMiddle;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"absmiddle\"") > 0, "absmiddle");
			i.ImageAlign = ImageAlign.Baseline;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"baseline\"") > 0, "baseline");
			i.ImageAlign = ImageAlign.Bottom;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"bottom\"") > 0, "bottom");
			i.ImageAlign = ImageAlign.Left;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"left\"") > 0, "left");
			i.ImageAlign = ImageAlign.Middle;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"middle\"") > 0, "middle");
			i.ImageAlign = ImageAlign.Right;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"right\"") > 0, "right");
			i.ImageAlign = ImageAlign.TextTop;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"texttop\"") > 0, "texttop");
			i.ImageAlign = ImageAlign.Top;
			s = i.Render ();
			Assert.IsTrue (i.Render ().ToLower ().IndexOf (" align=\"top\"") > 0, "top");

			i.ImageAlign = ImageAlign.NotSet;
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" align=\"") < 0, "align/none");

			i.ImageUrl = imageUrl;
			s = i.Render ();
			Assert.IsTrue (i.Render ().IndexOf (" src=\"" + imageUrl + "\"") > 0, "ImageUrl");
		}
		public void RenderEnabled () {
			TestImage img = new TestImage ();
			img.Enabled = false;

			string html = img.Render ();
			Assert.IsTrue (html.IndexOf (" disabled=\"") > 0, "#");
		}
示例#6
0
文件: ImageTest.cs 项目: nobled/mono
		public void RenderEnabled () {
			TestImage img = new TestImage ();
			img.Enabled = false;

			string html = img.Render ();
#if NET_4_0
			Assert.IsTrue (html.IndexOf (" class=\"aspNetDisabled\"") > 0, "#");
#else
			Assert.IsTrue (html.IndexOf (" disabled=\"") > 0, "#");
#endif
		}