2 // ControlStyleTest.cs (Auto-generated by GenerateControlStyleTest.cs).
5 // Peter Dennis Bartok (pbartok@novell.com)
7 // (C) 2005 Novell, Inc. (http://www.novell.com)
10 using System.Windows.Forms;
12 using System.Reflection;
13 using NUnit.Framework;
15 namespace MonoTests.System.Windows.Forms {
17 public class TestControlStyle {
19 static Array style_values = Enum.GetValues(typeof(ControlStyles));
20 static string[] style_names = Enum.GetNames(typeof(ControlStyles));
22 public static string[] GetStyles(Control control) {
25 result = new string[style_names.Length];
27 for (int i = 0; i < style_values.Length; i++) {
28 result[i] = style_names[i] + "=" + control.GetType().GetMethod("GetStyle", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(control, new object[1] {(ControlStyles)style_values.GetValue(i)});
35 public void ControlStyleTest ()
37 string[] Control_want = {
38 "ContainerControl=False",
47 "SupportsTransparentBackColor=False",
48 "StandardDoubleClick=True",
49 "AllPaintingInWmPaint=True",
51 "EnableNotifyMessage=False",
55 Assert.AreEqual(Control_want, GetStyles(new Control()), "ControlStyles");
60 public void ButtonStyleTest ()
62 string[] Button_want = {
63 "ContainerControl=False",
69 "StandardClick=False",
72 "SupportsTransparentBackColor=True",
73 "StandardDoubleClick=False",
74 "AllPaintingInWmPaint=True",
76 "EnableNotifyMessage=False",
80 Assert.AreEqual(Button_want, GetStyles(new Button()), "ButtonStyles");
85 public void CheckBoxStyleTest ()
87 string[] CheckBox_want = {
88 "ContainerControl=False",
94 "StandardClick=False",
97 "SupportsTransparentBackColor=True",
98 "StandardDoubleClick=False",
99 "AllPaintingInWmPaint=True",
101 "EnableNotifyMessage=False",
105 Assert.AreEqual(CheckBox_want, GetStyles(new CheckBox()), "CheckBoxStyles");
110 public void RadioButtonStyleTest ()
112 string[] RadioButton_want = {
113 "ContainerControl=False",
119 "StandardClick=False",
122 "SupportsTransparentBackColor=True",
123 "StandardDoubleClick=True",
124 "AllPaintingInWmPaint=True",
126 "EnableNotifyMessage=False",
130 Assert.AreEqual(RadioButton_want, GetStyles(new RadioButton()), "RadioButtonStyles");
135 public void DataGridStyleTest ()
137 string[] DataGrid_want = {
138 "ContainerControl=False",
141 "ResizeRedraw=False",
144 "StandardClick=True",
147 "SupportsTransparentBackColor=False",
148 "StandardDoubleClick=True",
149 "AllPaintingInWmPaint=True",
151 "EnableNotifyMessage=False",
155 Assert.AreEqual(DataGrid_want, GetStyles(new DataGrid()), "DataGridStyles");
160 public void DateTimePickerStyleTest ()
162 string[] DateTimePicker_want = {
163 "ContainerControl=False",
166 "ResizeRedraw=False",
169 "StandardClick=False",
172 "SupportsTransparentBackColor=False",
173 "StandardDoubleClick=True",
174 "AllPaintingInWmPaint=True",
176 "EnableNotifyMessage=False",
180 Assert.AreEqual(DateTimePicker_want, GetStyles(new DateTimePicker()), "DateTimePickerStyles");
185 public void GroupBoxStyleTest ()
187 string[] GroupBox_want = {
188 "ContainerControl=True",
194 "StandardClick=True",
197 "SupportsTransparentBackColor=True",
198 "StandardDoubleClick=True",
199 "AllPaintingInWmPaint=True",
201 "EnableNotifyMessage=False",
205 Assert.AreEqual(GroupBox_want, GetStyles(new GroupBox()), "GroupBoxStyles");
210 public void LabelStyleTest ()
212 string[] Label_want = {
213 "ContainerControl=False",
219 "StandardClick=True",
222 "SupportsTransparentBackColor=True",
223 "StandardDoubleClick=True",
224 "AllPaintingInWmPaint=True",
226 "EnableNotifyMessage=False",
230 Assert.AreEqual(Label_want, GetStyles(new Label()), "LabelStyles");
235 public void LinkLabelStyleTest ()
237 string[] LinkLabel_want = {
238 "ContainerControl=False",
244 "StandardClick=True",
247 "SupportsTransparentBackColor=True",
248 "StandardDoubleClick=True",
249 "AllPaintingInWmPaint=True",
251 "EnableNotifyMessage=False",
255 Assert.AreEqual(LinkLabel_want, GetStyles(new LinkLabel()), "LinkLabelStyles");
260 public void ComboBoxStyleTest ()
262 string[] ComboBox_want = {
263 "ContainerControl=False",
266 "ResizeRedraw=False",
269 "StandardClick=False",
272 "SupportsTransparentBackColor=False",
273 "StandardDoubleClick=True",
274 "AllPaintingInWmPaint=True",
276 "EnableNotifyMessage=False",
280 Assert.AreEqual(ComboBox_want, GetStyles(new ComboBox()), "ComboBoxStyles");
285 public void ListBoxStyleTest ()
287 string[] ListBox_want = {
288 "ContainerControl=False",
291 "ResizeRedraw=False",
294 "StandardClick=False",
297 "SupportsTransparentBackColor=False",
298 "StandardDoubleClick=True",
299 "AllPaintingInWmPaint=True",
301 "EnableNotifyMessage=False",
305 Assert.AreEqual(ListBox_want, GetStyles(new ListBox()), "ListBoxStyles");
310 public void CheckedListBoxStyleTest ()
312 string[] CheckedListBox_want = {
313 "ContainerControl=False",
319 "StandardClick=False",
322 "SupportsTransparentBackColor=False",
323 "StandardDoubleClick=True",
324 "AllPaintingInWmPaint=True",
326 "EnableNotifyMessage=False",
330 Assert.AreEqual(CheckedListBox_want, GetStyles(new CheckedListBox()), "CheckedListBoxStyles");
335 public void ListViewStyleTest ()
337 string[] ListView_want = {
338 "ContainerControl=False",
341 "ResizeRedraw=False",
344 "StandardClick=False",
347 "SupportsTransparentBackColor=False",
348 "StandardDoubleClick=True",
349 "AllPaintingInWmPaint=True",
351 "EnableNotifyMessage=False",
355 Assert.AreEqual(ListView_want, GetStyles(new ListView()), "ListViewStyles");
360 public void MdiClientStyleTest ()
362 string[] MdiClient_want = {
363 "ContainerControl=False",
366 "ResizeRedraw=False",
369 "StandardClick=True",
372 "SupportsTransparentBackColor=False",
373 "StandardDoubleClick=True",
374 "AllPaintingInWmPaint=True",
376 "EnableNotifyMessage=False",
380 Assert.AreEqual(MdiClient_want, GetStyles(new MdiClient()), "MdiClientStyles");
385 public void MonthCalendarStyleTest ()
387 string[] MonthCalendar_want = {
388 "ContainerControl=False",
391 "ResizeRedraw=False",
394 "StandardClick=False",
397 "SupportsTransparentBackColor=False",
398 "StandardDoubleClick=True",
399 "AllPaintingInWmPaint=True",
401 "EnableNotifyMessage=False",
405 Assert.AreEqual(MonthCalendar_want, GetStyles(new MonthCalendar()), "MonthCalendarStyles");
410 public void PictureBoxStyleTest ()
412 string[] PictureBox_want = {
413 "ContainerControl=False",
416 "ResizeRedraw=False",
419 "StandardClick=True",
422 "SupportsTransparentBackColor=True",
423 "StandardDoubleClick=True",
424 "AllPaintingInWmPaint=True",
426 "EnableNotifyMessage=False",
430 Assert.AreEqual(PictureBox_want, GetStyles(new PictureBox()), "PictureBoxStyles");
435 public void ProgressBarStyleTest ()
437 string[] ProgressBar_want = {
438 "ContainerControl=False",
441 "ResizeRedraw=False",
444 "StandardClick=True",
447 "SupportsTransparentBackColor=False",
448 "StandardDoubleClick=True",
449 "AllPaintingInWmPaint=True",
451 "EnableNotifyMessage=False",
455 Assert.AreEqual(ProgressBar_want, GetStyles(new ProgressBar()), "ProgressBarStyles");
460 public void ScrollableControlStyleTest ()
462 string[] ScrollableControl_want = {
463 "ContainerControl=True",
466 "ResizeRedraw=False",
469 "StandardClick=True",
472 "SupportsTransparentBackColor=False",
473 "StandardDoubleClick=True",
474 "AllPaintingInWmPaint=False",
476 "EnableNotifyMessage=False",
480 Assert.AreEqual(ScrollableControl_want, GetStyles(new ScrollableControl()), "ScrollableControlStyles");
485 public void ContainerControlStyleTest ()
487 string[] ContainerControl_want = {
488 "ContainerControl=True",
491 "ResizeRedraw=False",
494 "StandardClick=True",
497 "SupportsTransparentBackColor=False",
498 "StandardDoubleClick=True",
499 "AllPaintingInWmPaint=False",
501 "EnableNotifyMessage=False",
505 Assert.AreEqual(ContainerControl_want, GetStyles(new ContainerControl()), "ContainerControlStyles");
510 public void FormStyleTest ()
512 string[] Form_want = {
513 "ContainerControl=True",
516 "ResizeRedraw=False",
519 "StandardClick=True",
522 "SupportsTransparentBackColor=False",
523 "StandardDoubleClick=True",
524 "AllPaintingInWmPaint=False",
526 "EnableNotifyMessage=False",
530 Assert.AreEqual(Form_want, GetStyles(new Form()), "FormStyles");
535 public void PropertyGridStyleTest ()
537 string[] PropertyGrid_want = {
538 "ContainerControl=True",
541 "ResizeRedraw=False",
544 "StandardClick=True",
547 "SupportsTransparentBackColor=False",
548 "StandardDoubleClick=True",
549 "AllPaintingInWmPaint=False",
551 "EnableNotifyMessage=False",
555 Assert.AreEqual(PropertyGrid_want, GetStyles(new PropertyGrid()), "PropertyGridStyles");
560 public void DomainUpDownStyleTest ()
562 string[] DomainUpDown_want = {
563 "ContainerControl=True",
566 "ResizeRedraw=False",
569 "StandardClick=True",
572 "SupportsTransparentBackColor=False",
573 "StandardDoubleClick=True",
574 "AllPaintingInWmPaint=False",
576 "EnableNotifyMessage=False",
580 Assert.AreEqual(DomainUpDown_want, GetStyles(new DomainUpDown()), "DomainUpDownStyles");
585 public void NumericUpDownStyleTest ()
587 string[] NumericUpDown_want = {
588 "ContainerControl=True",
591 "ResizeRedraw=False",
594 "StandardClick=True",
597 "SupportsTransparentBackColor=False",
598 "StandardDoubleClick=True",
599 "AllPaintingInWmPaint=False",
601 "EnableNotifyMessage=False",
605 Assert.AreEqual(NumericUpDown_want, GetStyles(new NumericUpDown()), "NumericUpDownStyles");
610 public void UserControlStyleTest ()
612 string[] UserControl_want = {
613 "ContainerControl=True",
616 "ResizeRedraw=False",
619 "StandardClick=True",
622 "SupportsTransparentBackColor=False",
623 "StandardDoubleClick=True",
624 "AllPaintingInWmPaint=False",
626 "EnableNotifyMessage=False",
630 Assert.AreEqual(UserControl_want, GetStyles(new UserControl()), "UserControlStyles");
635 public void PanelStyleTest ()
637 string[] Panel_want = {
638 "ContainerControl=True",
641 "ResizeRedraw=False",
644 "StandardClick=True",
647 "SupportsTransparentBackColor=True",
648 "StandardDoubleClick=True",
649 "AllPaintingInWmPaint=False",
651 "EnableNotifyMessage=False",
655 Assert.AreEqual(Panel_want, GetStyles(new Panel()), "PanelStyles");
660 public void TabPageStyleTest ()
662 string[] TabPage_want = {
663 "ContainerControl=True",
666 "ResizeRedraw=False",
669 "StandardClick=True",
672 "SupportsTransparentBackColor=True",
673 "StandardDoubleClick=True",
674 "AllPaintingInWmPaint=False",
676 "EnableNotifyMessage=False",
680 Assert.AreEqual(TabPage_want, GetStyles(new TabPage()), "TabPageStyles");
685 public void HScrollBarStyleTest ()
687 string[] HScrollBar_want = {
688 "ContainerControl=False",
691 "ResizeRedraw=False",
694 "StandardClick=False",
697 "SupportsTransparentBackColor=False",
698 "StandardDoubleClick=True",
699 "AllPaintingInWmPaint=True",
701 "EnableNotifyMessage=False",
705 Assert.AreEqual(HScrollBar_want, GetStyles(new HScrollBar()), "HScrollBarStyles");
710 public void VScrollBarStyleTest ()
712 string[] VScrollBar_want = {
713 "ContainerControl=False",
716 "ResizeRedraw=False",
719 "StandardClick=False",
722 "SupportsTransparentBackColor=False",
723 "StandardDoubleClick=True",
724 "AllPaintingInWmPaint=True",
726 "EnableNotifyMessage=False",
730 Assert.AreEqual(VScrollBar_want, GetStyles(new VScrollBar()), "VScrollBarStyles");
735 public void SplitterStyleTest ()
737 string[] Splitter_want = {
738 "ContainerControl=False",
741 "ResizeRedraw=False",
744 "StandardClick=True",
747 "SupportsTransparentBackColor=False",
748 "StandardDoubleClick=True",
749 "AllPaintingInWmPaint=True",
751 "EnableNotifyMessage=False",
755 Assert.AreEqual(Splitter_want, GetStyles(new Splitter()), "SplitterStyles");
760 public void StatusBarStyleTest ()
762 string[] StatusBar_want = {
763 "ContainerControl=False",
766 "ResizeRedraw=False",
769 "StandardClick=True",
772 "SupportsTransparentBackColor=False",
773 "StandardDoubleClick=True",
774 "AllPaintingInWmPaint=True",
776 "EnableNotifyMessage=False",
780 Assert.AreEqual(StatusBar_want, GetStyles(new StatusBar()), "StatusBarStyles");
785 public void TabControlStyleTest ()
787 string[] TabControl_want = {
788 "ContainerControl=False",
791 "ResizeRedraw=False",
794 "StandardClick=True",
797 "SupportsTransparentBackColor=False",
798 "StandardDoubleClick=True",
799 "AllPaintingInWmPaint=True",
801 "EnableNotifyMessage=False",
805 Assert.AreEqual(TabControl_want, GetStyles(new TabControl()), "TabControlStyles");
810 public void RichTextBoxStyleTest ()
812 string[] RichTextBox_want = {
813 "ContainerControl=False",
816 "ResizeRedraw=False",
819 "StandardClick=False",
822 "SupportsTransparentBackColor=False",
823 "StandardDoubleClick=True",
824 "AllPaintingInWmPaint=True",
826 "EnableNotifyMessage=False",
830 Assert.AreEqual(RichTextBox_want, GetStyles(new RichTextBox()), "RichTextBoxStyles");
835 public void TextBoxStyleTest ()
837 string[] TextBox_want = {
838 "ContainerControl=False",
841 "ResizeRedraw=False",
844 "StandardClick=False",
847 "SupportsTransparentBackColor=False",
848 "StandardDoubleClick=False",
849 "AllPaintingInWmPaint=True",
851 "EnableNotifyMessage=False",
855 Assert.AreEqual(TextBox_want, GetStyles(new TextBox()), "TextBoxStyles");
860 public void DataGridTextBoxStyleTest ()
862 string[] DataGridTextBox_want = {
863 "ContainerControl=False",
866 "ResizeRedraw=False",
869 "StandardClick=False",
872 "SupportsTransparentBackColor=False",
873 "StandardDoubleClick=False",
874 "AllPaintingInWmPaint=True",
876 "EnableNotifyMessage=False",
880 Assert.AreEqual(DataGridTextBox_want, GetStyles(new DataGridTextBox()), "DataGridTextBoxStyles");
885 public void ToolBarStyleTest ()
887 string[] ToolBar_want = {
888 "ContainerControl=False",
891 "ResizeRedraw=False",
894 "StandardClick=True",
897 "SupportsTransparentBackColor=False",
898 "StandardDoubleClick=True",
899 "AllPaintingInWmPaint=True",
901 "EnableNotifyMessage=False",
905 Assert.AreEqual(ToolBar_want, GetStyles(new ToolBar()), "ToolBarStyles");
910 public void TrackBarStyleTest ()
912 string[] TrackBar_want = {
913 "ContainerControl=False",
916 "ResizeRedraw=False",
919 "StandardClick=True",
922 "SupportsTransparentBackColor=False",
923 "StandardDoubleClick=True",
924 "AllPaintingInWmPaint=True",
926 "EnableNotifyMessage=False",
930 Assert.AreEqual(TrackBar_want, GetStyles(new TrackBar()), "TrackBarStyles");
935 public void TreeViewStyleTest ()
937 string[] TreeView_want = {
938 "ContainerControl=False",
941 "ResizeRedraw=False",
944 "StandardClick=False",
947 "SupportsTransparentBackColor=False",
948 "StandardDoubleClick=True",
949 "AllPaintingInWmPaint=True",
951 "EnableNotifyMessage=False",
955 Assert.AreEqual(TreeView_want, GetStyles(new TreeView()), "TreeViewStyles");