public virtual void ShouldBindValueToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); tip.Maximum = new DateTime(2000, 2, 2, 23, 1, 1); tip.Minimum = new DateTime(2002, 3, 3, 1, 0, 0); TimePickerPopup popup = null; tip.Value = new DateTime(1900, 1, 1, 12, 3, 2); TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreEqual(new DateTime(1900, 1, 1, 12, 3, 2), tip.Value), () => Assert.AreEqual(new DateTime(1900, 1, 1, 12, 0, 0), popup.Value), () => tip.Value = new DateTime(2000, 2, 2, 2, 2, 2), () => Assert.AreEqual(new DateTime(2000, 2, 2, 2, 2, 2), popup.Value)); }
public virtual void ShouldBindMinimumToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); tip.Maximum = new DateTime(2000, 2, 2, 16, 1, 1); tip.Minimum = new DateTime(2002, 3, 3, 2, 2, 2); TimePickerPopup popup = null; TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreEqual(tip.Minimum, popup.Minimum), () => tip.Minimum = new DateTime(2000, 2, 2, 2, 2, 2), () => Assert.AreEqual(new DateTime(2000, 2, 2, 2, 2, 2), popup.Minimum), () => popup.Minimum = new DateTime(2010, 3, 3, 3, 3, 3), () => Assert.AreEqual(new DateTime(2010, 3, 3, 3, 3, 3), tip.Minimum, "Twoway manual syc")); }
public virtual void ShouldAllowParseErrorEventFromTimeUpDown() { OverriddenTimePicker tip = new OverriddenTimePicker(true); bool parseErrorRaised = false; OverriddenTimeUpDown tud = null; tip.ParseError += (sender, e) => parseErrorRaised = true; TestAsync( tip, () => tud = tip.OverriddenTimeUpDown, () => tud.ApplyText("non parsable text should raise exception"), () => Assert.IsTrue(parseErrorRaised)); }
public virtual void ShouldAllowCustomParsingFromTimeUpDown() { OverriddenTimePicker tip = new OverriddenTimePicker(true); OverriddenTimeUpDown tud = new OverriddenTimeUpDown(); tip.Parsing += (sender, e) => { e.Value = new DateTime(2000, 2, 2, 9, 10, 11); e.Handled = true; }; TestAsync( tip, () => tud = tip.OverriddenTimeUpDown, () => tud.Culture = new CultureInfo("en-US"), () => tud.ApplyText("random text"), () => Assert.AreEqual("9:10 AM", tud.DisplayTextBox.Text)); }
public virtual void ShouldLetPopupWinFromPopupTemplate() { OverriddenTimePicker tip = new OverriddenTimePicker(); TestAsync( tip, () => Assert.IsInstanceOfType(tip.ActualTimePickerPopup, typeof(ListTimePickerPopup)), () => tip.Popup = new RangeTimePickerPopup() { Tag = "1" }, () => Assert.AreEqual("1", tip.ActualTimePickerPopup.Tag), () => tip.Popup = null, () => Assert.IsInstanceOfType(tip.ActualTimePickerPopup, typeof(ListTimePickerPopup))); }
public virtual void ShouldInitializeValueInTimeUpDownCorrectlyBeforeTemplateIsApplied() { OverriddenTimePicker tip = new OverriddenTimePicker(true) { Culture = new CultureInfo("en-US"), Value = new DateTime(1900, 1, 1, 11, 11, 11) }; OverriddenTimeUpDown tud = null; TestAsync( tip, () => tud = tip.OverriddenTimeUpDown, () => Assert.AreEqual("11:11 AM", tud.DisplayTextBox.Text)); }
public virtual void ShouldCoercePopupTimeSelectionModeWhenRegisteringPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); tip.PopupTimeSelectionMode = PopupTimeSelectionMode.AllowSecondsSelection; TestAsync( tip, // this will register a popup through PopupTemplate, and silently coerce () => Assert.AreEqual(PopupTimeSelectionMode.HoursAndMinutesOnly, tip.PopupTimeSelectionMode)); }
public virtual void ShouldAllowSettingPopupTemplateFromXaml() { OverriddenTimePicker tip = new OverriddenTimePicker(false); // todo: use currentmethodname when ignite has opened that up. tip.Style = LoadXamlResource(DefaultStylesResource)["ShouldAllowSettingPopupTemplateFromXaml"] as Style; Assert.IsNotNull(tip.Style); TestAsync( tip, () => Assert.IsTrue(tip.ActualTimePickerPopup is RangeTimePickerPopup)); }
public virtual void ShouldBindPopupTimeSelectionToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); // todo: the enum values that are commented out will be included after mix. tip.Popup = new RangeTimePickerPopup(); tip.PopupTimeSelectionMode = PopupTimeSelectionMode.AllowSecondsSelection; TimePickerPopup popup = null; TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreEqual(PopupTimeSelectionMode.AllowSecondsSelection, popup.PopupTimeSelectionMode), // () => tip.PopupTimeSelectionMode = PopupTimeSelectionMode.AllowSecondsAndDesignatorsSelection, // () => Assert.AreEqual(PopupTimeSelectionMode.AllowSecondsAndDesignatorsSelection, popup.PopupTimeSelectionMode), () => popup.PopupTimeSelectionMode = PopupTimeSelectionMode.HoursAndMinutesOnly, () => Assert.AreEqual(PopupTimeSelectionMode.HoursAndMinutesOnly, tip.PopupTimeSelectionMode, "Twoway manual syc")); }
public virtual void ShouldBindPopupMinutesIntervalToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); tip.PopupMinutesInterval = 53; TimePickerPopup popup = null; TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreEqual(tip.PopupMinutesInterval, popup.PopupMinutesInterval), () => tip.PopupMinutesInterval = 16, () => Assert.AreEqual(tip.PopupMinutesInterval, popup.PopupMinutesInterval), () => popup.PopupMinutesInterval = 33, () => Assert.AreEqual(33, tip.PopupMinutesInterval, "Twoway manual syc")); }
public virtual void ShouldBindTimeGlobalizationInfoToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); tip.TimeGlobalizationInfo = new TimeGlobalizationInfo(); TimePickerPopup popup = null; TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreSame(tip.TimeGlobalizationInfo, popup.TimeGlobalizationInfo), () => tip.TimeGlobalizationInfo = new TimeGlobalizationInfo(), () => Assert.AreSame(tip.TimeGlobalizationInfo, popup.TimeGlobalizationInfo), () => popup.TimeGlobalizationInfo = new TimeGlobalizationInfo(), () => Assert.AreSame(popup.TimeGlobalizationInfo, tip.TimeGlobalizationInfo, "Twoway manual syc")); }
public virtual void ShouldBindFormatToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); TimePickerPopup popup = null; TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreSame(tip.Format, popup.Format), () => tip.Format = new LongTimeFormat(), () => Assert.AreEqual(tip.Format, popup.Format), () => popup.Format = new CustomTimeFormat("test"), () => Assert.IsTrue(tip.Format is CustomTimeFormat, "Twoway manual syc")); }
public virtual void ShouldBindCultureToPopup() { OverriddenTimePicker tip = new OverriddenTimePicker(); tip.Culture = new CultureInfo("nl-NL"); TimePickerPopup popup = null; TestAsync( tip, () => popup = tip.ActualTimePickerPopup as TimePickerPopup, () => tip.IsDropDownOpen = true, () => Assert.AreSame(tip.Culture, popup.Culture), () => tip.Culture = new CultureInfo("en-US"), () => Assert.AreSame(tip.Culture, popup.Culture), () => popup.Culture = new CultureInfo("nl-NL"), () => Assert.AreSame(popup.Culture, tip.Culture, "Twoway manual syc")); }