コード例 #1
0
        public void RemovePoint()
        {
            TaggerController taggerController = this.Container.GetInstance <TaggerController>();

            taggerController.RemovePoint(string.Empty, new Point(1, 1));

            taggerController.AddLabel(LabelName);

            taggerController.GetPoints(LabelName).Count.ShouldBe(0);

            taggerController.RemovePoint(LabelName, new Point(1, 1));

            taggerController.AddPoint(LabelName, new Point(42, 54));

            taggerController.GetPoints(LabelName).Count.ShouldBe(1);

            taggerController.GetPoints(LabelName)[0].X.ShouldBe(42);
            taggerController.GetPoints(LabelName)[0].Y.ShouldBe(54);

            taggerController.RemovePoint(LabelName, new Point(1, 1));

            taggerController.GetPoints(LabelName).Count.ShouldBe(1);

            taggerController.RemovePoint(LabelName, new Point(42, 54));

            taggerController.GetPoints(LabelName).Count.ShouldBe(0);
        }
コード例 #2
0
        public void SelectPixel()
        {
            IImageSource     imageSource      = this.Container.GetInstance <IImageSource>();
            TaggerController taggerController = this.Container.GetInstance <TaggerController>();

            taggerController.GetPoints(LabelName).Count.ShouldBe(0);

            taggerController.SelectPixel(null, Point.Empty);

            taggerController.GetPoints(LabelName).Count.ShouldBe(0);

            taggerController.AddLabel(LabelName);

            taggerController.SelectPixel(null, Point.Empty);

            taggerController.GetPoints(LabelName).Count.ShouldBe(0);

            taggerController.SelectLabel(LabelName);

            taggerController.SelectPixel(imageSource, new Point(42, 54));

            taggerController.GetPoints(LabelName).Count.ShouldBe(1);

            taggerController.GetPoints(LabelName)[0].X.ShouldBe(42);
            taggerController.GetPoints(LabelName)[0].Y.ShouldBe(54);
        }
コード例 #3
0
        public void AddLabel()
        {
            TaggerController taggerController = this.Container.GetInstance <TaggerController>();

            taggerController.Labels.Count().ShouldBe(0);

            taggerController.AddLabel(LabelName);

            taggerController.Labels.Count().ShouldBe(1);
            taggerController.Labels.First().ShouldBe(LabelName);
        }
コード例 #4
0
        public void SelectLabel()
        {
            TaggerController taggerController = this.Container.GetInstance <TaggerController>();

            taggerController.SelectedLabel.ShouldBeNull();

            // Cannot select label which has not been added yet
            Assert.Throws <Shouldly.ShouldAssertException>(() => { taggerController.SelectLabel(LabelName); });

            taggerController.AddLabel(LabelName);

            taggerController.SelectLabel(LabelName);

            taggerController.SelectedLabel.ShouldBe(LabelName);

            taggerController.SelectLabel(null);

            taggerController.SelectedLabel.ShouldBeNull();
        }