Sunshine/tests/unit/test_video.cpp
2025-10-06 17:30:21 -04:00

51 lines
1.1 KiB
C++

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