Skip to content

Commit

Permalink
Add demuxer initialisation test
Browse files Browse the repository at this point in the history
Test for no streams in an input file.
  • Loading branch information
simonhorlick committed May 26, 2012
1 parent 73a69cd commit 5876d6d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions libav_demuxer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,30 @@
class LibavDemuxerTest : public testing::Test {
public:
LibavDemuxerTest() {

demuxer_ = new LibavDemuxer();
source_ = 0;
}

~LibavDemuxerTest() {
delete demuxer_;
if(source_) delete source_;
}

void DoInitialise(const char* filename) {
ASSERT_TRUE(source_ == 0);
source_ = new FileSource(filename);
bool init = demuxer_->Initialise(source_);
ASSERT_TRUE(init);
}

LibavDemuxer* demuxer_;
DataSource* source_;
};

TEST_F(LibavDemuxerTest, InitialiseNoStreams) {
FAIL();
DoInitialise("test/nostreams.ts");
std::map<int, Stream*>& streams = demuxer_->GetStreams();
EXPECT_TRUE(streams.empty());
}

TEST_F(LibavDemuxerTest, InitialiseNoRecognisedStreams) {
Expand Down

0 comments on commit 5876d6d

Please sign in to comment.