尝试解决插件bug
This commit is contained in:
@@ -18,7 +18,10 @@ add_executable(olive-gtest
|
||||
plugin_support_test.cpp
|
||||
plugin_support_image_test.cpp
|
||||
plugin_support_clip_test.cpp
|
||||
plugin_support_param_test.cpp
|
||||
opengl_readback_guard_test.cpp
|
||||
plugin_render_pipeline_test.cpp
|
||||
plugin_renderer_readback_test.cpp
|
||||
plugin_ofx_integration_test.cpp
|
||||
codec_frame_test.cpp
|
||||
codec_exportcodec_test.cpp
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <QVariant>
|
||||
|
||||
#include "render/opengl/openglrenderer.h"
|
||||
|
||||
TEST(OpenGLRenderer, DownloadFromTextureWithoutCurrentContext)
|
||||
{
|
||||
QOpenGLContext context;
|
||||
ASSERT_TRUE(context.create());
|
||||
ASSERT_EQ(QOpenGLContext::currentContext(), nullptr);
|
||||
|
||||
olive::OpenGLRenderer renderer;
|
||||
renderer.Init(&context);
|
||||
|
||||
olive::VideoParams params(4, 4, olive::core::PixelFormat::U8, 4,
|
||||
olive::core::rational(1, 1),
|
||||
olive::VideoParams::kInterlaceNone, 1);
|
||||
|
||||
unsigned char buffer[4 * 4 * 4] = {};
|
||||
renderer.DownloadFromTexture(QVariant::fromValue<GLuint>(0), params,
|
||||
buffer, 4 * 4);
|
||||
|
||||
EXPECT_EQ(QOpenGLContext::currentContext(), nullptr);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ TEST(PluginIntegration, ChromaKeyerCreateAndRender)
|
||||
olive::TexturePtr output = std::make_shared<olive::Texture>(params);
|
||||
|
||||
olive::plugin::PluginRenderer renderer;
|
||||
renderer.RenderPlugin(input, job, output.get(), params, true, false);
|
||||
renderer.RenderPlugin(input, job, output, params, true, false);
|
||||
|
||||
EXPECT_TRUE(output->frame());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "render/plugin/pluginrenderer.h"
|
||||
|
||||
TEST(PluginRendererReadback, BytesToPixels)
|
||||
{
|
||||
olive::VideoParams params(16, 16, olive::core::PixelFormat::U8, 4,
|
||||
olive::core::rational(1, 1),
|
||||
olive::VideoParams::kInterlaceNone, 1);
|
||||
|
||||
const int bytes_per_pixel =
|
||||
olive::VideoParams::GetBytesPerPixel(params.format(),
|
||||
params.channel_count());
|
||||
ASSERT_EQ(bytes_per_pixel, 4);
|
||||
|
||||
EXPECT_EQ(olive::plugin::detail::BytesToPixels(64, params), 16);
|
||||
EXPECT_EQ(olive::plugin::detail::BytesToPixels(0, params), 0);
|
||||
EXPECT_EQ(olive::plugin::detail::BytesToPixels(-1, params), 0);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "ofxParam.h"
|
||||
#include "ofxhParam.h"
|
||||
#include "pluginSupport/paraminstance.h"
|
||||
|
||||
TEST(PluginSupportParam, IntegerInstanceNullNodeRoundTrip)
|
||||
{
|
||||
OFX::Host::Param::Descriptor descriptor(kOfxParamTypeInteger,
|
||||
"TestInteger");
|
||||
olive::plugin::IntegerInstance instance(nullptr, descriptor);
|
||||
|
||||
int value = -1;
|
||||
EXPECT_EQ(instance.get(value), kOfxStatOK);
|
||||
EXPECT_EQ(value, 0);
|
||||
|
||||
EXPECT_EQ(instance.set(7), kOfxStatOK);
|
||||
EXPECT_EQ(instance.get(value), kOfxStatOK);
|
||||
EXPECT_EQ(value, 7);
|
||||
|
||||
int time_value = -1;
|
||||
EXPECT_EQ(instance.get(1.0, time_value), kOfxStatOK);
|
||||
EXPECT_EQ(time_value, 7);
|
||||
}
|
||||
Reference in New Issue
Block a user