public void SetUpTimelineEntryTests() { rootCoroutine = CreateRoutine(expectedFunctionName); entryUnderTest = timelineDataUnderTest.Add(rootCoroutine); // return true after registration with Add rootCoroutine.IsDone.Returns(true); rootCoroutine.LastUpdated.Returns(DateTime.Now); }
public void ParentRelationshipIsUpdated() { ICFunc routineA = CreateRoutine("A"); ICFunc routineB = CreateRoutine("B"); ITimelineEntry a = timelineDataUnderTest.Add(routineA); ITimelineEntry b = timelineDataUnderTest.Add(routineB); routineB.IsUpdatedBy(Arg.Is <object>(routineA)).Returns(true); routineB.HasUpdater.Returns(true); Assume.That(b.Parent == null); timelineDataUnderTest.Update(); Assert.AreSame(a, b.Parent); }
void DrawTimeLineEntry(ITimelineEntry entry, DateTime startTime, DateTime currentTime, float scale, int index) { ControlContext.Context context = _controlContext.Get(entry); ContextVar <bool> foldOut = context.Get <bool>("foldOut", false); float left = (float)(entry.Start - startTime).TotalSeconds * scale; float right = (float)(CalculateEndTime(entry, currentTime) - startTime).TotalSeconds * scale; float width = Mathf.Max(right - left, 1); using (new GUILayout.HorizontalScope(index > 0 ? GUIStyle.none : _style.Row, GUILayout.ExpandWidth(true))) { GUILayout.Space(left); using (new GUILayout.VerticalScope()) { using (new GUILayout.HorizontalScope(index == 0 ? _style.GetEntry(entry.State) : _style.GetChildEntry(entry.State), GUILayout.Width(width))) { if (entry.Children.Any()) { foldOut.Value = GUILayout.Toggle(foldOut.Value, GUIContent.none, _style.EntryToggle); } else { GUILayout.Space(16); } if (GUILayout.Button(entry.Name, _style.EntryText, GUILayout.MaxWidth(width - 10))) { _selectedEntry = entry; } } if (foldOut.Value) { foreach (var child in entry.Children) { DrawTimeLineEntry(child, entry.Start, currentTime, scale, ++index); } } } } }
DateTime CalculateEndTime(ITimelineEntry entry, DateTime defaultEndTime) { return(entry.LastUpdated); //return entry.End ?? defaultEndTime; }
public EntryAddedEventArgs(ITimelineEntry entry) { TimelineEntry = entry; }
public void ChildEntries_ReturnsParent() { ITimelineEntry childEntry = timelineDataUnderTest.Add(CreateRoutine("child", rootCoroutine)); Assert.AreSame(entryUnderTest, childEntry.Parent); }