Ejemplo n.º 1
0
TEST(Levels, load_npz)
{
    Levels l;
    
    l.addPath("data/C10_Standard.npz");
    ASSERT_EQ(9, l.numLevels());
    
    ASSERT_STREQ("plane sailing", l.levelName(0).c_str());
    ASSERT_STREQ("the leap", l.levelName(1).c_str());
    ASSERT_STREQ("nautilus", l.levelName(8).c_str());
    
    ASSERT_EQ(1, l.numCollections());
    ASSERT_EQ(9, l.collectionSize(0));
    
    int indexInCol;
    ASSERT_EQ(0, l.collectionFromLevel(0, &indexInCol));
    ASSERT_EQ(0, indexInCol);

    ASSERT_EQ(0, l.collectionFromLevel(1, &indexInCol));
    ASSERT_EQ(1, indexInCol);

}
Ejemplo n.º 2
0
    LevelSelector(GameControl* game, int initialLevel)
        : m_game(game),
          m_levels(game->m_levels),
          m_collection(0),
          m_dispbase(0),
          m_dispcount(0)
    {
        m_scroll = new ScrollArea();
        m_scroll->fitToParent(true);
        m_scroll->virtualSize(Vec2(SCREEN_WIDTH,SCREEN_HEIGHT));

        m_content->add(m_scroll,0,0);
        fitToParent(true);

        int levelInC;
        m_collection = m_levels->collectionFromLevel(initialLevel,&levelInC);
        setCollection(m_collection, levelInC);
    }
Ejemplo n.º 3
0
TEST(Levels, empty)
{
    Levels l;
    
    ASSERT_EQ(0, l.numLevels());
    
    ASSERT_EQ(string("err"), l.levelName(0, false));
    ASSERT_EQ(string("err"), l.levelName(0, true));
    
    ASSERT_LT(l.findLevel("non-existent"), 0);
    ASSERT_EQ(0, l.numCollections());
    ASSERT_LT(l.collectionFromLevel(0), 0);

    ASSERT_EQ(0, l.collectionSize(0));
    ASSERT_EQ(0, l.collectionSize(1));

    ASSERT_EQ(0, l.collectionLevel(0, 0));

    ASSERT_FALSE(l.demoPath(0).empty());
    ASSERT_FALSE(l.demoName(0).empty());
    ASSERT_FALSE(l.hasDemo(0));
}