예제 #1
0
파일: main.cpp 프로젝트: GrayHui/HW3
TEST (CompositeGraphics, defaultBoundingBox) {
    CompositeGraphics g;
    // CompositeGraphics object has a default bounding box of
    // rectangle (0,0,0,0)
    LONGS_EQUAL(0,g.getBoundingBox().llx());
    LONGS_EQUAL(0,g.getBoundingBox().lly());
    LONGS_EQUAL(0,g.getBoundingBox().urx());
    LONGS_EQUAL(0,g.getBoundingBox().ury());
    LONGS_EQUAL(0,g.getBoundingBox().area());
}
예제 #2
0
파일: main.cpp 프로젝트: GrayHui/HW3
TEST(CompositeGraphics, addingTwoChildrenAndGetBoundingBox) {
    CompositeGraphics g;

    g.add(new SimpleGraphics(new Circle(0,0,1)));
    g.add(new SimpleGraphics(new Square(-2,-2,2)));

    LONGS_EQUAL(-2,g.getBoundingBox().llx());
    LONGS_EQUAL(-2,g.getBoundingBox().lly());
    LONGS_EQUAL(1,g.getBoundingBox().urx());
    LONGS_EQUAL(1,g.getBoundingBox().ury());
}
예제 #3
0
파일: main.cpp 프로젝트: GrayHui/HW3
TEST(CompositeGraphics, SimpleAndCompositeChildrenAndGetBoundingBox) {
    CompositeGraphics g;
    SimpleGraphics r(new Rectangle (-1,-1,1,3));

    g.add(new SimpleGraphics(new Circle(0,0,1)));
    g.add(new SimpleGraphics(new Square(-2,-2,2)));
    CompositeGraphics h;
    h.add(&g);
    h.add(&r);

    LONGS_EQUAL(-2,h.getBoundingBox().llx());
    LONGS_EQUAL(-2,h.getBoundingBox().lly());
    LONGS_EQUAL(1,h.getBoundingBox().urx());
    LONGS_EQUAL(2,h.getBoundingBox().ury());

}
예제 #4
0
파일: main.cpp 프로젝트: GrayHui/HW3
TEST(CompositeGraphics, addingOneChild) {
    CompositeGraphics g;

    try {
        g.add(new SimpleGraphics(new Circle(0,0,2)));
    } catch (std::string s) {
        FAIL("Should not throw exception");
    }

    LONGS_EQUAL(16,g.getBoundingBox().area());
}