Bug 1238420 - Update MP4Rust gtest for CAPI changes. r=kinetik.

mp4parse_read() returns a variety of error codes now.

Call mp4parse_get_track_count() to verify the number
of parsed tracks.
This commit is contained in:
Ralph Giles 2016-01-11 11:26:00 +13:00
Родитель 43e659e3cc
Коммит 66f8ae8fac
1 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -22,27 +22,27 @@ TEST(rust, MP4MetadataEmpty)
ASSERT_NE(context, nullptr);
rv = mp4parse_read(nullptr, nullptr, 0);
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
rv = mp4parse_read(context, nullptr, 0);
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
size_t len = 4097;
rv = mp4parse_read(nullptr, nullptr, len);
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
rv = mp4parse_read(context, nullptr, len);
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
std::vector<uint8_t> buf;
rv = mp4parse_read(nullptr, buf.data(), buf.size());
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
rv = mp4parse_read(context, buf.data(), buf.size());
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
buf.reserve(len);
rv = mp4parse_read(nullptr, buf.data(), buf.size());
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
rv = mp4parse_read(context, buf.data(), buf.size());
EXPECT_EQ(rv, -1);
EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
mp4parse_free(context);
}
@ -62,7 +62,10 @@ TEST(rust, MP4Metadata)
ASSERT_NE(context, nullptr);
int32_t rv = mp4parse_read(context, buf.data(), buf.size());
EXPECT_EQ(rv, 2);
EXPECT_EQ(rv, MP4PARSE_OK);
uint32_t tracks = mp4parse_get_track_count(context);
EXPECT_EQ(tracks, 2U);
mp4parse_free(context);
}