Example #1
0
    public static void EncapsulateRect_ResizesProperly()
    {
        IntRect a = new IntRect(1, 1, 5, 5);
        IntRect b = new IntRect(0, 0, 10, 10);

        a.Encapsulate(b);

        Assert.AreEqual(10, a.size_.x);
        Assert.AreEqual(10, a.size_.y);
    }
Example #2
0
    public static void EncapsulatePoint_BottomLeftPoint_ResizesProperly()
    {
        IntRect rect = new IntRect(5, 5, 1, 1);
        var p = new Vector3(0, 0, 0);

        rect.Encapsulate(p);

        Assert.AreEqual(6, rect.size_.x);
        Assert.AreEqual(6, rect.size_.y);

        p.x = -5;

        rect.Encapsulate(p);

        Assert.AreEqual(11, rect.size_.x);
    }
Example #3
0
    public static void EncapsulatePoint_UpperRightPoint_ResizesProperly()
    {
        IntRect rect = new IntRect(5, 5, 1, 1);
        var p = new Vector3(8, 8, 8);

        rect.Encapsulate(p);

        Assert.AreEqual(4, rect.size_.x);
        Assert.AreEqual(4, rect.size_.y);

        p.x = 15;

        rect.Encapsulate(p);

        Assert.AreEqual(11, rect.size_.x);
    }