[california/wip/725792-quick-add: 3/5] Fix bug found in tests
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/725792-quick-add: 3/5] Fix bug found in tests
- Date: Wed, 23 Apr 2014 00:31:01 +0000 (UTC)
commit f47d4a6b7de2cec3b7b33cae5d648ac4ebfdc178
Author: Jim Nelson <jim yorba org>
Date: Tue Apr 22 16:22:24 2014 -0700
Fix bug found in tests
src/calendar/calendar-wall-time.vala | 2 ++
src/tests/tests-quick-add.vala | 27 +++++++++++++++++----------
2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/src/calendar/calendar-wall-time.vala b/src/calendar/calendar-wall-time.vala
index d013811..6ff682c 100644
--- a/src/calendar/calendar-wall-time.vala
+++ b/src/calendar/calendar-wall-time.vala
@@ -188,6 +188,8 @@ public class WallTime : BaseObject, Gee.Comparable<WallTime>, Gee.Hashable<WallT
if (!meridiem_unknown && pm)
h += 12;
+ strictly_parsed = true;
+
return new WallTime(h, m, 0);
}
diff --git a/src/tests/tests-quick-add.vala b/src/tests/tests-quick-add.vala
index 065e4a6..30c76b2 100644
--- a/src/tests/tests-quick-add.vala
+++ b/src/tests/tests-quick-add.vala
@@ -80,31 +80,38 @@ private class QuickAdd : UnitTest.Harness {
private bool with_delay() throws Error {
Component.DetailsParser parser = new Component.DetailsParser("meet Alice in 3 hours");
- Calendar.ExactTime time = Calendar.System.now.adjust_time(3, Calendar.TimeUnit.HOUR);
+ Calendar.WallTime start = new Calendar.WallTime.from_exact_time(Calendar.System.now).adjust(
+ 3, Calendar.TimeUnit.HOUR, null);
+ Calendar.WallTime end = start.adjust(1, Calendar.TimeUnit.HOUR, null);
- return parser.event.summary == "meet Alice"
- && parser.event.exact_time_span.start_exact_time.equal_to(time)
- && parser.event.exact_time_span.end_exact_time.equal_to(time.adjust_time(3,
Calendar.TimeUnit.HOUR));
+ assert(parser.event.summary == "meet Alice");
+ assert(new
Calendar.WallTime.from_exact_time(parser.event.exact_time_span.start_exact_time).equal_to(start));
+ assert(new Calendar.WallTime.from_exact_time(
+ parser.event.exact_time_span.start_exact_time).adjust(1, Calendar.TimeUnit.HOUR,
null).equal_to(end));
+
+ return true;
}
private bool with_duration() throws Error {
Component.DetailsParser parser = new Component.DetailsParser("meet Alice for 2 hrs");
- Calendar.ExactTime time = Calendar.System.now.adjust_time(2, Calendar.TimeUnit.HOUR);
+ Calendar.WallTime start = new Calendar.WallTime.from_exact_time(Calendar.System.now);
+ Calendar.WallTime end = start.adjust(2, Calendar.TimeUnit.HOUR, null);
return parser.event.summary == "meet Alice"
- && parser.event.exact_time_span.start_exact_time.equal_to(Calendar.System.now)
- && parser.event.exact_time_span.end_exact_time.equal_to(time);
+ && new
Calendar.WallTime.from_exact_time(parser.event.exact_time_span.start_exact_time).equal_to(start)
+ && new
Calendar.WallTime.from_exact_time(parser.event.exact_time_span.end_exact_time).equal_to(end);
}
private bool with_delay_and_duration() throws Error {
Component.DetailsParser parser = new Component.DetailsParser("meet Alice in 3 hours for 30 min");
- Calendar.ExactTime time = Calendar.System.now.adjust_time(3, Calendar.TimeUnit.HOUR);
+ Calendar.WallTime start = new Calendar.WallTime.from_exact_time(Calendar.System.now.adjust_time(3,
Calendar.TimeUnit.HOUR));
+ Calendar.WallTime end = start.adjust(30, Calendar.TimeUnit.MINUTE, null);
return parser.event.summary == "meet Alice"
- && parser.event.exact_time_span.start_exact_time.equal_to(time)
- && parser.event.exact_time_span.end_exact_time.equal_to(time.adjust_time(30,
Calendar.TimeUnit.MINUTE));
+ && new
Calendar.WallTime.from_exact_time(parser.event.exact_time_span.start_exact_time).equal_to(start)
+ && new
Calendar.WallTime.from_exact_time(parser.event.exact_time_span.end_exact_time).equal_to(end);
}
private bool indeterminate_time() throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]