You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
# This is a combination of 2 commits.
# This is the 1st commit message: Coordinate: Add std::pair constructor # This is the commit message #2: Fix std::pair member types
This commit is contained in:
@@ -40,7 +40,7 @@ Coordinate::Coordinate() : Coordinate::Coordinate(0, 0) {};
|
||||
Coordinate::Coordinate(double x, double y) : X(x), Y(y) {};
|
||||
|
||||
// Constructor which accepts a std::pair for (X, Y)
|
||||
Coordinate::Coordinate(const std::pair<int, int>& co)
|
||||
Coordinate::Coordinate(const std::pair<double, double>& co)
|
||||
: X(co.first), Y(co.second) {};
|
||||
|
||||
// Generate JSON string of this object
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace openshot {
|
||||
Coordinate(double x, double y);
|
||||
|
||||
/// @brief Constructor which accepts a std::pair tuple for {X, Y}
|
||||
/// @param co A std::pair<int, int> tuple containing (X, Y)
|
||||
Coordinate(const std::pair<int, int>& co);
|
||||
/// @param co A std::pair<double, double> tuple containing (X, Y)
|
||||
Coordinate(const std::pair<double, double>& co);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
|
||||
@@ -57,6 +57,13 @@ TEST(X_Y_Constructor)
|
||||
CHECK_CLOSE(8.0f, c1.Y, 0.00001);
|
||||
}
|
||||
|
||||
TEST(Pair_Constructor)
|
||||
{
|
||||
Coordinate c1(std::pair<double,double>(12, 10));
|
||||
CHECK_CLOSE(12.0f, c1.X, 0.00001);
|
||||
CHECK_CLOSE(10.0f, c1.Y, 0.00001);
|
||||
}
|
||||
|
||||
TEST(Json)
|
||||
{
|
||||
openshot::Coordinate c(100, 200);
|
||||
|
||||
Reference in New Issue
Block a user