private IEnumerable <IAnimationComponent> getImplementors() { foreach (var container in ObjectTests.GetImplementors(_mocks, _mocks.GameState())) { yield return(container); } }
public void SaveLoad_ButtonInPanel_Test() { List<IObject> objs = ObjectTests.GetImplementors(_mocks, null, _state).ToList(); IPanel panel = (IPanel)objs.First(o => o is IPanel); IButton button = (IButton)objs.First(o => o is IButton); button.TreeNode.SetParent(panel.TreeNode); setupObject(panel); setupObject(button); _saveLoad.Save("test"); _saveLoad.Load("test"); Assert.AreEqual(1, _state.Rooms.Count); Assert.AreEqual(2, _state.Rooms[0].Objects.Count); panel = null; button = null; foreach (IObject obj in _state.Rooms[0].Objects) { testObject(obj); if (button == null) button = obj as IButton; if (!(obj is IButton)) panel = obj as IPanel; } Assert.IsNotNull(button); Assert.IsNotNull(panel); Assert.AreSame(button.TreeNode.Parent, panel); Assert.AreSame(button.TreeNode.Parent, panel.TreeNode.Node); RenderOrderSelector comparer = new RenderOrderSelector (); Assert.AreEqual(1, comparer.Compare(button, panel)); Assert.AreEqual(-1, comparer.Compare(panel, button)); clearState(); }
private IEnumerable <IHasModelMatrix> getImplementors() { foreach (var sprite in ObjectTests.GetImplementors(_mocks, _mocks.GameState())) { yield return(sprite); } var resolver = ObjectTests.GetResolver(); resolver.Build(); yield return(new AGSSprite(resolver, _mocks.MaskLoader().Object)); }
private IArea getArea() { var resolver = ObjectTests.GetResolver(); resolver.Build(); var area = new AGSArea("Area", resolver) { Mask = new AGSMask(new bool[][] { }, null) }; AGSScalingArea.Create(area, 1f, 1f); area.AddComponent <IWalkBehindArea>(); return(area); }
public async Task TestTweenSaturation() { var resolver = ObjectTests.GetResolver(); resolver.Build(); AGSSprite sprite = new AGSSprite(resolver, null); sprite.Tint = Color.FromHsla(100, 1f, 0.5f, 100); //Lightness must be different than 1 for saturation to change await sprite.TweenTintSaturation(0f, 1f, Ease.QuadIn).Task; Assert.IsTrue(Math.Abs(sprite.Tint.GetSaturation()) < 0.0001f); await sprite.TweenTintSaturation(1f, 1f).Task; Assert.IsTrue(Math.Abs(1f - sprite.Tint.GetSaturation()) < 0.0001f); }
public async Task TestTweenHue() { var resolver = ObjectTests.GetResolver(); resolver.Build(); AGSSprite sprite = new AGSSprite(resolver, null); sprite.Tint = Color.FromHsla(0, 1f, 0.75f, 100); //Lightness must be different than 1 for hue to change await sprite.TweenTintHue(359, 1f).Task; Assert.AreEqual(359, sprite.Tint.GetHue()); await sprite.TweenTintHue(0, 1f, Ease.QuadIn).Task; Assert.AreEqual(0, sprite.Tint.GetHue()); }
private IEnumerable <IHasModelMatrix> getImplementors() { foreach (var sprite in ObjectTests.GetImplementors(_mocks, _mocks.GameState())) { //todo: Fix scaling for labels if (sprite is AGSLabel || sprite is AGSButton) { continue; } yield return(sprite); } var resolver = ObjectTests.GetResolver(); resolver.Build(); yield return(new AGSSprite(resolver, _mocks.MaskLoader().Object)); }
public void SaveLoad_Object_Test() { foreach (IObject obj in ObjectTests.GetImplementors(_mocks, null, _state)) { setupObject(obj); _saveLoad.Save("test"); _saveLoad.Load("test"); Assert.AreEqual(1, _state.Rooms.Count); Assert.AreEqual(1, _state.Rooms[0].Objects.Count); IObject actual = _state.Rooms[0].Objects.First(); testObject(actual); clearState(); } }