Skip to content

Commit

Permalink
Remove OpenShot.h from OpenCV unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Dec 26, 2020
1 parent ed77db8 commit f21cf35
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
11 changes: 7 additions & 4 deletions tests/CVObjectDetection_Tests.cpp
Expand Up @@ -29,13 +29,16 @@
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/

#include <sstream>
#include <memory>

#include "UnitTest++.h"
// Prevent name clashes with juce::UnitTest
#define DONT_SET_USING_JUCE_NAMESPACE 1
#include "OpenShot.h"
//#include "ProcessingController.h"
//#include "Json.h"
#include <QImage>
#include "Clip.h"
#include "CVObjectDetection.h"
#include "ProcessingController.h"
#include "Json.h"

using namespace openshot;

Expand Down
17 changes: 10 additions & 7 deletions tests/CVStabilizer_Tests.cpp
Expand Up @@ -29,12 +29,15 @@
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/

#include <sstream>
#include <memory>

#include "UnitTest++.h"
// Prevent name clashes with juce::UnitTest
#define DONT_SET_USING_JUCE_NAMESPACE 1
#include "OpenShot.h"
//#include "ProcessingController.h"
#include <QImage>
#include "Clip.h"
#include "CVStabilization.h" // for TransformParam, CamTrajectory, CVStabilization
#include "ProcessingController.h"

using namespace openshot;

Expand All @@ -56,10 +59,10 @@ SUITE(CVStabilizer_Tests)

std::string json_data = R"proto(
{
"protobuf_data_path": "stabilizer.data",
"smoothing-window": 30
"protobuf_data_path": "stabilizer.data",
"smoothing-window": 30
} )proto";

// Create stabilizer
CVStabilization stabilizer(json_data, processingController);

Expand Down Expand Up @@ -100,7 +103,7 @@ SUITE(CVStabilizer_Tests)

std::string json_data = R"proto(
{
"protobuf_data_path": "stabilizer.data",
"protobuf_data_path": "stabilizer.data",
"smoothing-window": 30
} )proto";

Expand Down
23 changes: 13 additions & 10 deletions tests/CVTracker_Tests.cpp
Expand Up @@ -29,12 +29,15 @@
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/

#include <sstream>
#include <memory>

#include "UnitTest++.h"
// Prevent name clashes with juce::UnitTest
#define DONT_SET_USING_JUCE_NAMESPACE 1
#include "OpenShot.h"
//#include "ProcessingController.h"
#include <QImage>
#include "Clip.h"
#include "CVTracker.h" // for FrameData, CVTracker
#include "ProcessingController.h"

using namespace openshot;

Expand All @@ -56,14 +59,14 @@ SUITE(CVTracker_Tests)

std::string json_data = R"proto(
{
"protobuf_data_path": "kcf_tracker.data",
"tracker-type": "KCF",
"protobuf_data_path": "kcf_tracker.data",
"tracker-type": "KCF",
"region": {"x": 294, "y": 102, "width": 180, "height": 166, "first-frame": 0}
} )proto";

// Create tracker
CVTracker kcfTracker(json_data, processingController);

// Track clip for frames 0-20
kcfTracker.trackClip(c1, 0, 20, true);
// Get tracked data
Expand Down Expand Up @@ -94,8 +97,8 @@ SUITE(CVTracker_Tests)

std::string json_data = R"proto(
{
"protobuf_data_path": "kcf_tracker.data",
"tracker-type": "KCF",
"protobuf_data_path": "kcf_tracker.data",
"tracker-type": "KCF",
"region": {"x": 294, "y": 102, "width": 180, "height": 166, "first-frame": 0}
} )proto";

Expand All @@ -119,8 +122,8 @@ SUITE(CVTracker_Tests)

std::string proto_data_1 = R"proto(
{
"protobuf_data_path": "kcf_tracker.data",
"tracker_type": "",
"protobuf_data_path": "kcf_tracker.data",
"tracker_type": "",
"region": {"x": -1, "y": -1, "width": -1, "height": -1, "first-frame": 0}
} )proto";

Expand Down
4 changes: 4 additions & 0 deletions tests/Frame_Tests.cpp
Expand Up @@ -41,6 +41,10 @@

#include <QImage>

#ifdef USE_OPENCV
#include <opencv2/core.hpp>
#endif

using namespace openshot;

SUITE(Frame_Tests)
Expand Down

0 comments on commit f21cf35

Please sign in to comment.