当前位置: 首页>>代码示例>>C#>>正文


C# WindowState.GetAllItems方法代码示例

本文整理汇总了C#中WindowState.GetAllItems方法的典型用法代码示例。如果您正苦于以下问题:C# WindowState.GetAllItems方法的具体用法?C# WindowState.GetAllItems怎么用?C# WindowState.GetAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WindowState的用法示例。


在下文中一共展示了WindowState.GetAllItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EPuzzleWindow


//.........这里部分代码省略.........
            CollectionAssert.AreEqual(new [] { a, }, container0.Items);

            // container1
            Assert.AreEqual(1, container1.BorderLeft);
            Assert.AreEqual(120, container1.BorderTop);
            Assert.AreEqual(100, container1.Height);
            CollectionAssert.AreEqual(new [] { b, c, }, container1.Items);

            // a
            Assert.AreEqual("a", a.Name);
            Assert.AreEqual(1, a.OuterLeft);
            Assert.AreEqual(10, a.OuterTop);
            Assert.AreEqual(11, a.OuterRight);
            Assert.AreEqual(110, a.OuterBottom);

            // b
            Assert.AreEqual("b", b.Name);
            Assert.AreEqual(1, b.OuterLeft);
            Assert.AreEqual(120, b.OuterTop);
            Assert.AreEqual(21, b.OuterRight);
            Assert.AreEqual(220, b.OuterBottom);

            // c
            Assert.AreEqual("c", c.Name);
            Assert.AreEqual(22, c.OuterLeft);
            Assert.AreEqual(120, c.OuterTop);
            Assert.AreEqual(32, c.OuterRight);
            Assert.AreEqual(220, c.OuterBottom);

            WindowState.NowObject = new TestNowObject();
            WindowState.NowObject.Now = DateTime.MinValue;

            var idouJikan = TimeSpan.FromSeconds(1d);
            state.場所の入れ換え(a, c, idouJikan);

            var aa = state.Items.Single(x => "a" == x.Name);
            var cc = state.Items.Single(x => "c" == x.Name);

            Assert.False(a.IsClickable);
            Assert.False(a.IsVisible);
            Assert.False(c.IsClickable);
            Assert.False(c.IsVisible);

            Assert.False(aa.IsClickable);
            Assert.True(aa.IsVisible);
            Assert.AreEqual(DrawingObjectPosition.Absolute, aa.Position);
            Assert.AreSame(state.DrawingObjectRoot, aa.Parent);
            Assert.AreEqual(a.OuterLeft, aa.OuterLeft);
            Assert.AreEqual(a.OuterTop, aa.OuterTop);
            Assert.AreEqual(a.OuterWidth, aa.OuterWidth);

            Assert.False(cc.IsClickable);
            Assert.True(cc.IsVisible);
            Assert.AreEqual(DrawingObjectPosition.Absolute, cc.Position);
            Assert.AreSame(state.DrawingObjectRoot, cc.Parent);
            Assert.AreEqual(c.OuterLeft, cc.OuterLeft);
            Assert.AreEqual(c.OuterTop, cc.OuterTop);
            Assert.AreEqual(c.OuterWidth, cc.OuterWidth);

            // 移動中
            WindowState.NowObject.Now += TimeSpan.FromTicks((int)Math.Round(idouJikan.Ticks * 0.5f));
            window.Tick();

            Assert.AreEqual(c.OuterLeft + (a.OuterLeft - c.OuterLeft) * 0.5f, cc.OuterLeft, 0.1f);
            Assert.AreEqual(c.OuterTop + (a.OuterTop - c.OuterTop) * 0.5f, cc.OuterTop, 0.1f);
            Assert.AreEqual(c.Width + (a.Width - c.Width) * 0.5f, c.Width, 0.1f);

            Assert.AreEqual(a.OuterLeft + (c.OuterLeft - a.OuterLeft) * 0.5f, aa.OuterLeft, 0.1f);
            Assert.AreEqual(a.OuterTop + (c.OuterTop - a.OuterTop) * 0.5f, aa.OuterTop, 0.1f);
            Assert.AreEqual(a.Width + (c.Width - a.Width) * 0.5f, a.Width, 0.1f);

            // 場所の入れ換え完了
            WindowState.NowObject.Now += idouJikan;
            window.Tick();

            CollectionAssert.DoesNotContain(state.GetAllItems(), a);
            CollectionAssert.DoesNotContain(state.GetAllItems(), c);
            Assert.Null(a.Parent);
            Assert.Null(c.Parent);
            CollectionAssert.AreEqual(new [] { cc, }, container0.Items);
            CollectionAssert.AreEqual(new [] { b, aa }, container1.Items);
            Assert.True(aa.IsClickable);
            Assert.True(aa.IsVisible);
            Assert.True(cc.IsClickable);
            Assert.True(cc.IsVisible);

            // cc
            Assert.AreEqual("c", cc.Name);
            Assert.AreEqual(1, cc.OuterLeft);
            Assert.AreEqual(10, cc.OuterTop);
            Assert.AreEqual(11, cc.OuterRight);
            Assert.AreEqual(110, cc.OuterBottom);

            // aa
            Assert.AreEqual("a", aa.Name);
            Assert.AreEqual(22, aa.OuterLeft);
            Assert.AreEqual(120, aa.OuterTop);
            Assert.AreEqual(32, aa.OuterRight);
            Assert.AreEqual(220, aa.OuterBottom);
        }
开发者ID:kaijin-games,项目名称:larning-english-game,代码行数:101,代码来源:WindowState.test.cs


注:本文中的WindowState.GetAllItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。