Commit 9f19e828 authored by Marcin Kolny's avatar Marcin Kolny

Tests: fix unittests

parent 01793fce
......@@ -532,7 +532,7 @@ gst-plugins-bad/gstreamermm-plugins-bad/wrap_init.cc
gst-plugins-bad/gstreamermm-*.pc
#tests/ gtest files
tests/gtest.zip
tests/release-1.7.0.zip
tests/gtest
#tests/
......
......@@ -15,8 +15,8 @@
gstreamermm_includes = -I$(top_builddir)/gstreamer $(if $(srcdir:.=),-I$(top_srcdir)/gstreamer)
local_libgstreamermm = $(top_builddir)/gstreamer/gstreamermm/libgstreamermm-$(GSTREAMERMM_API_VERSION).la
gtest_includes = -I$(srcdir)/gtest/gtest-1.7.0 -I$(srcdir)/gtest/gtest-1.7.0/include
AM_CPPFLAGS = -I$(top_builddir) $(gstreamermm_includes) $(gtest_includes) $(GSTREAMERMM_CFLAGS) -std=c++0x -Wall -Werror -Wextra
gtest_includes = -I$(srcdir)/gtest/googletest-release-1.7.0 -I$(srcdir)/gtest/googletest-release-1.7.0/include
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir) $(gstreamermm_includes) $(gtest_includes) $(GSTREAMERMM_CFLAGS) -std=c++0x -Wall -Werror -Wextra
AM_CXXFLAGS = $(GSTREAMERMM_WXXFLAGS) -g -Wno-missing-field-initializers
LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lpthread
......@@ -62,10 +62,10 @@ check_PROGRAMS = \
# Include run of test programs in check:
TESTS = $(check_PROGRAMS)
TEST_GTEST_SOURCES = main.cc gtest/gtest-1.7.0/src/gtest-all.cc
TEST_GTEST_SOURCES = main.cc gtest/googletest-release-1.7.0/src/gtest-all.cc
TEST_REGRESSION_UTILS = regression/utils.cc
$(TEST_GTEST_SOURCES): gtest.zip
$(TEST_GTEST_SOURCES): release-1.7.0.zip
test_allocator_SOURCES = $(TEST_GTEST_SOURCES) test-allocator.cc
test_atomicqueue_SOURCES = $(TEST_GTEST_SOURCES) test-atomicqueue.cc
......@@ -107,9 +107,9 @@ test_regression_videoduration_SOURCES = $(TEST_GTEST_SOURCES) $(TEST_R
download_curl = $(CURL) --compressed --connect-timeout 300 -g -L -m 3600 -R --retry 5 \
$(if $(wildcard $@),-z $@) -o $@
download_wget = $(WGET) -N -nd -T 300 -t 5 -P $(dir $@)
gtest_url = https://googletest.googlecode.com/files/gtest-1.7.0.zip
gtest_url = https://github.com/google/googletest/archive/release-1.7.0.zip
gtest.zip:
release-1.7.0.zip:
$(AM_V_GEN)$(if $(filter no,$(ENABLE_UNITTESTS)),\
echo 'Error: $@ does not exist.';\
echo 'Unit tests are disabled.';\
......@@ -118,9 +118,9 @@ gtest.zip:
$(if\
$(CURL),$(download_curl) '$(gtest_url)',$(if\
$(WGET),$(download_wget) '$(gtest_url)',test -f $@))); \
$(AM_V_GEN)unzip -nq -d gtest gtest.zip
$(AM_V_GEN)unzip -nq -d gtest release-1.7.0.zip
check_DATA = gtest
CLEANFILES = gtest.zip
CLEANFILES = release-1.7.0.zip
clean-local:
rm -rf gtest
#ifndef _MM_TEST_H_
#define _MM_TEST_H_
#include <gtest/gtest.h>
#define MM_ASSERT_TRUE(condition) ASSERT_TRUE(!!(condition))
#define MM_ASSERT_FALSE(condition) ASSERT_FALSE(!!(condition))
#endif
......@@ -5,7 +5,7 @@
* Author: loganek
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/appsink.h>
#include <gstreamermm/appsrc.h>
......@@ -27,8 +27,8 @@ protected:
sink = ElementFactory::create_element("appsink", "sink");
source = ElementFactory::create_element("appsrc", "source");
ASSERT_TRUE(sink);
ASSERT_TRUE(source);
MM_ASSERT_TRUE(sink);
MM_ASSERT_TRUE(source);
ASSERT_NO_THROW(pipeline->add(source)->add(sink));
ASSERT_NO_THROW(source->link(sink));
......@@ -38,13 +38,13 @@ protected:
TEST_F(AppSinkPluginTest, CorrectCreatedAppSinkElement)
{
RefPtr<AppSink> source = AppSink::create("sink");
ASSERT_TRUE(source);
MM_ASSERT_TRUE(source);
RefPtr<Element> source_element = ElementFactory::create_element("appsink", "source");
ASSERT_TRUE(source_element);
MM_ASSERT_TRUE(source_element);
source = source.cast_dynamic(source_element);
ASSERT_TRUE(source);
MM_ASSERT_TRUE(source);
}
TEST_F(AppSinkPluginTest, CreatePipelineWithAppsink)
......@@ -58,15 +58,15 @@ TEST_F(AppSinkPluginTest, SinkPadQueryCapsShouldReturnProperCapsObjects)
RefPtr<BaseSink> basesink;
basesink = basesink.cast_dynamic(sink);
ASSERT_TRUE(basesink);
MM_ASSERT_TRUE(basesink);
RefPtr<Pad> sink_pad = basesink->get_sink_pad();
ASSERT_TRUE(sink_pad);
ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
MM_ASSERT_TRUE(sink_pad);
MM_ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
RefPtr<Caps> caps = sink_pad->query_caps(Caps::create_any());
ASSERT_TRUE(caps);
ASSERT_TRUE(caps->gobj());
ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
MM_ASSERT_TRUE(caps);
MM_ASSERT_TRUE(caps->gobj());
MM_ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(sink_pad->gobj()), false);
sink_pad.reset();
......@@ -97,9 +97,9 @@ TEST_F(AppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
std::string data = "hello world";
RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
ASSERT_TRUE(buf);
MM_ASSERT_TRUE(buf);
MapInfo map_info;
ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
MM_ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
strcpy((char *)map_info.get_data(), data.c_str());
buf->unmap(map_info);
......@@ -107,16 +107,16 @@ TEST_F(AppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
RefPtr<Buffer> buf_out;
RefPtr<Sample> sample = appsink->pull_sample();
ASSERT_TRUE(sample);
MM_ASSERT_TRUE(sample);
buf_out = sample->get_buffer();
ASSERT_TRUE(buf_out);
MM_ASSERT_TRUE(buf_out);
EXPECT_TRUE(buf_out->memcmp(0, data.c_str(), data.length()) == 0);
EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
ASSERT_TRUE(msg);
MM_ASSERT_TRUE(msg);
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
......@@ -5,7 +5,7 @@
* Author: m.kolny
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/appsrc.h>
......@@ -26,8 +26,8 @@ protected:
sink = ElementFactory::create_element("fakesink", "sink");
source = ElementFactory::create_element("appsrc", "source");
ASSERT_TRUE(sink);
ASSERT_TRUE(source);
MM_ASSERT_TRUE(sink);
MM_ASSERT_TRUE(source);
ASSERT_NO_THROW(pipeline->add(source)->add(sink));
ASSERT_NO_THROW(source->link(sink));
......@@ -37,13 +37,13 @@ protected:
TEST_F(AppSrcPluginTest, CorrectCreatedAppSrcElement)
{
RefPtr<AppSrc> source = AppSrc::create("source");
ASSERT_TRUE(source);
MM_ASSERT_TRUE(source);
RefPtr<Element> source_element = ElementFactory::create_element("appsrc", "source");
ASSERT_TRUE(source_element);
MM_ASSERT_TRUE(source_element);
source = source.cast_dynamic(source_element);
ASSERT_TRUE(source);
MM_ASSERT_TRUE(source);
}
TEST_F(AppSrcPluginTest, CreatePipelineWithAppSrcElement)
......@@ -57,15 +57,15 @@ TEST_F(AppSrcPluginTest, SrcPadQueryCapsShouldReturnProperCapsObjects)
RefPtr<BaseSrc> basesrc;
basesrc = basesrc.cast_dynamic(source);
ASSERT_TRUE(basesrc);
MM_ASSERT_TRUE(basesrc);
RefPtr<Pad> src_pad = basesrc->get_src_pad();
ASSERT_TRUE(src_pad);
ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
MM_ASSERT_TRUE(src_pad);
MM_ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
RefPtr<Caps> caps = src_pad->query_caps(Caps::create_any());
ASSERT_TRUE(caps);
ASSERT_TRUE(caps->gobj());
ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
MM_ASSERT_TRUE(caps);
MM_ASSERT_TRUE(caps->gobj());
MM_ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(src_pad->gobj()), false);
src_pad.reset();
......@@ -93,14 +93,14 @@ TEST_F(AppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
std::string data = "hello world";
RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
ASSERT_TRUE(buf);
MM_ASSERT_TRUE(buf);
MapInfo mapinfo;
ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
MM_ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
strcpy((char *)mapinfo.get_data(), data.c_str());
RefPtr<AppSrc> appsrc;
appsrc = appsrc.cast_dynamic(source);
ASSERT_TRUE(appsrc);
MM_ASSERT_TRUE(appsrc);
EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
......@@ -114,7 +114,7 @@ TEST_F(AppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
ASSERT_TRUE(msg);
MM_ASSERT_TRUE(msg);
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/appsrc.h>
#include <gstreamermm/appsink.h>
......@@ -22,8 +22,8 @@ protected:
sink = ElementFactory::create_element("derivedfromappsink", "sink");
source = ElementFactory::create_element("appsrc", "source");
ASSERT_TRUE(sink);
ASSERT_TRUE(source);
MM_ASSERT_TRUE(sink);
MM_ASSERT_TRUE(source);
ASSERT_NO_THROW(pipeline->add(source)->add(sink));
ASSERT_NO_THROW(source->link(sink));
......@@ -42,7 +42,7 @@ TEST_F(DerivedFromAppSinkPluginTest, CreateRegisteredElement)
{
RefPtr<Element> sink_element = ElementFactory::create_element("derivedfromappsink", "source");
ASSERT_TRUE(sink_element);
MM_ASSERT_TRUE(sink_element);
}
TEST_F(DerivedFromAppSinkPluginTest, CreatePipelineWithRegisteredElement)
......@@ -56,15 +56,15 @@ TEST_F(DerivedFromAppSinkPluginTest, SinkPadQueryCapsShouldReturnProperCapsObjec
RefPtr<BaseSink> basesink;
basesink = basesink.cast_dynamic(sink);
ASSERT_TRUE(basesink);
MM_ASSERT_TRUE(basesink);
RefPtr<Pad> sink_pad = basesink->get_sink_pad();
ASSERT_TRUE(sink_pad);
ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
MM_ASSERT_TRUE(sink_pad);
MM_ASSERT_TRUE(GST_IS_PAD(sink_pad->gobj()));
RefPtr<Caps> caps = sink_pad->query_caps(Caps::create_any());
ASSERT_TRUE(caps);
ASSERT_TRUE(caps->gobj());
ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
MM_ASSERT_TRUE(caps);
MM_ASSERT_TRUE(caps->gobj());
MM_ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(sink_pad->gobj()), false);
sink_pad.reset();
......@@ -95,9 +95,9 @@ TEST_F(DerivedFromAppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
std::string data = "hello world";
RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
ASSERT_TRUE(buf);
MM_ASSERT_TRUE(buf);
MapInfo map_info;
ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
MM_ASSERT_TRUE(buf->map(map_info, MAP_WRITE));
strcpy((char *)map_info.get_data(), data.c_str());
buf->unmap(map_info);
......@@ -105,16 +105,16 @@ TEST_F(DerivedFromAppSinkPluginTest, UseAppSinkDuringDataFlowInPipeline)
RefPtr<Buffer> buf_out;
RefPtr<Sample> sample = appsink->pull_sample();
ASSERT_TRUE(sample);
MM_ASSERT_TRUE(sample);
buf_out = sample->get_buffer();
ASSERT_TRUE(buf_out);
MM_ASSERT_TRUE(buf_out);
EXPECT_TRUE(buf_out->memcmp(0, data.c_str(), data.length()) == 0);
EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
ASSERT_TRUE(msg);
MM_ASSERT_TRUE(msg);
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/appsrc.h>
......@@ -21,8 +21,8 @@ protected:
sink = ElementFactory::create_element("fakesink", "sink");
source = ElementFactory::create_element("derivedfromappsrc", "source");
ASSERT_TRUE(sink);
ASSERT_TRUE(source);
MM_ASSERT_TRUE(sink);
MM_ASSERT_TRUE(source);
ASSERT_NO_THROW(pipeline->add(source)->add(sink));
ASSERT_NO_THROW(source->link(sink));
......@@ -41,7 +41,7 @@ TEST_F(DerivedFromAppSrcPluginTest, CreateRegisteredElement)
{
RefPtr<Element> source_element = ElementFactory::create_element("derivedfromappsrc", "source");
ASSERT_TRUE(source_element);
MM_ASSERT_TRUE(source_element);
}
TEST_F(DerivedFromAppSrcPluginTest, CreatePipelineWithRegisteredElement)
......@@ -55,15 +55,15 @@ TEST_F(DerivedFromAppSrcPluginTest, SrcPadQueryCapsShouldReturnProperCapsObjects
RefPtr<BaseSrc> basesrc;
basesrc = basesrc.cast_dynamic(source);
ASSERT_TRUE(basesrc);
MM_ASSERT_TRUE(basesrc);
RefPtr<Pad> src_pad = basesrc->get_src_pad();
ASSERT_TRUE(src_pad);
ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
MM_ASSERT_TRUE(src_pad);
MM_ASSERT_TRUE(GST_IS_PAD(src_pad->gobj()));
RefPtr<Caps> caps = src_pad->query_caps(Caps::create_any());
ASSERT_TRUE(caps);
ASSERT_TRUE(caps->gobj());
ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
MM_ASSERT_TRUE(caps);
MM_ASSERT_TRUE(caps->gobj());
MM_ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
RefPtr<Caps> template_caps = Glib::wrap(gst_pad_get_pad_template_caps(src_pad->gobj()), false);
src_pad.reset();
......@@ -91,14 +91,14 @@ TEST_F(DerivedFromAppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
std::string data = "hello world";
RefPtr<Buffer> buf = Buffer::create(data.length() + 1);
ASSERT_TRUE(buf);
MM_ASSERT_TRUE(buf);
MapInfo mapinfo;
ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
MM_ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
strcpy((char *)mapinfo.get_data(), data.c_str());
RefPtr<AppSrc> appsrc;
appsrc = appsrc.cast_dynamic(source);
ASSERT_TRUE(appsrc);
MM_ASSERT_TRUE(appsrc);
EXPECT_EQ(FLOW_OK, appsrc->push_buffer(buf));
......@@ -112,7 +112,7 @@ TEST_F(DerivedFromAppSrcPluginTest, SimpleDataFlowInPipelineWithAppSrcElement)
EXPECT_EQ(FLOW_OK, appsrc->end_of_stream());
RefPtr<Message> msg = pipeline->get_bus()->poll((MessageType)(MESSAGE_EOS | MESSAGE_ERROR) , 1*SECOND);
ASSERT_TRUE(msg);
MM_ASSERT_TRUE(msg);
EXPECT_EQ(MESSAGE_EOS, msg->get_message_type());
EXPECT_EQ(STATE_CHANGE_SUCCESS, pipeline->set_state(STATE_NULL));
}
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/appsink.h>
#include <gstreamermm/appsrc.h>
......@@ -32,9 +32,9 @@ protected:
filter = ElementFactory::create_element("derivedfrombasetransform", "filter");
sink = AppSink::create("sink");
ASSERT_TRUE(source);
ASSERT_TRUE(filter);
ASSERT_TRUE(sink);
MM_ASSERT_TRUE(source);
MM_ASSERT_TRUE(filter);
MM_ASSERT_TRUE(sink);
EXPECT_NO_THROW(pipeline->add(source)->add(filter)->add(sink));
EXPECT_NO_THROW(source->link(filter)->link(sink));
......@@ -45,7 +45,7 @@ TEST_F(DerivedFromBaseTransformPluginTest, CreateRegisteredElement)
{
RefPtr<Element> filter_element = Gst::ElementFactory::create_element("derivedfrombasetransform", "filter");
ASSERT_TRUE(filter_element);
MM_ASSERT_TRUE(filter_element);
}
TEST_F(DerivedFromBaseTransformPluginTest, CreatePipelineWithRegisteredElement)
......@@ -58,28 +58,28 @@ TEST_F(DerivedFromBaseTransformPluginTest, VFuncsShouldReturnProperlyRefcountedG
bool plugin_registered = Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "derivedfrombasetransform", "exemplary element C++-derived from Gst::BaseTransform",
sigc::ptr_fun(&DerivedFromBaseTransform::register_element), "0.123", "LGPL", "source?", "package?",
"http://example.com");
ASSERT_TRUE(plugin_registered);
MM_ASSERT_TRUE(plugin_registered);
Glib::RefPtr<Gst::Element> element = Gst::ElementFactory::create_element("derivedfrombasetransform");
ASSERT_TRUE(element);
MM_ASSERT_TRUE(element);
Glib::RefPtr<DerivedFromBaseTransform> derived_from_base_transform = Glib::RefPtr<DerivedFromBaseTransform>::cast_dynamic(element);
ASSERT_TRUE(derived_from_base_transform);
MM_ASSERT_TRUE(derived_from_base_transform);
{
Glib::RefPtr<Caps> caps = derived_from_base_transform->transform_caps_vfunc(PAD_SINK, Caps::create_any(), Glib::RefPtr<Caps>());
ASSERT_TRUE(caps);
ASSERT_TRUE(caps->gobj());
ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
MM_ASSERT_TRUE(caps);
MM_ASSERT_TRUE(caps->gobj());
MM_ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
ASSERT_EQ(1, caps->gobj()->mini_object.refcount);
}
{
GstBaseTransform *gobj = derived_from_base_transform->gobj();
Glib::RefPtr<Caps> caps = Glib::wrap(GST_BASE_TRANSFORM_GET_CLASS(gobj)->transform_caps(gobj, GST_PAD_SINK, Glib::unwrap(Caps::create_any()), NULL));
ASSERT_TRUE(caps);
ASSERT_TRUE(caps->gobj());
ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
MM_ASSERT_TRUE(caps);
MM_ASSERT_TRUE(caps->gobj());
MM_ASSERT_TRUE(GST_IS_CAPS(caps->gobj()));
ASSERT_EQ(1, caps->get_refcount());
}
}
......@@ -92,10 +92,10 @@ TEST_F(DerivedFromBaseTransformPluginTest, CheckDataFlowThroughCreatedElement)
std::vector<guint8> data = {4, 5, 2, 7, 1};
RefPtr<Buffer> buf = Buffer::create(data.size());
ASSERT_TRUE(buf);
MM_ASSERT_TRUE(buf);
Gst::MapInfo mapinfo;
ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
MM_ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
std::copy(data.begin(), data.end(), mapinfo.get_data());
EXPECT_EQ(FLOW_OK, source->push_buffer(buf));
buf->unmap(mapinfo);
......@@ -103,11 +103,11 @@ TEST_F(DerivedFromBaseTransformPluginTest, CheckDataFlowThroughCreatedElement)
RefPtr<Gst::Buffer> buf_out;
RefPtr<Gst::Sample> samp = sink->pull_preroll();
ASSERT_TRUE(samp);
MM_ASSERT_TRUE(samp);
buf_out = samp->get_buffer();
ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
ASSERT_TRUE(mapinfo.get_data());
ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo.get_data()));
MM_ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
MM_ASSERT_TRUE(mapinfo.get_data());
MM_ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo.get_data()));
buf_out->unmap(mapinfo);
EXPECT_EQ(FLOW_OK, source->end_of_stream());
......
......@@ -5,7 +5,7 @@
* Author: m.kolny
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <string>
#include <gstreamermm/appsink.h>
......@@ -83,13 +83,13 @@ protected:
{
RefPtr<Pipeline> pipeline = Pipeline::create("my-pipeline");
EXPECT_TRUE(pipeline);
EXPECT_TRUE(!!pipeline);
RefPtr<Element> source = ElementFactory::create_element("foosrcmm", "src");
RefPtr<AppSink> sink = AppSink::create("sink");
EXPECT_TRUE(source);
EXPECT_TRUE(sink);
EXPECT_TRUE(!!source);
EXPECT_TRUE(!!sink);
pipeline->add(source)->add(sink);
source->link(sink);
......@@ -102,7 +102,7 @@ TEST_F(PushSrcPluginTest, CreateRegisteredElement)
{
Glib::RefPtr<Gst::Element> source = Gst::ElementFactory::create_element("foosrcmm", "src");
ASSERT_TRUE(source);
MM_ASSERT_TRUE(source);
}
TEST_F(PushSrcPluginTest, DISABLED_CreatePipelineWithRegisteredElement)
......
......@@ -5,7 +5,7 @@
* Author: m.kolny
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/appsink.h>
#include <gstreamermm/appsrc.h>
......@@ -38,9 +38,9 @@ protected:
filter = ElementFactory::create_element("foomm", "filter");
sink = AppSink::create("sink");
ASSERT_TRUE(source);
ASSERT_TRUE(filter);
ASSERT_TRUE(sink);
MM_ASSERT_TRUE(source);
MM_ASSERT_TRUE(filter);
MM_ASSERT_TRUE(sink);
EXPECT_NO_THROW(pipeline->add(source)->add(filter)->add(sink));
EXPECT_NO_THROW(source->link(filter)->link(sink));
......@@ -51,14 +51,14 @@ TEST_F(RegisterPluginTest, CreateRegisteredElement)
{
filter = Gst::ElementFactory::create_element("foomm", "filter");
ASSERT_TRUE(filter);
MM_ASSERT_TRUE(filter);
}
TEST_F(RegisterPluginTest, CheckPropertyUsage)
{
filter = Gst::ElementFactory::create_element("foomm", "filter");
ASSERT_TRUE(filter);
MM_ASSERT_TRUE(filter);
Glib::ustring property_value;
filter->get_property("sample_property", property_value);
......@@ -83,10 +83,10 @@ TEST_F(RegisterPluginTest, CheckDataFlowThroughCreatedElement)
std::vector<guint8> data = {4, 5, 2, 7, 1};
RefPtr<Buffer> buf = Buffer::create(data.size());
ASSERT_TRUE(buf);
MM_ASSERT_TRUE(buf);
Gst::MapInfo mapinfo;
ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
MM_ASSERT_TRUE(buf->map(mapinfo, MAP_WRITE));
std::copy(data.begin(), data.end(), mapinfo.get_data());
EXPECT_EQ(FLOW_OK, source->push_buffer(buf));
buf->unmap(mapinfo);
......@@ -94,12 +94,12 @@ TEST_F(RegisterPluginTest, CheckDataFlowThroughCreatedElement)
RefPtr<Gst::Buffer> buf_out;
RefPtr<Gst::Sample> samp = sink->pull_preroll();
ASSERT_TRUE(samp);
MM_ASSERT_TRUE(samp);
buf_out = samp->get_buffer();
ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
ASSERT_TRUE(mapinfo.get_data());
MM_ASSERT_TRUE(buf_out->map(mapinfo, MAP_READ));
MM_ASSERT_TRUE(mapinfo.get_data());
std::sort(data.begin(), data.end());
ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo.get_data()));
MM_ASSERT_TRUE(std::equal(data.begin(), data.end(), mapinfo.get_data()));
buf_out->unmap(mapinfo);
EXPECT_EQ(FLOW_OK, source->end_of_stream());
......
......@@ -5,7 +5,7 @@
* Author: loganek
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/filesrc.h>
#include <gstreamermm/filesink.h>
......@@ -73,21 +73,21 @@ TEST(BinInPipelineRegressionTest, CustomBinShouldCorrectPassThroughImage)
output_jpg = "resources/test-regression-bininpipeline-output-image.jpg";
mainloop = Glib::MainLoop::create();
ASSERT_TRUE(mainloop);
MM_ASSERT_TRUE(mainloop);
RefPtr<CustomBin> custom_bin = CustomBin::create("file-png-decoder");
ASSERT_TRUE(custom_bin);
MM_ASSERT_TRUE(custom_bin);
RefPtr<Element> queue = ElementFactory::create_element("queue");
ASSERT_TRUE(queue);
MM_ASSERT_TRUE(queue);
RefPtr<FileSink> file_sink = FileSink::create("file-sink");
ASSERT_TRUE(file_sink);
MM_ASSERT_TRUE(file_sink);
RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
ASSERT_TRUE(custom_bin);
MM_ASSERT_TRUE(custom_bin);
ASSERT_NO_THROW(pipeline->add(custom_bin)->add(queue)->add(file_sink));
ASSERT_NO_THROW(custom_bin->link(queue)->link(file_sink));
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
ASSERT_TRUE(bus);
MM_ASSERT_TRUE(bus);
bus->add_watch(sigc::ptr_fun(&on_bus_message));
custom_bin->set_location(input_png);
......
......@@ -5,7 +5,7 @@
* Author: loganek
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <glibmm.h>
......@@ -43,21 +43,21 @@ TEST(BinPluginRegressionTest, DISABLED_ShouldDecodeAndEncodeFile)
output_jpg = "resources/test-regression-binplugin-output-image.jpg";
mainloop = Glib::MainLoop::create();
ASSERT_TRUE(mainloop);
MM_ASSERT_TRUE(mainloop);
RefPtr<Element> pluginbin = Gst::ElementFactory::create_element("pluginbin", "sample-pluginbin");
ASSERT_TRUE(pluginbin);
MM_ASSERT_TRUE(pluginbin);
RefPtr<Element> jpg_encoder = ElementFactory::create_element("queue");
ASSERT_TRUE(jpg_encoder);
MM_ASSERT_TRUE(jpg_encoder);
RefPtr<FileSink> file_sink = FileSink::create("file-sink");
ASSERT_TRUE(file_sink);
MM_ASSERT_TRUE(file_sink);
RefPtr<Pipeline> pipeline = Pipeline::create("image-converter-pipeline");
ASSERT_TRUE(pipeline);
MM_ASSERT_TRUE(pipeline);
ASSERT_NO_THROW(pipeline->add(pluginbin)->add(jpg_encoder)->add(file_sink));
ASSERT_NO_THROW(pluginbin->link(jpg_encoder)->link(file_sink));
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
ASSERT_TRUE(bus);
MM_ASSERT_TRUE(bus);
bus->add_watch(sigc::ptr_fun(&on_bus_message));
pluginbin->set_property("location", input_png);
......@@ -70,5 +70,5 @@ TEST(BinPluginRegressionTest, DISABLED_ShouldDecodeAndEncodeFile)
struct stat st;
stat(output_jpg.c_str(), &st);
ASSERT_TRUE( st.st_size > 0 ); // weak checking
MM_ASSERT_TRUE( st.st_size > 0 ); // weak checking
}
......@@ -5,7 +5,7 @@
* Author: m.kolny
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <glibmm.h>
#include <cstdio>
......@@ -42,14 +42,14 @@ TEST(RegressionRewriteFileTest, CreateAndRewriteFile)
Glib::RefPtr<Gst::Pipeline> pipeline;
RefPtr<FileSrc> filesrc = Gst::FileSrc::create();
ASSERT_TRUE(filesrc);
MM_ASSERT_TRUE(filesrc);
filesrc->property_location() = input_filename;
mainloop = Glib::MainLoop::create();
pipeline = Gst::Pipeline::create("rewriter");
Glib::RefPtr<Gst::FileSink> filesink = Gst::FileSink::create();
ASSERT_TRUE(filesink);
MM_ASSERT_TRUE(filesink);
filesink->property_location() = output_filename;
......
......@@ -5,7 +5,7 @@
* Author: loganek
*/
#include <gtest/gtest.h>
#include "mmtest.h"
#include <gstreamermm.h>
#include <gstreamermm/fakesink.h>
#include <glibmm.h>
......@@ -95,7 +95,7 @@ void on_pad_added(const RefPtr<Pad>& newPad)
PadLinkReturn ret = newPad->link(sink_pad);
ASSERT_TRUE(PAD_LINK_OK == ret || PAD_LINK_WAS_LINKED == ret);
MM_ASSERT_TRUE(PAD_LINK_OK == ret || PAD_LINK_WAS_LINKED == ret);
}