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:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
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.
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
23 // Pedro MartÃnez Juliá <pedromj@gmail.com>
29 using NUnit.Framework;
32 using System.Windows.Forms;
33 using System.ComponentModel;
34 using System.Collections;
35 using System.Globalization;
37 namespace MonoTests.System.Windows.Forms {
40 public class DataGridViewCellStyleTest {
42 DataGridViewCellStyle style;
45 public void GetReady() {
46 style = new DataGridViewCellStyle();
51 style = new DataGridViewCellStyle();
55 public void TestDefaultValues () {
56 Assert.AreEqual (DataGridViewContentAlignment.NotSet, style.Alignment, "#A1");
57 Assert.AreEqual (Color.Empty, style.BackColor, "#A2");
58 Assert.AreEqual (null, style.Font, "#A3");
59 Assert.AreEqual (Color.Empty, style.ForeColor, "#A4");
60 Assert.AreEqual (String.Empty, style.Format, "#A5");
61 Assert.AreEqual (CultureInfo.CurrentUICulture, style.FormatProvider, "#A6");
62 Assert.AreEqual (true, style.IsFormatProviderDefault, "#A7");
63 Assert.AreEqual (true, style.IsNullValueDefault, "#A8");
64 Assert.AreEqual (string.Empty, style.NullValue, "#A9");
65 Assert.AreEqual (Color.Empty, style.SelectionBackColor, "#A10");
66 Assert.AreEqual (Color.Empty, style.SelectionForeColor, "#A11");
67 Assert.AreEqual (null, style.Tag, "#A12");
68 Assert.AreEqual (DataGridViewTriState.NotSet, style.WrapMode, "#A13");
72 public void TestApplyStyle () {
73 DataGridViewCellStyle style_aux = new DataGridViewCellStyle();
74 style.ApplyStyle(style_aux);
75 Assert.AreEqual (style_aux, style, "#B1");
79 public void TestClone () {
80 DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
81 Assert.AreEqual (style_aux, style, "#C1");
85 public void TestEquals () {
86 DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
87 Assert.AreEqual (true, (style_aux.Equals(style)), "#D1");
91 [ExpectedException(typeof(InvalidEnumArgumentException))]
92 public void TestAlignmentInvalidEnumArgumentException () {
93 style.Alignment = DataGridViewContentAlignment.BottomCenter | DataGridViewContentAlignment.BottomRight;
97 [ExpectedException(typeof(InvalidEnumArgumentException))]
98 public void TestWrapModeInvalidEnumArgumentException () {
99 style.WrapMode = (DataGridViewTriState) 3;