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


C# TestModel.CreateAddNode方法代码示例

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


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

示例1: OneContextTwoNodes

        public void OneContextTwoNodes()
        {
            Gtk.Application.Init ();

            string context = "Context1";
            TestModel model = new TestModel();
            /*INode nodeA = */model.CreateAddNode(10, context, new Size(80, 50));
            /*INode nodeB = */model.CreateAddNode(20, context, new Size(100, 40));
            TimelineLayoutManager layout = new TimelineLayoutManager(model);
            layout.Update();

            TestRenderer renderer = new TestRenderer();
            TimelineView view = new TimelineView(model, renderer);

            Gtk.Widget[] children = view.Children;

            Assert.That(children.Length, Is.EqualTo(2));

            Assert.That(children[0].Visible, Is.True);
            Assert.That(children[1].Visible, Is.True);

            int ax = (int) view.ChildGetProperty(children[0], "x").Val;
            int ay = (int) view.ChildGetProperty(children[0], "y").Val;
            int bx = (int) view.ChildGetProperty(children[1], "x").Val;
            int by = (int) view.ChildGetProperty(children[1], "y").Val;

            Assert.That(ay, Is.GreaterThan(0));
            Assert.That(ay, Is.EqualTo(by));

            Assert.That(ax, Is.GreaterThan(0));
            Assert.That(bx, Is.GreaterThan(0));
            Assert.That(ax, Is.Not.EqualTo(bx));
        }
开发者ID:SayHalou,项目名称:ospy,代码行数:33,代码来源:TimelineViewTest.cs

示例2: OneContextTwoNodes

 public void OneContextTwoNodes()
 {
     string context = "Context1";
     TestModel model = new TestModel();
     INode nodeA = model.CreateAddNode(10, context, new Size(80, 50));
     INode nodeB = model.CreateAddNode(20, context, new Size(100, 40));
     TimelineLayoutManager layout = new TimelineLayoutManager(model);
     layout.Update();
     Assert.That(nodeA.Position, Is.EqualTo(new Point(layout.XMargin, layout.YMargin)));
     Assert.That(nodeB.Position, Is.EqualTo(new Point(layout.XMargin + nodeA.Allocation.Width + layout.XPadding, layout.YMargin)));
 }
开发者ID:SayHalou,项目名称:ospy,代码行数:11,代码来源:TimelineLayoutTest.cs

示例3: OneContextOneNode

 public void OneContextOneNode()
 {
     string context = "Context1";
     TestModel model = new TestModel();
     INode node = model.CreateAddNode(10, context, new Size(100, 50));
     TimelineLayoutManager layout = new TimelineLayoutManager(model);
     layout.Update();
     Assert.That(node.Position, Is.EqualTo(new Point(layout.XMargin, layout.YMargin)));
 }
开发者ID:SayHalou,项目名称:ospy,代码行数:9,代码来源:TimelineLayoutTest.cs

示例4: TwoContextsInSequence

        public void TwoContextsInSequence()
        {
            TestModel model = new TestModel();
            string context1 = "Context1";
            INode ctx1nodeA = model.CreateAddNode(10, context1, new Size(80, 50));
            INode ctx1nodeB = model.CreateAddNode(20, context1, new Size(100, 40));
            string context2 = "Context2";
            INode ctx2node = model.CreateAddNode(30, context2, new Size(50, 30));

            TimelineLayoutManager layout = new TimelineLayoutManager(model);
            layout.Update();

            Assert.That(layout.RowCount, Is.EqualTo(1));

            Assert.That(ctx1nodeA.Position, Is.EqualTo(new Point(layout.XMargin, layout.YMargin)));
            Assert.That(ctx1nodeB.Position.X, Is.EqualTo(ctx1nodeA.Position.X + ctx1nodeA.Allocation.Width + layout.XPadding));
            Assert.That(ctx1nodeB.Position.Y, Is.EqualTo(layout.YMargin));
            Assert.That(ctx2node.Position.X, Is.EqualTo(ctx1nodeB.Position.X + ctx1nodeB.Allocation.Width + layout.XPadding));
            Assert.That(ctx2node.Position.Y, Is.EqualTo(layout.YMargin));
        }
开发者ID:SayHalou,项目名称:ospy,代码行数:20,代码来源:TimelineLayoutTest.cs


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