Tests: test << for Coordinate, Fraction, Point

This commit is contained in:
FeRD (Frank Dana)
2020-11-27 00:34:59 -05:00
parent bf80251a49
commit 032ca616dc
2 changed files with 36 additions and 0 deletions

View File

@@ -32,6 +32,10 @@
#include "Fraction.h"
#include <map>
#include <vector>
#include <sstream>
using namespace std;
using namespace openshot;
@@ -148,3 +152,12 @@ TEST_CASE( "Reciprocal", "[libopenshot][fraction]" )
CHECK(f1.ToFloat() == Approx(1.77777f).margin(0.00001));
CHECK(f1.ToDouble() == Approx(1.77777f).margin(0.00001));
}
TEST_CASE( "Operator ostream", "[libopenshot][fraction]" )
{
std::stringstream output;
openshot::Fraction f3(30000, 1001);
output << f3;
CHECK(output.str() == "Fraction(30000, 1001)");
}

View File

@@ -188,3 +188,26 @@ TEST_CASE( "SetJson", "[libopenshot][point]" )
CHECK(p1.handle_type == openshot::HandleType::MANUAL);
CHECK(p1.interpolation == openshot::InterpolationType::CONSTANT);
}
TEST_CASE( "Operator ostream", "[libopenshot][point]" )
{
openshot::Coordinate c1(10, 5);
std::stringstream output1;
openshot::Point p1(c1, openshot::InterpolationType::LINEAR);
output1 << p1;
CHECK(output1.str() == "co(10, 5) interpolation(LINEAR)");
std::stringstream output2;
openshot::Point p2(c1, openshot::InterpolationType::CONSTANT);
output2 << p2;
CHECK(output2.str() == "co(10, 5) interpolation(CONSTANT)");
std::stringstream output3;
openshot::Point p3(c1, openshot::InterpolationType::BEZIER);
output3 << p3;
CHECK(
output3.str() ==
"co(10, 5) interpolation(BEZIER) handle_left(0.5, 1) handle_right(0.5, 0)");
}