|
|
@@ -66,16 +66,21 @@ namespace MonoTests.System.Web.UI.WebControls
|
|
|
Helper.Instance.CopyResource (Assembly.GetExecutingAssembly (), "RunTimeSetTheme.aspx", "RunTimeSetTheme.aspx");
|
|
|
#endif
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ [SetUp]
|
|
|
+ public void SetupTestCase ()
|
|
|
+ {
|
|
|
+ Thread.Sleep (100);
|
|
|
+ }
|
|
|
|
|
|
//Run on page with theme
|
|
|
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
public void Theme_TestLabelTheme ()
|
|
|
{
|
|
|
Helper.Instance.RunUrl ("PageWithTheme.aspx", RenderLabelTest);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public static void RenderLabelTest (HttpContext c, Page p, object param)
|
|
|
@@ -88,30 +93,26 @@ namespace MonoTests.System.Web.UI.WebControls
|
|
|
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
public void Theme_TestImageTheme ()
|
|
|
{
|
|
|
Helper.Instance.RunUrl ("PageWithTheme.aspx", RenderImageTest);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public static void RenderImageTest (HttpContext c, Page p, object param)
|
|
|
{
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myimageurl",((MyWebControl.Image) p.FindControl ("Image")).ImageUrl, "Default Theme#1");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myredimageurl", ((MyWebControl.Image) p.FindControl ("ImageRed")).ImageUrl, "RedImage Theme#2");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myyellowimageurl", ((MyWebControl.Image) p.FindControl ("ImageYellow")).ImageUrl, "YellowImage Theme#3");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myimageurl", ((MyWebControl.Image) p.FindControl ("ImageOverride")).ImageUrl, "OverrideImage Theme#3");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("Image")).ImageUrl.IndexOf ("myimageurl") >= 0, "Default Theme#1");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageRed")).ImageUrl.IndexOf ("myredimageurl") >= 0, "RedImage Theme#2");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageYellow")).ImageUrl.IndexOf ("myyellowimageurl") >= 0, "YellowImage Theme#3");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageOverride")).ImageUrl.IndexOf ("myimageurl") >= 0, "OverrideImage Theme#3");
|
|
|
}
|
|
|
|
|
|
// Run on page with StyleSheet
|
|
|
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
public void Theme_TestLabelStyleSheet ()
|
|
|
{
|
|
|
- Helper.Instance.RunUrl ("PageWithStyleSheet.aspx", new Helper.AnyMethodInPage(StyleSheetRenderLabelTest), null);
|
|
|
-
|
|
|
+ Helper.Instance.RunUrl ("PageWithStyleSheet.aspx", StyleSheetRenderLabelTest);
|
|
|
}
|
|
|
|
|
|
public static void StyleSheetRenderLabelTest (HttpContext c, Page p, object param)
|
|
|
@@ -124,24 +125,21 @@ namespace MonoTests.System.Web.UI.WebControls
|
|
|
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
public void Theme_TestImageStyleSheet ()
|
|
|
{
|
|
|
- Helper.Instance.RunUrl ("PageWithStyleSheet.aspx", new Helper.AnyMethodInPage (StyleSheetRenderImageTest), null);
|
|
|
-
|
|
|
+ Helper.Instance.RunUrl ("PageWithStyleSheet.aspx", StyleSheetRenderImageTest);
|
|
|
}
|
|
|
|
|
|
public static void StyleSheetRenderImageTest (HttpContext c, Page p, object param)
|
|
|
{
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myimageurl", ((MyWebControl.Image) p.FindControl ("Image")).ImageUrl, "Default Theme#1");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myredimageurl", ((MyWebControl.Image) p.FindControl ("ImageRed")).ImageUrl, "RedImage Theme#2");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myyellowimageurl", ((MyWebControl.Image) p.FindControl ("ImageYellow")).ImageUrl, "YellowImage Theme#3");
|
|
|
- Assert.AreEqual ("overridedurl", ((MyWebControl.Image) p.FindControl ("ImageOverride")).ImageUrl, "OverrideImage Theme#3");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("Image")).ImageUrl.IndexOf ("myimageurl") >= 0, "Default Theme#1");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageRed")).ImageUrl.IndexOf ("myredimageurl") >= 0, "RedImage Theme#2");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageYellow")).ImageUrl.IndexOf ("myyellowimageurl") >= 0, "YellowImage Theme#3");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageOverride")).ImageUrl.IndexOf ("overridedurl") >= 0, "OverrideImage Theme#3");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
public void Theme_TestRuntimeSetTheme ()
|
|
|
{
|
|
|
PageDelegates p = new PageDelegates ();
|
|
|
@@ -161,15 +159,14 @@ namespace MonoTests.System.Web.UI.WebControls
|
|
|
Assert.AreEqual (Color.Red, ((MyWebControl.Label) p.FindControl ("LabelRed")).BackColor, "Red Skin Theme#2");
|
|
|
Assert.AreEqual (Color.Yellow, ((MyWebControl.Label) p.FindControl ("LabelYellow")).BackColor, "Yellow Skin Theme#3");
|
|
|
Assert.AreEqual (Color.Black, ((MyWebControl.Label) p.FindControl ("LabelOverride")).BackColor, "Override Skin Theme#4");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myimageurl", ((MyWebControl.Image) p.FindControl ("Image")).ImageUrl, "DefaultImage Theme#5");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myredimageurl", ((MyWebControl.Image) p.FindControl ("ImageRed")).ImageUrl, "RedImage Theme#6");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myyellowimageurl", ((MyWebControl.Image) p.FindControl ("ImageYellow")).ImageUrl, "YellowImage Theme#7");
|
|
|
- Assert.AreEqual ("~/App_Themes/Theme1/myimageurl", ((MyWebControl.Image) p.FindControl ("ImageOverride")).ImageUrl, "OverrideImage Theme#8");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("Image")).ImageUrl.IndexOf ("myimageurl") >= 0, "Default Theme#1");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageRed")).ImageUrl.IndexOf ("myredimageurl") >= 0, "RedImage Theme#2");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageYellow")).ImageUrl.IndexOf ("myyellowimageurl") >= 0, "YellowImage Theme#3");
|
|
|
+ Assert.IsTrue (((MyWebControl.Image) p.FindControl ("ImageOverride")).ImageUrl.IndexOf ("myimageurl") >= 0, "OverrideImage Theme#3");
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
public void Theme_TestThemeNotExistExeption()
|
|
|
{
|
|
|
string page = Helper.Instance.RunInPagePreInit (TestThemeNotExistException);
|
|
|
@@ -184,22 +181,31 @@ namespace MonoTests.System.Web.UI.WebControls
|
|
|
// Delegate running on Page Load , only before PreInit possible set Theme on running time !
|
|
|
[Test]
|
|
|
[Category ("NunitWeb")]
|
|
|
- [Category ("NotWorking")]
|
|
|
- [ExpectedException (typeof (InvalidOperationException))]
|
|
|
+ //Use Assert.Fail to print the actual result
|
|
|
+ //[ExpectedException (typeof (InvalidOperationException))]
|
|
|
+ [Category ("NotWorking")]
|
|
|
public void Theme_SetThemeException ()
|
|
|
{
|
|
|
- Helper.Instance.RunInPage (SetThemeExeption);
|
|
|
+ try {
|
|
|
+ string res=Helper.Instance.RunInPagePreInit (SetThemeExeption);
|
|
|
+ Assert.Fail ("InvalidOperationException was expected. Result: "+res);
|
|
|
+ }
|
|
|
+ catch (InvalidOperationException e) {
|
|
|
+ //swallow the expected exception
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static void SetThemeExeption (HttpContext c, Page p, object param)
|
|
|
{
|
|
|
- p.Theme = "Theme1";
|
|
|
+ p.Theme = "InvalidTheme1";
|
|
|
}
|
|
|
|
|
|
[TestFixtureTearDown]
|
|
|
public void TearDown ()
|
|
|
{
|
|
|
+ Thread.Sleep (100);
|
|
|
Helper.Unload ();
|
|
|
+ Thread.Sleep (100);
|
|
|
}
|
|
|
}
|
|
|
}
|