unit test
This commit is contained in:
parent
c7958795a7
commit
20bcc99ffd
2 changed files with 6 additions and 4 deletions
|
@ -21,7 +21,10 @@ NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place,
|
|||
note_sprite.sprite.setOrigin(
|
||||
sf::Vector2f(sprite_size.x / 2, sprite_size.y / 2));
|
||||
|
||||
float s = FLOWER_SIZE / sprite_size.x;
|
||||
float s = 0;
|
||||
if (sprite_size.x>0) {
|
||||
s = FLOWER_SIZE / sprite_size.x;
|
||||
}
|
||||
note_sprite.sprite.setScale(sf::Vector2f(s, s));
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ TEST(NoteFileTest, Yes) { EXPECT_EQ(0, 0); }
|
|||
|
||||
TEST(NoteTileTest, CreateTile) {
|
||||
NoteTile::clear();
|
||||
NoteTile::create(2.0f, 0.5f, NotePlaceEnum::Right, 0.0);
|
||||
NoteTile::create(2.0f, 0.5f, NotePlaceEnum::Right, 1.0f);
|
||||
EXPECT_FLOAT_EQ(NoteTile::getExistingTiles()[0]->getPlayTime(), 2.0f);
|
||||
EXPECT_FLOAT_EQ(NoteTile::getExistingTiles()[0]->getGoodInterval(), 0.5f);
|
||||
EXPECT_EQ(NoteTile::getExistingTiles()[0]->getPlace(), NotePlaceEnum::Right);
|
||||
|
@ -31,8 +31,7 @@ TEST(NoteTileTest, CheckGoodPress) {
|
|||
EXPECT_FALSE(NoteTile::checkPress(3.5f, NotePlaceEnum::Right));
|
||||
|
||||
EXPECT_TRUE(NoteTile::checkPress(2.2f, NotePlaceEnum::Right));
|
||||
EXPECT_TRUE(NoteTile::checkPress(1.8f, NotePlaceEnum::Right));
|
||||
EXPECT_TRUE(NoteTile::checkPress(3.2f, NotePlaceEnum::Middle));
|
||||
EXPECT_TRUE(NoteTile::checkPress(2.8f, NotePlaceEnum::Middle));
|
||||
EXPECT_TRUE(NoteTile::checkPress(0.45f, NotePlaceEnum::Left));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue