コード例 #1
0
ファイル: SaveLoadTests.cs プロジェクト: tzachshabtay/MonoAGS
		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();
		}
コード例 #2
0
        public bool IsObjectInFrontTest(
            int?o1RenderLayerZ, int?o1ParentRenderLayerZ, int?o1GrandParentRenderLayerZ,
            int?o2RenderLayerZ, int?o2ParentRenderLayerZ, int?o2GrandParentRenderLayerZ,
            float o1Z, float?o1ParentZ, float?o1GrandParentZ,
            float o2Z, float?o2ParentZ, float?o2GrandParentZ,
            float o1SpriteZ, float?o1ParentSpriteZ, float?o1GrandParentSpriteZ,
            float o2SpriteZ, float?o2ParentSpriteZ, float?o2GrandParentSpriteZ)
        {
            IObject grandParent1 = getObject(o1GrandParentRenderLayerZ, o1GrandParentZ, o1GrandParentSpriteZ, null);
            IObject grandParent2 = getObject(o2GrandParentRenderLayerZ, o2GrandParentZ, o2GrandParentSpriteZ, null);

            IObject parent1 = getObject(o1ParentRenderLayerZ, o1ParentZ, o1ParentSpriteZ, grandParent1);
            IObject parent2 = getObject(o2ParentRenderLayerZ, o2ParentZ, o2ParentSpriteZ, grandParent2);

            IObject o1 = getObject(o1RenderLayerZ, o1Z, o1SpriteZ, parent1);
            IObject o2 = getObject(o2RenderLayerZ, o2Z, o2SpriteZ, parent2);

            RenderOrderSelector selector = new RenderOrderSelector();
            int order1 = selector.Compare(o1, o2);

            selector.Backwards = true;
            int order2 = selector.Compare(o1, o2);

            Assert.IsTrue((order1 <= 0 && order2 >= 0) || (order1 >= 0 && order2 <= 0));
            return(order1 > 0);
        }
コード例 #3
0
        public bool IsObjectInFrontTest(
            int?o1RenderLayerZ, int?o1ParentRenderLayerZ, int?o1GrandParentRenderLayerZ,
            int?o2RenderLayerZ, int?o2ParentRenderLayerZ, int?o2GrandParentRenderLayerZ,
            float o1Z, float?o1ParentZ, float?o1GrandParentZ,
            float o2Z, float?o2ParentZ, float?o2GrandParentZ,
            float o1SpriteZ, float?o1ParentSpriteZ, float?o1GrandParentSpriteZ,
            float o2SpriteZ, float?o2ParentSpriteZ, float?o2GrandParentSpriteZ)
        {
            IObject grandParent1 = getObject(o1GrandParentRenderLayerZ, o1GrandParentZ, o1GrandParentSpriteZ, null);
            IObject grandParent2 = getObject(o2GrandParentRenderLayerZ, o2GrandParentZ, o2GrandParentSpriteZ, null);

            IObject parent1 = getObject(o1ParentRenderLayerZ, o1ParentZ, o1ParentSpriteZ, grandParent1);
            IObject parent2 = getObject(o2ParentRenderLayerZ, o2ParentZ, o2ParentSpriteZ, grandParent2);

            IObject o1 = getObject(o1RenderLayerZ, o1Z, o1SpriteZ, parent1);
            IObject o2 = getObject(o2RenderLayerZ, o2Z, o2SpriteZ, parent2);

            RenderOrderSelector selector = new RenderOrderSelector();
            int order1 = selector.Compare(o1, o2);

            return(order1 > 0);
        }
コード例 #4
0
ファイル: SaveLoadTests.cs プロジェクト: tzachshabtay/MonoAGS
		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.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();
		}
コード例 #5
0
		public bool IsObjectInFrontTest(
			int? o1RenderLayerZ, int? o1ParentRenderLayerZ, int? o1GrandParentRenderLayerZ,
			int? o2RenderLayerZ, int? o2ParentRenderLayerZ, int? o2GrandParentRenderLayerZ,
			float o1Z, float? o1ParentZ, float? o1GrandParentZ,
			float o2Z, float? o2ParentZ, float? o2GrandParentZ,
			float o1SpriteZ, float? o1ParentSpriteZ, float? o1GrandParentSpriteZ,
			float o2SpriteZ, float? o2ParentSpriteZ, float? o2GrandParentSpriteZ)
		{
			IObject grandParent1 = getObject(o1GrandParentRenderLayerZ, o1GrandParentZ, o1GrandParentSpriteZ, null);
			IObject grandParent2 = getObject(o2GrandParentRenderLayerZ, o2GrandParentZ, o2GrandParentSpriteZ, null);

			IObject parent1 = getObject(o1ParentRenderLayerZ, o1ParentZ, o1ParentSpriteZ, grandParent1);
			IObject parent2 = getObject(o2ParentRenderLayerZ, o2ParentZ, o2ParentSpriteZ, grandParent2);

			IObject o1 = getObject(o1RenderLayerZ, o1Z, o1SpriteZ, parent1);
			IObject o2 = getObject(o2RenderLayerZ, o2Z, o2SpriteZ, parent2);

			RenderOrderSelector selector = new RenderOrderSelector ();
			int order1 = selector.Compare(o1, o2);
			selector.Backwards = true;
			int order2 = selector.Compare(o1, o2);
			Assert.IsTrue((order1 <= 0 && order2 >= 0) || (order1 >= 0 && order2 <= 0));
			return order1 > 0;
		}