Sunshine/tests/unit/test_video.cpp

49 lines
1.1 KiB
C++
Raw Normal View History

2024-03-24 23:52:24 +00:00
/**
* @file tests/unit/test_video.cpp
2024-03-24 23:52:24 +00:00
* @brief Test src/video.*.
*/
#include <src/video.h>
#include "../tests_common.h"
2024-03-24 23:52:24 +00:00
struct EncoderTest: PlatformTestSuite, testing::WithParamInterface<video::encoder_t *> {
2024-03-24 23:52:24 +00:00
void
SetUp() override {
auto &encoder = *GetParam();
if (!video::validate_encoder(encoder, false)) {
// Encoder failed validation,
// if it's software - fail (unless overriden with compile definition), otherwise skip
if (encoder.name == "software" && std::string(TESTS_SOFTWARE_ENCODER_UNAVAILABLE) == "fail") {
FAIL() << "Software encoder not available";
2024-03-24 23:52:24 +00:00
}
else {
GTEST_SKIP() << "Encoder not available";
2024-03-24 23:52:24 +00:00
}
}
}
};
2024-03-24 23:52:24 +00:00
INSTANTIATE_TEST_SUITE_P(
EncoderVariants,
EncoderTest,
testing::Values(
2024-03-24 23:52:24 +00:00
#if !defined(__APPLE__)
&video::nvenc,
2024-03-24 23:52:24 +00:00
#endif
#ifdef _WIN32
&video::amdvce,
&video::quicksync,
2024-03-24 23:52:24 +00:00
#endif
#ifdef __linux__
&video::vaapi,
2024-03-24 23:52:24 +00:00
#endif
#ifdef __APPLE__
&video::videotoolbox,
2024-03-24 23:52:24 +00:00
#endif
&video::software),
[](const auto &info) { return std::string(info.param->name); });
2024-03-24 23:52:24 +00:00
TEST_P(EncoderTest, ValidateEncoder) {
// todo:: test something besides fixture setup
}