Author: gert
Date: 2007-02-20 12:44:29 -0500 (Tue, 20 Feb 2007)
New Revision: 73199
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CalendarTest.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
Log:
* CalendarTest.cs: Enabled tests for bug #80881. Fixed NotWorking
SelectDateProperty test to pass on MS.
* Calendar.cs: Fixed bug #80881 by using Thread's CurrentCulture
instead of CurrentUICulture for DateFormatInfo.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
2007-02-20 17:35:58 UTC (rev 73198)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
2007-02-20 17:44:29 UTC (rev 73199)
@@ -71,7 +71,7 @@
public Calendar ()
{
- dateInfo =
Thread.CurrentThread.CurrentUICulture.DateTimeFormat;
+ dateInfo =
Thread.CurrentThread.CurrentCulture.DateTimeFormat;
}
#if NET_2_0
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-02-20 17:35:58 UTC (rev 73198)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-02-20 17:44:29 UTC (rev 73199)
@@ -1,3 +1,8 @@
+2007-02-20 Gert Driesen <[EMAIL PROTECTED]>
+
+ * Calendar.cs: Fixed bug #80881 by using Thread's CurrentCulture
+ instead of CurrentUICulture for DateFormatInfo.
+
2007-02-20 Adar Wesley <[EMAIL PROTECTED]>
* SqlDataSource.cs: fixed ViewState behavior to conform to MS. Added
relevant tests.
Modified:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CalendarTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CalendarTest.cs
2007-02-20 17:35:58 UTC (rev 73198)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CalendarTest.cs
2007-02-20 17:44:29 UTC (rev 73199)
@@ -28,17 +28,19 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System.Web.UI.WebControls;
-using NUnit.Framework;
using System;
using System.Drawing;
+using System.Globalization;
using System.IO;
+using System.Threading;
using System.Web;
using System.Web.UI;
-using System.Globalization;
-using System.Threading;
+using System.Web.UI.WebControls;
-class PokerCalendar : System.Web.UI.WebControls.Calendar {
+using NUnit.Framework;
+
+class PokerCalendar : System.Web.UI.WebControls.Calendar
+{
public PokerCalendar ()
{
TrackViewState ();
@@ -71,19 +73,16 @@
protected override Style CreateControlStyle ()
{
- // Console.WriteLine (Environment.StackTrace);
cs_called = true;
return base.CreateControlStyle ();
}
}
-
namespace MonoTests.System.Web.UI.WebControls
{
-
[TestFixture]
- public class CalendarTest {
-
+ public class CalendarTest
+ {
[Test]
public void Calendar_DefaultValues ()
{
@@ -125,12 +124,12 @@
[Test]
public void NextPrevFormatProperty ()
{
- DateTimeFormatInfo dateInfo = new DateTimeFormatInfo ();
+ DateTimeFormatInfo dateInfo =
DateTimeFormatInfo.CurrentInfo;
PokerCalendar c = new PokerCalendar ();
StringWriter sw = new StringWriter ();
HtmlTextWriter tw = new HtmlTextWriter (sw);
- DateTime prevMonth =
DateTimeFormatInfo.CurrentInfo.Calendar.AddMonths (DateTime.Today, - 1);
- DateTime nextMonth =
DateTimeFormatInfo.CurrentInfo.Calendar.AddMonths (DateTime.Today, 1);
+ DateTime prevMonth = dateInfo.Calendar.AddMonths
(DateTime.Today, -1);
+ DateTime nextMonth = dateInfo.Calendar.AddMonths
(DateTime.Today, 1);
c.NextMonthText = "NextMonthText"; // CustomText
c.PrevMonthText = "PrevMonthText";
@@ -143,16 +142,16 @@
c.NextPrevFormat = NextPrevFormat.FullMonth; //
FullMonth
c.RenderControl (tw);
- //Assert.AreEqual (true, sw.ToString().IndexOf
(dateInfo.GetMonthName (DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth
(prevMonth))) != -1, "NextPrevFormat3");
- //Assert.AreEqual (true, sw.ToString().IndexOf
(dateInfo.GetMonthName (DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth
(nextMonth))) != -1, "NextPrevFormat4");
+ Assert.AreEqual (true, sw.ToString ().IndexOf
(dateInfo.GetMonthName (dateInfo.Calendar.GetMonth (prevMonth))) != -1,
"NextPrevFormat3:" + sw.ToString () + "|||" + dateInfo.GetMonthName
(DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth (prevMonth)));
+ Assert.AreEqual (true, sw.ToString ().IndexOf
(dateInfo.GetMonthName (dateInfo.Calendar.GetMonth (nextMonth))) != -1,
"NextPrevFormat4");
sw = new StringWriter ();
tw = new HtmlTextWriter (sw);
c.NextPrevFormat = NextPrevFormat.ShortMonth; //
ShortMonth
c.RenderControl (tw);
- //Assert.AreEqual (true, sw.ToString().IndexOf
(dateInfo.GetAbbreviatedMonthName
(DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth (prevMonth))) != -1,
"NextPrevFormat5");
- //Assert.AreEqual (true, sw.ToString().IndexOf
(dateInfo.GetAbbreviatedMonthName
(DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth (nextMonth))) != -1,
"NextPrevFormat6");
+ Assert.AreEqual (true, sw.ToString ().IndexOf
(dateInfo.GetAbbreviatedMonthName (dateInfo.Calendar.GetMonth (prevMonth))) !=
-1, "NextPrevFormat5");
+ Assert.AreEqual (true, sw.ToString ().IndexOf
(dateInfo.GetAbbreviatedMonthName (dateInfo.Calendar.GetMonth (nextMonth))) !=
-1, "NextPrevFormat6");
}
[Test]
@@ -247,7 +246,7 @@
}
[Test]
- [Category ("NotWorking")]
+ [Category ("NotWorking")]
public void SelectDateProperty ()
{
PokerCalendar c = new PokerCalendar ();
@@ -258,7 +257,7 @@
Assert.AreEqual (today, c.SelectedDate,
"SelectDateProperty #1");
c.SelectedDate = now;
- Assert.AreEqual (now, c.SelectedDate,
"SelectDateProperty #2");
+ Assert.AreEqual (today, c.SelectedDate,
"SelectDateProperty #2");
}
[Test]
@@ -298,18 +297,18 @@
public void ShowTitleProperty ()
{
String monthName;
- DateTimeFormatInfo dateInfo = new DateTimeFormatInfo ();
+ DateTimeFormatInfo dateInfo =
DateTimeFormatInfo.CurrentInfo;
PokerCalendar c = new PokerCalendar ();
StringWriter sw = new StringWriter ();
HtmlTextWriter tw = new HtmlTextWriter (sw);
c.NextMonthText = "NextMonthText";
c.PrevMonthText = "PrevMonthText";
c.RenderControl (tw);
- monthName = dateInfo.GetMonthName
(DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth (DateTime.Today));
+ monthName = dateInfo.GetMonthName
(dateInfo.Calendar.GetMonth (DateTime.Today));
Assert.AreEqual (true, sw.ToString().IndexOf
(c.PrevMonthText) != -1, "ShowTitle1");
Assert.AreEqual (true, sw.ToString().IndexOf
(c.NextMonthText) != -1, "ShowTitle2");
- //Assert.AreEqual (true, sw.ToString().IndexOf
(monthName) != -1, "ShowTitle3");
+ Assert.AreEqual (true, sw.ToString().IndexOf
(monthName) != -1, "ShowTitle3");
c.ShowTitle = false;
sw = new StringWriter ();
@@ -318,7 +317,7 @@
Assert.AreEqual (true, sw.ToString().IndexOf
(c.PrevMonthText) == -1, "ShowTitle4");
Assert.AreEqual (true, sw.ToString().IndexOf
(c.NextMonthText) == -1, "ShowTitle5");
- //Assert.AreEqual (true, sw.ToString().IndexOf
(monthName) == -1, "ShowTitle6");
+ Assert.AreEqual (true, sw.ToString().IndexOf
(monthName) == -1, "ShowTitle6");
}
//
@@ -567,7 +566,6 @@
copy.RenderControl (tw);
Assert.AreEqual (true,
sw.ToString().ToLower().IndexOf ("brown") != -1, "WeekendDayStyle");
}
-
}
string tofind = "";
@@ -655,7 +653,7 @@
*/
[Test]
- [Category ("NotWorking")]
+ [Category ("NotWorking")]
public void HaveBaseAttributes ()
{
PokerCalendar p = new PokerCalendar ();
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2007-02-20 17:35:58 UTC (rev 73198)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2007-02-20 17:44:29 UTC (rev 73199)
@@ -1,3 +1,8 @@
+2007-02-20 Gert Driesen <[EMAIL PROTECTED]>
+
+ * CalendarTest.cs: Enabled tests for bug #80881. Fixed NotWorking
+ SelectDateProperty test to pass on MS.
+
2007-02-20 Igor Zelmanovich <[EMAIL PROTECTED]>
* ChangePasswordTest.cs: new test
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches