Author: gert
Date: 2006-12-26 11:40:28 -0500 (Tue, 26 Dec 2006)
New Revision: 70085

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs
Log:
* DataGridViewCellStyleTest.cs: Added tests for FormatProvider,
IsFormatProviderDefault.
* DataGridViewTest.cs: Reworked ColumnCount, ColumnHeadersHeight,
RowHeaderWidth tests. Added DefaultSize, *DefaultCellStyle tests.
* DataGridView.cs: Fixed GridColor, DefaultSize, DefaultCellStyle,
RowHeadersDefaultStyle, RowHeadersWidth to match MS. Throw
ArgumentOutOfRangeException if ColumnCount is negative. In
ColumnHeadersHeight, throw ArgumentOutOfRangeException if height is
less than 4 or higher than 32768.
* DataGridViewCellStyle.cs: Fixed default value for NullValue.
Fixed FormatProvider to return CurrentCulture unless explicitly set.
Fixed IsFormatProviderDefault to return true if FormatProvider has
not been explicitly set.


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-26 16:38:27 UTC (rev 70084)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-26 16:40:28 UTC (rev 70085)
@@ -1,3 +1,15 @@
+2006-12-26  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * DataGridView.cs: Fixed GridColor, DefaultSize, DefaultCellStyle,
+       RowHeadersDefaultStyle, RowHeadersWidth to match MS. Throw
+       ArgumentOutOfRangeException if ColumnCount is negative. In 
+       ColumnHeadersHeight, throw ArgumentOutOfRangeException if height is
+       less than 4 or higher than 32768.
+       * DataGridViewCellStyle.cs: Fixed default value for NullValue.
+       Fixed FormatProvider to return CurrentCulture unless explicitly set.
+       Fixed IsFormatProviderDefault to return true if FormatProvider has
+       not been explicitly set.
+
 2006-12-25  Chris Toshok  <[EMAIL PROTECTED]>
 
        * Application.cs: add a couple of 2.0 events.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs  
2006-12-26 16:38:27 UTC (rev 70084)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs  
2006-12-26 16:40:28 UTC (rev 70085)
@@ -84,7 +84,7 @@
                private int firstDisplayedScrollingColumnHiddenWidth;
                private int firstDisplayedScrollingColumnIndex;
                private int firstDisplayedScrollingRowIndex;
-               private Color gridColor = 
Color.FromKnownColor(KnownColor.ControlDarkDark);
+               private Color gridColor = 
Color.FromKnownColor(KnownColor.ControlDark);
                private int horizontalScrollingOffset;
                private bool isCurrentCellDirty;
                //private bool isCurrentRowDirty;
@@ -111,7 +111,6 @@
                private Cursor userSetCursor;
                private int verticalScrollingOffset;
                private bool virtualMode;
-               private Size defaultSize;
                private HScrollBar horizontalScrollBar;
                private VScrollBar verticalScrollBar;
 
@@ -156,14 +155,21 @@
                        columns = CreateColumnsInstance();
                        columns.CollectionChanged += OnColumnCollectionChanged;
                        dataMember = String.Empty;
-                       defaultCellStyle = (DataGridViewCellStyle) 
columnHeadersDefaultCellStyle.Clone();
+                       defaultCellStyle = new DataGridViewCellStyle();
+                       defaultCellStyle.BackColor = SystemColors.Window;
+                       defaultCellStyle.ForeColor = SystemColors.ControlText;
+                       defaultCellStyle.SelectionBackColor = 
SystemColors.Highlight;
+                       defaultCellStyle.SelectionForeColor = 
SystemColors.HighlightText;
+                       defaultCellStyle.Font = this.Font;
+                       defaultCellStyle.Alignment = 
DataGridViewContentAlignment.MiddleLeft;
+                       defaultCellStyle.WrapMode = DataGridViewTriState.False;
                        editMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
                        multiSelect = true;
                        readOnly = false;
                        rowHeadersBorderStyle = 
DataGridViewHeaderBorderStyle.Single;
-                       rowHeadersDefaultCellStyle = (DataGridViewCellStyle) 
defaultCellStyle.Clone();
+                       rowHeadersDefaultCellStyle = (DataGridViewCellStyle) 
columnHeadersDefaultCellStyle.Clone ();
                        rowHeadersVisible = true;
-                       rowHeadersWidth = 43;
+                       rowHeadersWidth = 41;
                        rowHeadersWidthSizeMode = 
DataGridViewRowHeadersWidthSizeMode.EnableResizing;
                        rows = CreateRowsInstance();
                        rowsDefaultCellStyle = new DataGridViewCellStyle();
@@ -438,7 +444,8 @@
                        get { return columns.Count; }
                        set {
                                if (value < 0) {
-                                       throw new 
ArgumentException("ColumnCount must be >= 0.");
+                                       throw new 
ArgumentOutOfRangeException("ColumnCount", 
+                                               "ColumnCount must be >= 0.");
                                }
                                if (dataSource != null) {
                                        throw new 
InvalidOperationException("Cant change column count if DataSource is set.");
@@ -486,8 +493,13 @@
                        set {
                                if (columnHeadersHeight != value) {
                                        if (value < 4) {
-                                               throw new 
ArgumentException("Column headers height cant be less than 4.");
+                                               throw new 
ArgumentOutOfRangeException("ColumnHeadersHeight", 
+                                                       "Column headers height 
cant be less than 4.");
                                        }
+                                       if (value > 32768 ) {
+                                               throw new 
ArgumentOutOfRangeException("ColumnHeadersHeight", 
+                                                       "Column headers height 
cannot be more than 32768.");
+                                       }
                                        columnHeadersHeight = value;
                                        
OnColumnHeadersHeightChanged(EventArgs.Empty);
                                }
@@ -891,8 +903,13 @@
                        set {
                                if (rowHeadersWidth != value) {
                                        if (value < 4) {
-                                               throw new 
ArgumentException("RowHeadersWidth cant be less than 4.");
+                                               throw new 
ArgumentOutOfRangeException("RowHeadersWidth", 
+                                                       "Row headers width cant 
be less than 4.");
                                        }
+                                       if (value > 32768 ) {
+                                               throw new 
ArgumentOutOfRangeException("RowHeadersWidth", 
+                                                       "Row headers width 
cannot be more than 32768.");
+                                       }
                                        rowHeadersWidth = value;
                                        
OnRowHeadersWidthChanged(EventArgs.Empty);
                                }
@@ -2181,7 +2198,7 @@
                }
 
                protected override Size DefaultSize {
-                       get { return defaultSize; }
+                       get { return new Size (240, 150); }
                }
 
                protected ScrollBar HorizontalScrollBar {

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs
 2006-12-26 16:38:27 UTC (rev 70084)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs
 2006-12-26 16:40:28 UTC (rev 70085)
@@ -28,6 +28,7 @@
 
 using System.Drawing;
 using System.ComponentModel;
+using System.Globalization;
 
 namespace System.Windows.Forms {
 
@@ -57,8 +58,7 @@
                        font = null;
                        foreColor = Color.Empty;
                        format = String.Empty;
-                       formatProvider =  
System.Globalization.CultureInfo.CurrentUICulture;
-                       nullValue = "(null)";
+                       nullValue = string.Empty;
                        padding = Padding.Empty;
                        selectionBackColor = Color.Empty;
                        selectionForeColor = Color.Empty;
@@ -145,7 +145,11 @@
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Advanced)]
                public IFormatProvider FormatProvider {
-                       get { return formatProvider; }
+                       get {
+                               if (formatProvider == null)
+                                       return CultureInfo.CurrentCulture;
+                               return formatProvider;
+                       }
                        set {
                                if (formatProvider != value) {
                                        formatProvider = value;
@@ -163,7 +167,7 @@
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Advanced)]
                public bool IsFormatProviderDefault {
-                       get { return formatProvider == 
System.Globalization.CultureInfo.CurrentUICulture; }
+                       get { return formatProvider == null; }
                }
 
                [Browsable (false)]
@@ -171,7 +175,7 @@
                public bool IsNullValueDefault {
                        get {
                                if (nullValue is string) {
-                                       return (string) nullValue == "(null)";
+                                       return (string) nullValue == 
string.Empty;
                                }
                                return false;
                        }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-12-26 16:38:27 UTC (rev 70084)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-12-26 16:40:28 UTC (rev 70085)
@@ -1,3 +1,10 @@
+2006-12-26  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * DataGridViewCellStyleTest.cs: Added tests for FormatProvider,
+       IsFormatProviderDefault.
+       * DataGridViewTest.cs: Reworked ColumnCount, ColumnHeadersHeight,
+       RowHeaderWidth tests. Added DefaultSize, *DefaultCellStyle tests.
+
 2006-12-23  Gert Driesen  <[EMAIL PROTECTED]>
 
        * DateTimePickerTest.cs: Fixed line endings.    

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs
        2006-12-26 16:38:27 UTC (rev 70084)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs
        2006-12-26 16:40:28 UTC (rev 70085)
@@ -33,6 +33,7 @@
 using System.ComponentModel;
 using System.Collections;
 using System.Globalization;
+using System.Threading;
 
 namespace MonoTests.System.Windows.Forms {
 
@@ -46,11 +47,6 @@
                        style = new DataGridViewCellStyle();
                }
 
-               [TearDown]
-               public void Clean() {
-                       style = new DataGridViewCellStyle();
-               }
-
                [Test]
                public void TestDefaultValues () {
                        Assert.AreEqual (DataGridViewContentAlignment.NotSet, 
style.Alignment, "#A1");
@@ -58,8 +54,6 @@
                        Assert.AreEqual (null, style.Font, "#A3");
                        Assert.AreEqual (Color.Empty, style.ForeColor, "#A4");
                        Assert.AreEqual (String.Empty, style.Format, "#A5");
-                       Assert.AreEqual (CultureInfo.CurrentUICulture, 
style.FormatProvider, "#A6");
-                       Assert.AreEqual (true, style.IsFormatProviderDefault, 
"#A7");
                        Assert.AreEqual (true, style.IsNullValueDefault, "#A8");
                        Assert.AreEqual (string.Empty, style.NullValue, "#A9");
                        Assert.AreEqual (Color.Empty, style.SelectionBackColor, 
"#A10");
@@ -98,6 +92,52 @@
                public void TestWrapModeInvalidEnumArgumentException () {
                        style.WrapMode = (DataGridViewTriState) 3;
                }
+
+               [Test]
+               public void FormatProvider ()
+               {
+                       CultureInfo orignalCulture = CultureInfo.CurrentCulture;
+                       CultureInfo orignalUICulture = 
CultureInfo.CurrentUICulture;
+
+                       try {
+                               Thread.CurrentThread.CurrentCulture = new 
CultureInfo ("nl-BE");
+                               Thread.CurrentThread.CurrentUICulture = new 
CultureInfo ("ja-JP");
+                               Assert.AreSame (CultureInfo.CurrentCulture, 
style.FormatProvider, "#1");
+                               Thread.CurrentThread.CurrentCulture = new 
CultureInfo ("fr-FR");
+                               Assert.AreSame (CultureInfo.CurrentCulture, 
style.FormatProvider, "#2");
+                               style.FormatProvider = 
CultureInfo.CurrentCulture;
+                               Assert.AreSame (CultureInfo.CurrentCulture, 
style.FormatProvider, "#3");
+                               Thread.CurrentThread.CurrentCulture = new 
CultureInfo ("en-US");
+                               Assert.AreEqual (new CultureInfo ("fr-FR"), 
style.FormatProvider, "#4");
+                               style.FormatProvider = null;
+                               Assert.AreSame (CultureInfo.CurrentCulture, 
style.FormatProvider, "#5");
+                       } finally {
+                               Thread.CurrentThread.CurrentCulture = 
orignalCulture;
+                               Thread.CurrentThread.CurrentUICulture = 
orignalUICulture;
+                       }
+               }
+
+               [Test]
+               public void IsFormatProviderDefault ()
+               {
+                       CultureInfo orignalCulture = CultureInfo.CurrentCulture;
+
+                       try {
+                               Assert.IsTrue (style.IsFormatProviderDefault, 
"#1");
+                               Thread.CurrentThread.CurrentCulture = new 
CultureInfo ("nl-BE");
+                               Assert.IsTrue (style.IsFormatProviderDefault, 
"#2");
+                               Thread.CurrentThread.CurrentCulture = new 
CultureInfo ("fr-FR");
+                               Assert.IsTrue (style.IsFormatProviderDefault, 
"#3");
+                               style.FormatProvider = 
CultureInfo.CurrentCulture;
+                               Assert.IsFalse (style.IsFormatProviderDefault, 
"#4");
+                               style.FormatProvider = new CultureInfo 
("en-US");
+                               Assert.IsFalse (style.IsFormatProviderDefault, 
"#5");
+                               style.FormatProvider = null;
+                               Assert.IsTrue (style.IsFormatProviderDefault, 
"#6");
+                       } finally {
+                               Thread.CurrentThread.CurrentCulture = 
orignalCulture;
+                       }
+               }
        }
 }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs
 2006-12-26 16:38:27 UTC (rev 70084)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs
 2006-12-26 16:40:28 UTC (rev 70085)
@@ -67,24 +67,9 @@
                        Assert.AreEqual (SystemColors.AppWorkspace, 
grid.BackgroundColor, "#A10");
                        Assert.AreEqual (BorderStyle.FixedSingle, 
grid.BorderStyle, "#A11");
                        Assert.AreEqual 
(DataGridViewClipboardCopyMode.EnableWithAutoHeaderText, 
grid.ClipboardCopyMode, "#A12");
-                       Assert.AreEqual (SystemColors.Control, 
grid.ColumnHeadersDefaultCellStyle.BackColor, "#A13");
-                       Assert.AreEqual (SystemColors.WindowText,  
grid.ColumnHeadersDefaultCellStyle.ForeColor, "#A14");
-                       Assert.AreEqual (SystemColors.Highlight, 
grid.ColumnHeadersDefaultCellStyle.SelectionBackColor, "#A15");
-                       Assert.AreEqual (SystemColors.HighlightText, 
grid.ColumnHeadersDefaultCellStyle.SelectionForeColor, "#A16");
-                       Assert.AreEqual (grid.Font, 
grid.ColumnHeadersDefaultCellStyle.Font, "#A17");
-                       Assert.AreEqual 
(DataGridViewContentAlignment.MiddleLeft, 
grid.ColumnHeadersDefaultCellStyle.Alignment, "#A18");
-                       Assert.AreEqual (DataGridViewTriState.True, 
grid.ColumnHeadersDefaultCellStyle.WrapMode, "#A19");
-                       Assert.AreEqual (23, grid.ColumnHeadersHeight, "#A20");
                        Assert.AreEqual 
(DataGridViewColumnHeadersHeightSizeMode.EnableResizing, 
grid.ColumnHeadersHeightSizeMode, "#A21");
                        Assert.AreEqual (true, grid.ColumnHeadersVisible, 
"#A22");
                        Assert.AreEqual (String.Empty, grid.DataMember, "#A23");
-                       Assert.AreEqual (SystemColors.Window, 
grid.DefaultCellStyle.BackColor, "#A24");
-                       Assert.AreEqual (SystemColors.ControlText,  
grid.DefaultCellStyle.ForeColor, "#A25");
-                       Assert.AreEqual (SystemColors.Highlight, 
grid.DefaultCellStyle.SelectionBackColor, "#A26");
-                       Assert.AreEqual (SystemColors.HighlightText, 
grid.DefaultCellStyle.SelectionForeColor, "#A27");
-                       Assert.AreEqual (grid.Font, grid.DefaultCellStyle.Font, 
"#A28");
-                       Assert.AreEqual 
(DataGridViewContentAlignment.MiddleLeft, grid.DefaultCellStyle.Alignment, 
"#A29");
-                       Assert.AreEqual (DataGridViewTriState.False, 
grid.DefaultCellStyle.WrapMode, "#A30");
                        Assert.AreEqual 
(DataGridViewEditMode.EditOnKeystrokeOrF2, grid.EditMode, "#A31");
                        Assert.AreEqual (Control.DefaultFont, grid.Font, 
"#A32");
                        Assert.AreEqual (Control.DefaultForeColor, 
grid.ForeColor, "#A33");
@@ -177,10 +162,20 @@
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentOutOfRangeException))]
-               public void TestColumnCountArgumentOutOfRangeException () {
+               public void ColumnCount () {
                        DataGridView grid = new DataGridView();
-                       grid.ColumnCount = -1;
+                       Assert.AreEqual (0, grid.ColumnCount, "#A1");
+
+                       try {
+                               grid.ColumnCount = -1;
+                               Assert.Fail ("#B1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.Message, "#B3");
+                               Assert.IsNotNull (ex.ParamName, "#B4");
+                               Assert.AreEqual ("ColumnCount", ex.ParamName, 
"#B5");
+                               Assert.IsNull (ex.InnerException, "#B6");
+                       }
                }
 
                [Test]
@@ -192,10 +187,35 @@
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentOutOfRangeException))]
-               public void TestColumnHeadersHeightArgumentOutOfRangeException 
() {
+               public void ColumnHeadersHeight () {
                        DataGridView grid = new DataGridView();
-                       grid.ColumnHeadersHeight = 3;
+                       Assert.AreEqual (23, grid.ColumnHeadersHeight, "#A1");
+                       grid.ColumnHeadersHeight = 4;
+                       Assert.AreEqual (4, grid.ColumnHeadersHeight, "#A2");
+                       grid.ColumnHeadersHeight = 32768;
+                       Assert.AreEqual (32768, grid.ColumnHeadersHeight, 
"#A3");
+
+                       try {
+                               grid.ColumnHeadersHeight = 3;
+                               Assert.Fail ("#B1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.Message, "#B3");
+                               Assert.IsNotNull (ex.ParamName, "#B4");
+                               Assert.AreEqual ("ColumnHeadersHeight", 
ex.ParamName, "#B5");
+                               Assert.IsNull (ex.InnerException, "#B6");
+                       }
+
+                       try {
+                               grid.ColumnHeadersHeight = 32769;
+                               Assert.Fail ("#C1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#C2");
+                               Assert.IsNotNull (ex.Message, "#C3");
+                               Assert.IsNotNull (ex.ParamName, "#C4");
+                               Assert.AreEqual ("ColumnHeadersHeight", 
ex.ParamName, "#C5");
+                               Assert.IsNull (ex.InnerException, "#C6");
+                       }
                }
 
                [Test]
@@ -206,10 +226,35 @@
                }
 
                [Test]
-               [ExpectedException(typeof(ArgumentOutOfRangeException))]
-               public void TestRowHeadersWidthArgumentOutOfRangeException () {
+               public void RowHeadersWidth () {
                        DataGridView grid = new DataGridView();
-                       grid.RowHeadersWidth = 3;
+                       Assert.AreEqual (41, grid.RowHeadersWidth, "#A1");
+                       grid.RowHeadersWidth = 4;
+                       Assert.AreEqual (4, grid.RowHeadersWidth, "#A2");
+                       grid.RowHeadersWidth = 32768;
+                       Assert.AreEqual (32768, grid.RowHeadersWidth, "#A3");
+
+                       try {
+                               grid.RowHeadersWidth = 3;
+                               Assert.Fail ("#B1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNotNull (ex.Message, "#B3");
+                               Assert.IsNotNull (ex.ParamName, "#B4");
+                               Assert.AreEqual ("RowHeadersWidth", 
ex.ParamName, "#B5");
+                               Assert.IsNull (ex.InnerException, "#B6");
+                       }
+
+                       try {
+                               grid.RowHeadersWidth = 32769;
+                               Assert.Fail ("#C1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#C2");
+                               Assert.IsNotNull (ex.Message, "#C3");
+                               Assert.IsNotNull (ex.ParamName, "#C4");
+                               Assert.AreEqual ("RowHeadersWidth", 
ex.ParamName, "#C5");
+                               Assert.IsNull (ex.InnerException, "#C6");
+                       }
                }
 
                [Test]
@@ -262,6 +307,73 @@
                        DataGridView grid = new DataGridView();
                        grid.AutoResizeRows(DataGridViewAutoSizeRowsMode.None);
                }
+
+               [Test]
+               public void DefaultSize ()
+               {
+                       MockDataGridView grid = new MockDataGridView ();
+                       Assert.AreEqual (new Size (240, 150), 
grid.default_size, "#1");
+                       Assert.AreEqual (new Size (240, 150), grid.Size, "#2");
+               }
+
+               [Test]
+               public void ColumnHeadersDefaultCellStyle ()
+               {
+                       DataGridView grid = new DataGridView();
+                       Assert.AreEqual (SystemColors.Control, 
grid.ColumnHeadersDefaultCellStyle.BackColor, "#A1");
+                       Assert.AreEqual (SystemColors.WindowText,  
grid.ColumnHeadersDefaultCellStyle.ForeColor, "#A2");
+                       Assert.AreEqual (SystemColors.Highlight, 
grid.ColumnHeadersDefaultCellStyle.SelectionBackColor, "#A3");
+                       Assert.AreEqual (SystemColors.HighlightText, 
grid.ColumnHeadersDefaultCellStyle.SelectionForeColor, "#A4");
+                       Assert.AreSame (grid.Font, 
grid.ColumnHeadersDefaultCellStyle.Font, "#A5");
+                       Assert.AreEqual 
(DataGridViewContentAlignment.MiddleLeft, 
grid.ColumnHeadersDefaultCellStyle.Alignment, "#A6");
+                       Assert.AreEqual (DataGridViewTriState.True, 
grid.ColumnHeadersDefaultCellStyle.WrapMode, "#A7");
+               }
+
+               [Test]
+               public void DefaultCellStyle ()
+               {
+                       DataGridView grid = new DataGridView();
+                       Assert.AreEqual (SystemColors.Window, 
grid.DefaultCellStyle.BackColor, "#A1");
+                       Assert.AreEqual (SystemColors.ControlText,  
grid.DefaultCellStyle.ForeColor, "#A2");
+                       Assert.AreEqual (SystemColors.Highlight, 
grid.DefaultCellStyle.SelectionBackColor, "#A3");
+                       Assert.AreEqual (SystemColors.HighlightText, 
grid.DefaultCellStyle.SelectionForeColor, "#A4");
+                       Assert.AreSame (grid.Font, grid.DefaultCellStyle.Font, 
"#A5");
+                       Assert.AreEqual 
(DataGridViewContentAlignment.MiddleLeft, grid.DefaultCellStyle.Alignment, 
"#A6");
+                       Assert.AreEqual (DataGridViewTriState.False, 
grid.DefaultCellStyle.WrapMode, "#A7");
+               }
+
+               [Test]
+               public void RowsDefaultCellStyle ()
+               {
+                       DataGridView grid = new DataGridView();
+                       Assert.AreEqual (Color.Empty, 
grid.RowsDefaultCellStyle.BackColor, "#A1");
+                       Assert.AreEqual (Color.Empty, 
grid.RowsDefaultCellStyle.ForeColor, "#A2");
+                       Assert.AreEqual (Color.Empty, 
grid.RowsDefaultCellStyle.SelectionBackColor, "#A3");
+                       Assert.AreEqual (Color.Empty, 
grid.RowsDefaultCellStyle.SelectionForeColor, "#A4");
+                       Assert.IsNull(grid.RowsDefaultCellStyle.Font, "#A5");
+                       Assert.AreEqual (DataGridViewContentAlignment.NotSet, 
grid.RowsDefaultCellStyle.Alignment, "#A6");
+                       Assert.AreEqual (DataGridViewTriState.NotSet, 
grid.RowsDefaultCellStyle.WrapMode, "#A7");
+               }
+
+               [Test]
+               public void RowHeadersDefaultCellStyle ()
+               {
+                       DataGridView grid = new DataGridView();
+                       Assert.AreEqual (SystemColors.Control, 
grid.RowHeadersDefaultCellStyle.BackColor, "#A1");
+                       Assert.AreEqual (SystemColors.WindowText, 
grid.RowHeadersDefaultCellStyle.ForeColor, "#A2");
+                       Assert.AreEqual (SystemColors.Highlight, 
grid.RowHeadersDefaultCellStyle.SelectionBackColor, "#A3");
+                       Assert.AreEqual (SystemColors.HighlightText, 
grid.RowHeadersDefaultCellStyle.SelectionForeColor, "#A4");
+                       Assert.AreSame (grid.Font, 
grid.RowHeadersDefaultCellStyle.Font, "#A5");
+                       Assert.AreEqual 
(DataGridViewContentAlignment.MiddleLeft, 
grid.RowHeadersDefaultCellStyle.Alignment, "#A6");
+                       Assert.AreEqual (DataGridViewTriState.True, 
grid.RowHeadersDefaultCellStyle.WrapMode, "#A7");
+               }
+
+               private class MockDataGridView : DataGridView
+               {
+                       public Size default_size {
+                               get { return base.DefaultSize; }
+                       }
+               }
        }
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to