Author: igorz
Date: 2007-11-07 11:13:09 -0500 (Wed, 07 Nov 2007)
New Revision: 89118
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ImageTest.cs
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/WebControlTest.cs
Log:
reverted r88458
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
===================================================================
---
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
2007-11-07 16:10:03 UTC (rev 89117)
+++
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
2007-11-07 16:13:09 UTC (rev 89118)
@@ -43,9 +43,12 @@
#endif
public class Image : WebControl {
+ private bool enabled; // not applicable to image
+
public Image ()
: base (HtmlTextWriterTag.Img)
{
+ enabled = true;
}
@@ -73,8 +76,8 @@
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public override bool Enabled {
- get { return base.Enabled; }
- set {base.Enabled = value; }
+ get { return enabled; }
+ set { enabled = value; }
}
// not applicable to Image
@@ -189,6 +192,9 @@
if (s.Length > 0)
writer.AddAttribute ("longdesc", s);
#endif
+ if (!enabled)
+ writer.AddAttribute
(HtmlTextWriterAttribute.Disabled, "disabled");
+ // avoid reflection
switch (ImageAlign) {
case ImageAlign.Left:
writer.AddAttribute
(HtmlTextWriterAttribute.Align, "left");
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
===================================================================
---
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
2007-11-07 16:10:03 UTC (rev 89117)
+++
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
2007-11-07 16:13:09 UTC (rev 89118)
@@ -48,7 +48,6 @@
AttributeCollection attributes;
StateBag attribute_state;
bool enabled;
- bool track_enabled_state;
public WebControl (HtmlTextWriterTag tag)
{
@@ -238,8 +237,7 @@
set {
if (enabled != value) {
- if (IsTrackingViewState)
- track_enabled_state = true;
+ ViewState ["Enabled"] = value;
enabled = value;
}
}
@@ -436,7 +434,10 @@
if (controlSrc == null)
return;
- Enabled = controlSrc.Enabled;
+ o = controlSrc.ViewState ["Enabled"];
+ if (o != null) {
+ enabled = (bool)o;
+ }
o = controlSrc.ViewState ["AccessKey"];
if (o != null)
@@ -574,9 +575,6 @@
protected override object SaveViewState ()
{
- if (track_enabled_state)
- ViewState ["Enabled"] = enabled;
-
object view_state;
object attr_view_state = null;
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
---
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2007-11-07 16:10:03 UTC (rev 89117)
+++
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2007-11-07 16:13:09 UTC (rev 89118)
@@ -1,9 +1,3 @@
-2007-10-30 Igor Zelmanovich <[EMAIL PROTECTED]>
-
- * ImageTest.cs:
- * WebControlTest.cs:
- Added new tests.
-
2007-05-27 Igor Zelmanovich <[EMAIL PROTECTED]>
* ObjectDataSourceViewTest.cs:
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ImageTest.cs
===================================================================
---
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ImageTest.cs
2007-11-07 16:10:03 UTC (rev 89117)
+++
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/ImageTest.cs
2007-11-07 16:13:09 UTC (rev 89118)
@@ -55,21 +55,6 @@
}
}
- public class PokerImage : Image
- {
- public PokerImage () {
- TrackViewState ();
- }
-
- public object SaveState () {
- return SaveViewState ();
- }
-
- public void LoadState (object state) {
- LoadViewState (state);
- }
- }
-
[TestFixture]
public class ImageTest {
@@ -96,18 +81,6 @@
}
[Test]
- public void ViewStateTest () {
-
- PokerImage src = new PokerImage ();
- src.Enabled = false;
-
- PokerImage dest = new PokerImage ();
- dest.LoadState (src.SaveState ());
-
- Assert.AreEqual (false, dest.Enabled, "Enabled");
- }
-
- [Test]
public void NullProperties ()
{
TestImage i = new TestImage ();
@@ -176,15 +149,6 @@
}
[Test]
- public void RenderEnabled () {
- TestImage img = new TestImage ();
- img.Enabled = false;
-
- string html = img.Render ();
- Assert.IsTrue (html.IndexOf (" disabled=\"") > 0, "#");
- }
-
- [Test]
public void Render ()
{
TestImage i = new TestImage ();
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/WebControlTest.cs
===================================================================
---
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/WebControlTest.cs
2007-11-07 16:10:03 UTC (rev 89117)
+++
branches/mainsoft/gh20/mcs/class/System.Web/Test/System.Web.UI.WebControls/WebControlTest.cs
2007-11-07 16:13:09 UTC (rev 89118)
@@ -439,14 +439,6 @@
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");
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches