2005-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 27 Sep 2005 06:16:55 +0000 (06:16 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 27 Sep 2005 06:16:55 +0000 (06:16 -0000)
* FontUnit.cs: use a table for FontSize names, as the X{1,2}.* ones are
converted to string as X{1,2}-.*. All FontUnitTests pass now.
* Unit.cs: throw a format exception when there's not number or minus
sign in the first non-whitespace character.

svn path=/trunk/mcs/; revision=50821

mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs

index 20549275e39b008c3e70ceb3267e2fbfdb633568..159260f921ea4918e25e5ce1e54f6c96e62b630e 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * FontUnit.cs: use a table for FontSize names, as the X{1,2}.* ones are
+       converted to string as X{1,2}-.*. All FontUnitTests pass now.
+       * Unit.cs: throw a format exception when there's not number or minus
+       sign in the first non-whitespace character.
+
 2005-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * ListControl.cs: SelectedIndex/SelectedValue can be set before
index 8c45a6d0fd73b726851dde8ac93ae6157de65262..bcc682b44149bb9d0665958d86b640b02c416d33 100644 (file)
@@ -55,6 +55,9 @@ namespace System.Web.UI.WebControls {
                public static readonly FontUnit Large = new FontUnit (FontSize.Large);
                public static readonly FontUnit XLarge = new FontUnit (FontSize.XLarge);
                public static readonly FontUnit XXLarge = new FontUnit (FontSize.XXLarge);
+
+               static string [] font_size_names = new string [] {null, null, "Smaller", "Larger", "XX-Small", "X-Small", "Small",
+                                                               "Medium", "Large", "X-Large", "XX-Large" };
                
                public FontUnit (FontSize type)
                {
@@ -105,12 +108,16 @@ namespace System.Web.UI.WebControls {
                        case "smaller": type = FontSize.Smaller; break;
                        case "larger": type = FontSize.Larger; break;
                        case "xxsmall": type = FontSize.XXSmall; break;
+                       case "xx-small": type = FontSize.XXSmall; break;
                        case "xsmall": type = FontSize.XSmall; break;
+                       case "x-small": type = FontSize.XSmall; break;
                        case "small": type = FontSize.Small; break;
                        case "medium": type = FontSize.Medium; break;
                        case "large": type = FontSize.Large; break;
                        case "xlarge": type = FontSize.XLarge; break;
+                       case "x-large": type = FontSize.XLarge; break;
                        case "xxlarge": type = FontSize.XXLarge; break;
+                       case "xx-large": type = FontSize.XXLarge; break;
                        default:
                                type = FontSize.AsUnit;
                                unit = new Unit (value, culture);
@@ -188,7 +195,7 @@ namespace System.Web.UI.WebControls {
                        else if (type == FontSize.AsUnit)
                                return unit.ToString (fmt);
                        else
-                               return type.ToString();
+                               return font_size_names [(int) type];
                }
 #endif
 
@@ -200,7 +207,7 @@ namespace System.Web.UI.WebControls {
                        if (type == FontSize.AsUnit)
                                return unit.ToString (culture);
 
-                       return type.ToString ();
+                       return font_size_names [(int) type];
                }
                        
                public override string ToString ()
@@ -209,5 +216,5 @@ namespace System.Web.UI.WebControls {
                }
                
        }
-
 }
+
index 5e5e4e63d56060236d1a933352ff9a4250e6a81f..8d6dc611802f756613051222cfd193e8b94fee09 100644 (file)
@@ -85,6 +85,8 @@ namespace System.Web.UI.WebControls {
                                i++;
                                if (!Char.IsDigit (value [i]))
                                        throw new ArgumentOutOfRangeException ("value");
+                       } else if (!Char.IsDigit (value [i])) {
+                               throw new FormatException ();
                        }
 
                        double dv = 0;