[longomatch] Make event creation optional.



commit 5e1885111c6c7adb5fe076683e21145a0b3039a7
Author: Julien Moutte <julien fluendo com>
Date:   Tue Apr 14 13:11:41 2015 +0200

    Make event creation optional.

 Tests/Utils.cs |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/Tests/Utils.cs b/Tests/Utils.cs
index 8f00109..27e4aa8 100644
--- a/Tests/Utils.cs
+++ b/Tests/Utils.cs
@@ -94,7 +94,7 @@ namespace Tests
                        return img;
                }
 
-               public static Project CreateProject ()
+               public static Project CreateProject (bool withEvents = true)
                {
                        TimelineEvent pl;
                        Project p = new Project ();
@@ -110,22 +110,25 @@ namespace Tests
                        p.Description = pd;
                        p.UpdateEventTypesAndTimers ();
 
-                       AnalysisEventButton b = p.Dashboard.List [0] as AnalysisEventButton;
+                       if (withEvents) {
+                               AnalysisEventButton b = p.Dashboard.List [0] as AnalysisEventButton;
+
+                               /* No tags, no players */
+                               pl = new TimelineEvent { EventType = b.EventType, Start = new Time (0), Stop 
= new Time (100) };
+                               p.Timeline.Add (pl);
+                               /* tags, but no players */
+                               b = p.Dashboard.List [1] as AnalysisEventButton;
+                               pl = new TimelineEvent { EventType = b.EventType, Start = new Time (0), Stop 
= new Time (100) };
+                               pl.Tags.Add (b.AnalysisEventType.Tags [0]);
+                               p.Timeline.Add (pl);
+                               /* tags and players */
+                               b = p.Dashboard.List [2] as AnalysisEventButton;
+                               pl = new TimelineEvent { EventType = b.EventType, Start = new Time (0), Stop 
= new Time (100) };
+                               pl.Tags.Add (b.AnalysisEventType.Tags [1]);
+                               pl.Players.Add (p.LocalTeamTemplate.List [0]);
+                               p.Timeline.Add (pl);
+                       }
 
-                       /* No tags, no players */
-                       pl = new TimelineEvent { EventType = b.EventType, Start = new Time (0), Stop = new 
Time (100) };
-                       p.Timeline.Add (pl);
-                       /* tags, but no players */
-                       b = p.Dashboard.List [1] as AnalysisEventButton;
-                       pl = new TimelineEvent { EventType = b.EventType, Start = new Time (0), Stop = new 
Time (100) };
-                       pl.Tags.Add (b.AnalysisEventType.Tags [0]);
-                       p.Timeline.Add (pl);
-                       /* tags and players */
-                       b = p.Dashboard.List [2] as AnalysisEventButton;
-                       pl = new TimelineEvent { EventType = b.EventType, Start = new Time (0), Stop = new 
Time (100) };
-                       pl.Tags.Add (b.AnalysisEventType.Tags [1]);
-                       pl.Players.Add (p.LocalTeamTemplate.List [0]);
-                       p.Timeline.Add (pl);
                        return p;
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]