public void TestFilterPlayers() { Project p = Utils.CreateProject(); try { EventsFilter filter = new EventsFilter(p); Assert.AreEqual(10, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); filter.FilterPlayer(p.LocalTeamTemplate.List [4], true); Assert.AreEqual(0, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisiblePlayers.Count); filter.FilterPlayer(p.LocalTeamTemplate.List [0], true); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(2, filter.VisiblePlayers.Count); filter.FilterPlayer(p.LocalTeamTemplate.List [0], true); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(2, filter.VisiblePlayers.Count); filter.FilterPlayer(p.LocalTeamTemplate.List [0], false); Assert.AreEqual(0, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisiblePlayers.Count); filter.FilterPlayer(p.LocalTeamTemplate.List [4], false); Assert.AreEqual(10, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); } finally { Utils.DeleteProject(p); } }
public void TestFilterPlayersDuplicated() { LMProject p = Utils.CreateProject(); p.VisitorTeamTemplate = p.LocalTeamTemplate; try { EventsFilter filter = new EventsFilter(p); Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); foreach (LMPlayer player in p.LocalTeamTemplate.List) { filter.FilterPlayer(player, true); } Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); foreach (LMPlayer player in p.VisitorTeamTemplate.List) { filter.FilterPlayer(player, true); } Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); filter.ClearAll(); Assert.AreEqual(5, filter.VisiblePlayers.Count); Assert.AreEqual(3, filter.VisiblePlays.Count); } finally { Utils.DeleteProject(p); } }
public void TestClearAll() { Project p = Utils.CreateProject(); try { EventsFilter filter = new EventsFilter(p); filter.FilterPlayer(p.LocalTeamTemplate.List [0], true); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisiblePlayers.Count); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); Assert.AreEqual(10, filter.VisiblePlayers.Count); filter.FilterEventType(p.EventTypes [0], true); Assert.AreEqual(1, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisibleEventTypes.Count); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); Assert.AreEqual(13, filter.VisibleEventTypes.Count); filter.FilterEventTag(p.EventTypes [0], (p.EventTypes [0] as AnalysisEventType).Tags [0], true); Assert.AreEqual(0, filter.VisiblePlays.Count); Assert.AreEqual(1, filter.VisibleEventTypes.Count); filter.ClearAll(); Assert.AreEqual(3, filter.VisiblePlays.Count); Assert.AreEqual(13, filter.VisibleEventTypes.Count); } finally { Utils.DeleteProject(p); } }
protected override void UpdateSelection(TreeIter iter, bool active) { TreeStore store = Model as TreeStore; LMPlayer player = (LMPlayer)store.GetValue(iter, COL_VALUE); /* Check all children */ if (player == localTeam || player == visitorTeam) { TreeIter child; store.IterChildren(out child, iter); filter.IgnoreUpdates = true; while (store.IterIsValid(child)) { LMPlayer childPlayer = (LMPlayer)store.GetValue(child, COL_VALUE); filter.FilterPlayer(childPlayer, active); store.SetValue(child, COL_ACTIVE, active); store.IterNext(ref child); } filter.IgnoreUpdates = false; } else { filter.FilterPlayer(player, active); if (!active) { TreeIter team; /* Uncheck the team check button */ if (local.List.Contains(player)) { team = localIter; } else { team = visitorIter; } store.SetValue(team, COL_ACTIVE, false); } } store.SetValue(iter, COL_ACTIVE, active); filter.Update(); }