Пример #1
0
        public AuxiliaryLineTestData Execute(AuxiliaryController ac, int degree)
        {
            Point leftTop     = ac.AuxiliaryLeftTop;
            Point leftBottom  = ac.AuxiliaryLeftBottom;
            Point rightTop    = ac.AuxiliaryRightTop;
            Point rightBottom = ac.AuxiliaryRightBottom;
            int   centerX     = CalcCenterX(leftTop, rightBottom);
            int   centerY     = CalcCenterY(leftBottom, rightTop);

            // テストデータ作成
            Point newLeftTop     = CalcRotatePoint(leftTop, centerX, centerY, degree);
            Point newLeftBottom  = CalcRotatePoint(leftBottom, centerX, centerY, degree);
            Point newRightTop    = CalcRotatePoint(rightTop, centerX, centerY, degree);
            Point newRightBottom = CalcRotatePoint(rightBottom, centerX, centerY, degree);

            AuxiliaryLineParameter before   = ac.CloneParameter();
            AuxiliaryLineTestData  testData = new AuxiliaryLineTestData(newLeftTop, newLeftBottom, newRightTop, newRightBottom, degree);

            if (IsOutOfRangeImagePoint(newLeftTop, ac) ||
                IsOutOfRangeImagePoint(newLeftBottom, ac) ||
                IsOutOfRangeImagePoint(newRightTop, ac) ||
                IsOutOfRangeImagePoint(newRightBottom, ac))
            {
                testData = new AuxiliaryLineTestData(before);
            }

            // 回転実施
            ac.SetEvent(degree);
            ac.PublishEvent(null);

            return(testData);
        }
Пример #2
0
 private void AreParameterEqual(AuxiliaryLineTestData expected, AuxiliaryController actual)
 {
     Assert.AreEqual(expected.ExpectLeftTop, actual.AuxiliaryLeftTop);
     Assert.AreEqual(expected.ExpectLeftBottom, actual.AuxiliaryLeftBottom);
     Assert.AreEqual(expected.ExpectRightTop, actual.AuxiliaryRightTop);
     Assert.AreEqual(expected.ExpectRightBottom, actual.AuxiliaryRightBottom);
     Assert.AreEqual(expected.ExpectDegree, actual.AuxiliaryDegree);
 }