* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Web / Test / mainsoft / MainsoftWebApp / System_Web_UI_WebControls / WebControl / WebControl_TableStyle_BackImageUrl.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.Web;
32 using System.Web.UI;
33 using System.Web.UI.WebControls;
34 using System.Web.UI.HtmlControls;
35 using System.Collections;
36
37 namespace GHTTests.System_Web_dll.System_Web_UI_WebControls
38 {
39     public class WebControl_TableStyle_BackImageUrl
40         : GHTWebControlBase
41         {
42                 #region Web Form Designer generated code
43                 override protected void OnInit(EventArgs e) {
44                         //
45                         // CODEGEN: This call is required by the ASP.NET Web Form Designer.
46                         //
47                         InitializeComponent();
48                         base.OnInit(e);
49                 }
50                 
51                 /// <summary>
52                 /// Required method for Designer support - do not modify
53                 /// the contents of this method with the code editor.
54                 /// </summary>
55                 private void InitializeComponent() {    
56                         this.Load += new System.EventHandler(this.Page_Load);
57                 }
58                 #endregion
59
60         //Overrides GHTWebControlBase.InitTypes
61         //This method initializes the types that will be contained in the TypesToTest array.
62         //This only controls that TableStyle is relevant for, will be tested.
63                 protected override void InitTypes()
64                 {
65                         base.m_derivedTypes = new ArrayList();
66                         base.m_derivedTypes.Add(typeof(RadioButtonList));
67                         base.m_derivedTypes.Add(typeof(CheckBoxList));
68                         base.m_derivedTypes.Add(typeof(DataGrid));
69                         base.m_derivedTypes.Add(typeof(DataList));
70                         base.m_derivedTypes.Add(typeof(Table));
71                 }
72  
73
74
75         private void Page_Load(object sender, System.EventArgs e) 
76                 {
77             HtmlForm frm  = (HtmlForm)FindControl("Form1");
78             GHTTestBegin(frm);
79                         foreach (Type currentType in TypesToTest)
80                         {
81                                 GHTHeader(currentType.ToString());
82                                 Test(currentType);
83                         }
84                         GHTTestEnd();
85         }
86
87                 private void Test(Type ctrlType)
88                 {
89                         try
90                         {
91                                 this.GHTSubTestBegin(ctrlType, "Relative path");
92                                 TableStyle style1 = (TableStyle) this.TestedControl.ControlStyle;
93                                 style1.BackImageUrl = "cat.jpg";
94                         }
95                         catch (Exception exception8)
96                         {
97                                 // ProjectData.SetProjectError(exception8);
98                                 Exception exception1 = exception8;
99                                 this.GHTSubTestUnexpectedExceptionCaught(exception1);
100                                 // ProjectData.ClearProjectError();
101                         }
102                         this.GHTSubTestEnd();
103                         try
104                         {
105                                 this.GHTSubTestBegin(ctrlType, "absolute path");
106                                 TableStyle style2 = (TableStyle) this.TestedControl.ControlStyle;
107                                 style2.BackImageUrl = "http://localhost:/System_Web_dll/System_Web_UI_WebControls/WebControl/cat.jpg";
108                         }
109                         catch (Exception exception9)
110                         {
111                                 // ProjectData.SetProjectError(exception9);
112                                 Exception exception2 = exception9;
113                                 this.GHTSubTestUnexpectedExceptionCaught(exception2);
114                                 // ProjectData.ClearProjectError();
115                         }
116                         this.GHTSubTestEnd();
117                         try
118                         {
119                                 this.GHTSubTestBegin(ctrlType, "Defied only in CssClass");
120                                 TableStyle style3 = (TableStyle) this.TestedControl.ControlStyle;
121                                 style3.CssClass = "CssClass1";
122                         }
123                         catch (Exception exception10)
124                         {
125                                 // ProjectData.SetProjectError(exception10);
126                                 Exception exception3 = exception10;
127                                 this.GHTSubTestUnexpectedExceptionCaught(exception3);
128                                 // ProjectData.ClearProjectError();
129                         }
130                         this.GHTSubTestEnd();
131                         try
132                         {
133                                 this.GHTSubTestBegin(ctrlType, "Defied only in CssClass");
134                                 TableStyle style4 = (TableStyle) this.TestedControl.ControlStyle;
135                                 style4.CssClass = "CssClass1";
136                                 style4.BackImageUrl = "http://localhost:/System_Web_dll/System_Web_UI_WebControls/WebControl/dog.jpg";
137                         }
138                         catch (Exception exception11)
139                         {
140                                 // ProjectData.SetProjectError(exception11);
141                                 Exception exception4 = exception11;
142                                 this.GHTSubTestUnexpectedExceptionCaught(exception4);
143                                 // ProjectData.ClearProjectError();
144                         }
145                         this.GHTSubTestEnd();
146                         try
147                         {
148                                 this.GHTSubTestBegin(ctrlType, "Default value");
149                                 TableStyle style5 = (TableStyle) this.TestedControl.ControlStyle;
150                                 this.GHTSubTestAddResult(style5.BackImageUrl);
151                         }
152                         catch (Exception exception12)
153                         {
154                                 // ProjectData.SetProjectError(exception12);
155                                 Exception exception5 = exception12;
156                                 this.GHTSubTestUnexpectedExceptionCaught(exception5);
157                                 // ProjectData.ClearProjectError();
158                         }
159                         this.GHTSubTestEnd();
160                         try
161                         {
162                                 this.GHTSubTestBegin(ctrlType, "Throws exception on null value");
163                                 TableStyle style6 = (TableStyle) this.TestedControl.ControlStyle;
164                                 style6.BackImageUrl = null;
165                                 this.GHTSubTestExpectedExceptionNotCaught("ArgumentNullException");
166                         }
167                         catch (ArgumentNullException exception13)
168                         {
169                                 // ProjectData.SetProjectError(exception13);
170                                 ArgumentNullException exception6 = exception13;
171                                 this.GHTSubTestExpectedExceptionCaught(exception6);
172                                 // ProjectData.ClearProjectError();
173                         }
174                         catch (Exception exception14)
175                         {
176                                 // ProjectData.SetProjectError(exception14);
177                                 Exception exception7 = exception14;
178                                 this.GHTSubTestUnexpectedExceptionCaught(exception7);
179                                 // ProjectData.ClearProjectError();
180                         }
181                         this.GHTSubTestEnd();
182                 }
183  
184         }
185 }