Esempio n. 1
0
        public void CanGetPositionWithAnchor(Anchor2d anchor, float expectedX, float expectedY)
        {
            var rect = new Rect2d(X, Y, W, H);
            var pos  = rect.GetAnchorPosition(anchor);

            DolphAssert.EqualF(expectedX, pos.X);
            DolphAssert.EqualF(expectedY, pos.Y);
        }
Esempio n. 2
0
        public void CanGetPositionAtOrigin()
        {
            var anchor = Anchor2d.MiddleRight;
            var rect   = new Rect2d(100, 200, 300, 400, anchor);
            var pos1   = rect.GetAnchorPosition(anchor);
            var pos2   = rect.GetOriginPosition();

            Assert.Equal(pos1, pos2);
        }
Esempio n. 3
0
        public void CanSetPositionWithAnchor(Anchor2d anchor, float expectedTopLeftX, float expectedTopLeftY)
        {
            var rect = new Rect2d(X, Y, W, H, anchor);

            foreach (var kvp in RpMap)
            {
                var getAnchor = kvp.Key;
                var rp        = kvp.Value;

                var pos = rect.GetAnchorPosition(getAnchor);
                DolphAssert.EqualF(rp.X(expectedTopLeftX), pos.X);
                DolphAssert.EqualF(rp.Y(expectedTopLeftY), pos.Y);
            }
        }