Skip to content

Commit

Permalink
FrameMapper_tests: Add more coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Nov 3, 2020
1 parent 98d6eb4 commit d54871a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/FrameMapper_Tests.cpp
Expand Up @@ -44,6 +44,7 @@ using namespace std;
using namespace openshot;

SUITE(FrameMapper) {

TEST(NoOp_GetMappedFrame)
{
// Create a reader
Expand All @@ -57,6 +58,15 @@ TEST(NoOp_GetMappedFrame)
MappedFrame f = mapping.GetMappedFrame(100);
CHECK_EQUAL(100, f.Odd.Frame);
CHECK_EQUAL(100, f.Even.Frame);

// Should return end frame
f = mapping.GetMappedFrame(150);
CHECK_EQUAL(120, f.Odd.Frame);
CHECK_EQUAL(120, f.Even.Frame);

mapping.Close();
mapping.Reader(nullptr);
CHECK_THROW(mapping.Reader(), ReaderClosed);
}

TEST(Invalid_Frame_Too_Small)
Expand Down Expand Up @@ -475,4 +485,17 @@ TEST(redistribute_samples_per_frame) {
r.Close();
}

TEST(Json)
{
DummyReader r(Fraction(30,1), 1280, 720, 48000, 2, 5.0);
FrameMapper map(&r, Fraction(30, 1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO);

// Read JSON config & write it back again
const std::string map_config = map.Json();
map.SetJson(map_config);

CHECK_EQUAL(48000, map.info.sample_rate);
CHECK_EQUAL(30, map.info.fps.num);
}

} // SUITE

0 comments on commit d54871a

Please sign in to comment.