* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Web / Test / mainsoft / MainsoftWebApp / System_Web_UI_WebControls / WebControl / WebControl_ApplyStyle_S.aspx.cs
1 //
2 // Authors:
3 //   Rafael Mizrahi   <rafim@mainsoft.com>
4 //   Erez Lotan       <erezl@mainsoft.com>
5 //   Vladimir Krasnov <vladimirk@mainsoft.com>
6 //
7 //
8 // Copyright (c) 2002-2005 Mainsoft Corporation.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 using System;
31 using System.Drawing;
32 using System.Web;
33 using System.Web.UI;
34 using System.Web.UI.WebControls;
35 using System.Web.UI.HtmlControls;
36
37 namespace GHTTests.System_Web_dll.System_Web_UI_WebControls
38 {
39         public class WebControl_ApplyStyle_S
40                 : GHTWebControlBase
41         {
42                 #region Web Form Designer generated code
43                 override protected void OnInit(EventArgs e) 
44                 {
45                         //
46                         // CODEGEN: This call is required by the ASP.NET Web Form Designer.
47                         //
48                         InitializeComponent();
49                         base.OnInit(e);
50                 }
51                 
52                 /// <summary>
53                 /// Required method for Designer support - do not modify
54                 /// the contents of this method with the code editor.
55                 /// </summary>
56                 private void InitializeComponent() 
57                 {    
58                         this.Load += new System.EventHandler(this.Page_Load);
59                 }
60                 #endregion
61
62                 #region "Data members"
63                 private Style m_newStyle;
64                 private Style m_oldStyle;
65                 private Style m_blankStyle;
66                 #endregion
67
68                 private void Page_Load(object sender, System.EventArgs e) 
69                 {
70                         HtmlForm frm  = (HtmlForm)FindControl("Form1");
71                         try 
72                         {
73                                 InitStyles();
74                         }
75                         catch (Exception ex) 
76                         {
77                                 GHTSubTestBegin("Styles initialization");
78                                 GHTSubTestUnexpectedExceptionCaught(ex);
79                         }
80
81                         GHTTestBegin(frm);
82                         foreach (Type currentType in TypesToTest)
83                         {
84                                 GHTHeader(currentType.ToString());
85                                 Test(currentType);
86                         }
87                         GHTTestEnd();
88                 }
89
90                 private void Test(Type ctrlType)
91                 {
92                         try
93                         {
94                                 this.GHTSubTestBegin(ctrlType, "Apply a new style:");
95                                 this.TestedControl.ApplyStyle(this.m_newStyle);
96                         }
97                         catch (Exception exception3)
98                         {
99                                 // ProjectData.SetProjectError(exception3);
100                                 Exception exception1 = exception3;
101                                 this.GHTSubTestUnexpectedExceptionCaught(exception1);
102                                 // ProjectData.ClearProjectError();
103                         }
104                         this.GHTSubTestEnd();
105                         try
106                         {
107                                 this.GHTSubTestBegin(ctrlType, "Apply a blank style:");
108                                 this.TestedControl.ApplyStyle(this.m_oldStyle);
109                                 this.TestedControl.ApplyStyle(this.m_blankStyle);
110                         }
111                         catch (Exception exception4)
112                         {
113                                 // ProjectData.SetProjectError(exception4);
114                                 Exception exception2 = exception4;
115                                 this.GHTSubTestUnexpectedExceptionCaught(exception2);
116                                 // ProjectData.ClearProjectError();
117                         }
118                         this.GHTSubTestEnd();
119                 }
120  
121
122                 private void InitStyles()
123                 {
124                         this.m_blankStyle = new Style();
125                         this.m_oldStyle = new Style();
126                         Style style2 = this.m_oldStyle;
127                         style2.BackColor = Color.Wheat;
128                         style2.BorderColor = Color.DarkGreen;
129                         style2.BorderStyle = BorderStyle.Double;
130                         Unit unit2 = new Unit(5);
131                         style2.BorderWidth = unit2;
132                         style2.ForeColor = Color.DarkMagenta;
133                         unit2 = new Unit(60);
134                         style2.Height = unit2;
135                         unit2 = new Unit(60);
136                         style2.Width = unit2;
137                         FontInfo info2 = style2.Font;
138                         info2.Bold = false;
139                         info2.Italic = false;
140                         info2.Name = "Times New Roman";
141                         info2.Overline = false;
142                         FontUnit unit1 = new FontUnit(FontSize.Small);
143                         info2.Size = unit1;
144                         info2.Strikeout = false;
145                         info2.Underline = false;
146                         info2 = null;
147                         style2 = null;
148                         this.m_newStyle = new Style();
149                         Style style1 = this.m_newStyle;
150                         style1.BackColor = Color.AliceBlue;
151                         style1.BorderColor = Color.Red;
152                         style1.BorderStyle = BorderStyle.Dashed;
153                         unit2 = new Unit(2);
154                         style1.BorderWidth = unit2;
155                         style1.ForeColor = Color.RoyalBlue;
156                         unit2 = new Unit(40);
157                         style1.Height = unit2;
158                         unit2 = new Unit(40);
159                         style1.Width = unit2;
160                         FontInfo info1 = style1.Font;
161                         info1.Bold = true;
162                         info1.Italic = true;
163                         info1.Name = "Arial";
164                         info1.Overline = true;
165                         unit1 = new FontUnit(FontSize.Large);
166                         info1.Size = unit1;
167                         info1.Strikeout = true;
168                         info1.Underline = true;
169                         info1 = null;
170                         style1 = null;
171                 }
172         }
173 }