mirror of
https://github.com/QuasarApp/SoundBand.git
synced 2025-04-28 00:04:33 +00:00
fix tests
This commit is contained in:
parent
532727b034
commit
00d0d7259b
@ -166,7 +166,7 @@ int MySql::save(const QString &url){
|
||||
song.size = bytes.size();
|
||||
song.source = bytes;
|
||||
|
||||
if(!song.isValid()){
|
||||
if(!song.isNameValid()){
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,17 @@ unsigned int SongHeader::getSize() const{
|
||||
return size.size();
|
||||
}
|
||||
|
||||
bool SongHeader::isValid() const{
|
||||
bool SongHeader::isNameValid() const{
|
||||
bool CheckSongs = false;
|
||||
for (QString i: ValidSongs){
|
||||
CheckSongs = CheckSongs || name.endsWith(i);
|
||||
}
|
||||
return id > -1 && !name.isEmpty() && size > 0 && CheckSongs;
|
||||
return CheckSongs;
|
||||
}
|
||||
|
||||
bool SongHeader::isValid() const{
|
||||
|
||||
return id > -1 && !name.isEmpty() && size > 0 && isNameValid();
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
SongHeader& operator = (const SongHeader& right);
|
||||
bool operator == (const SongHeader& right);
|
||||
virtual unsigned int getSize() const;
|
||||
bool isNameValid() const;
|
||||
virtual bool isValid() const;
|
||||
virtual ~SongHeader();
|
||||
friend QDataStream& operator << (QDataStream& stream, const SongHeader& song);
|
||||
|
@ -1,5 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/song">
|
||||
<file alias="test_song">res/under ground.mp3</file>
|
||||
<file alias="test_song.mp3">res/under ground.mp3</file>
|
||||
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -41,7 +41,10 @@ void SyncTest::sycn_tests()
|
||||
|
||||
QVERIFY(sync != nullptr);
|
||||
|
||||
QVERIFY(sync->play(":/song/test_song"));
|
||||
QVERIFY(!sync->play(":/song/test_song"));
|
||||
|
||||
QVERIFY(sync->play(":/song/test_song.mp3"));
|
||||
|
||||
|
||||
sync->stop();
|
||||
QVERIFY(sync->play(1));
|
||||
@ -109,7 +112,7 @@ void SyncTest::database_tests()
|
||||
|
||||
QVERIFY(!sql.addToPlayList(header,"none"));
|
||||
|
||||
header.id = sql.save(":/song/test_song");
|
||||
header.id = sql.save(":/song/test_song.mp3");
|
||||
QVERIFY(header.id > 0);
|
||||
|
||||
QVERIFY(sql.load(header,song));
|
||||
|
Loading…
x
Reference in New Issue
Block a user