In .:
[mono.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / DataGridViewCellStyleTest.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
21 //
22 // Author:
23 //      Pedro Martínez Juliá <pedromj@gmail.com>
24 //
25
26
27 #if NET_2_0
28
29 using NUnit.Framework;
30 using System;
31 using System.Drawing;
32 using System.Windows.Forms;
33 using System.ComponentModel;
34 using System.Collections;
35 using System.Globalization;
36
37 namespace MonoTests.System.Windows.Forms {
38
39         [TestFixture]
40         public class DataGridViewCellStyleTest : Assertion {
41
42                 DataGridViewCellStyle style;
43                 
44                 [SetUp]
45                 public void GetReady() {
46                         style = new DataGridViewCellStyle();
47                 }
48
49                 [TearDown]
50                 public void Clean() {
51                         style = new DataGridViewCellStyle();
52                 }
53
54                 [Test]
55                 public void TestDefaultValues () {
56                         AssertEquals("Alignment property", DataGridViewContentAlignment.NotSet, style.Alignment);
57                         AssertEquals("BackColor property", Color.Empty, style.BackColor);
58                         AssertEquals("Font property", null, style.Font);
59                         AssertEquals("ForeColor property", Color.Empty, style.ForeColor);
60                         AssertEquals("Format property", String.Empty, style.Format);
61                         AssertEquals("FormatProvider property", CultureInfo.CurrentUICulture, style.FormatProvider);
62                         AssertEquals("IsFormatProviderDefault property", true, style.IsFormatProviderDefault);
63                         AssertEquals("IsNullValueDefault property", true, style.IsNullValueDefault);
64                         AssertEquals("NullValue property", "(null)", style.NullValue);
65                         AssertEquals("SelectionBackColor property", Color.Empty, style.SelectionBackColor);
66                         AssertEquals("SelectionForeColor property", Color.Empty, style.SelectionForeColor);
67                         AssertEquals("Tag property", null, style.Tag);
68                         AssertEquals("WrapMode property", DataGridViewTriState.NotSet, style.WrapMode);
69                 }
70
71                 [Test]
72                 public void TestApplyStyle () {
73                         DataGridViewCellStyle style_aux = new DataGridViewCellStyle();
74                         style.ApplyStyle(style_aux);
75                         AssertEquals("ApplyStyle method", style_aux, style);
76                 }
77
78                 [Test]
79                 public void TestClone () {
80                         DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
81                         AssertEquals("Clone method", style_aux, style);
82                 }
83
84                 [Test]
85                 public void TestEquals () {
86                         DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
87                         AssertEquals("Equals method", true, (style_aux.Equals(style)));
88                 }
89
90                 [Test]
91                 [ExpectedException(typeof(InvalidEnumArgumentException))]
92                 public void TestAlignmentInvalidEnumArgumentException () {
93                         style.Alignment = DataGridViewContentAlignment.BottomCenter | DataGridViewContentAlignment.BottomRight;
94                 }
95
96                 [Test]
97                 [ExpectedException(typeof(ArgumentException))]
98                 public void TestSelectionBackColorArgumentException () {
99                         style.SelectionBackColor = Color.FromArgb(100, Color.Red);
100                 }
101
102                 [Test]
103                 [ExpectedException(typeof(InvalidEnumArgumentException))]
104                 public void TestWrapModeInvalidEnumArgumentException () {
105                         style.WrapMode = (DataGridViewTriState) 3;
106                 }
107
108                 /*
109                 [Test]
110                 [ExpectedException(typeof(Exception))]
111                 public void TestException () {
112                         ConcreteCollection myCollection;
113                         myCollection = new ConcreteCollection();
114                         ....
115                         AssertEquals ("#UniqueID", expected, actual);
116                         ....
117                         Fail ("Message");
118                 }
119                 */
120
121         }
122
123 }
124
125 #endif