From ed77db81d2c5456163230dac2695f2d618fbf228 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Sat, 26 Dec 2020 06:03:30 -0500 Subject: [PATCH] Unit tests: Don't use OpenShot.h header - To prevent slow compiles of unit tests, replace all of the '#include "OpenShot.h"' invocations with includes of the individual headers actually needed by each test file. Revert "Unit tests: Don't use OpenShot.h header" This reverts commit e5cc4f8bf91fc60697996023a86dc618637f6161. Unit tests: Don't use OpenShot.h header - To prevent slow compiles of unit tests, replace all of the '#include "OpenShot.h"' invocations with includes of the individual headers actually needed by each test file. --- tests/Cache_Tests.cpp | 7 ++++++- tests/Clip_Tests.cpp | 10 ++++++++-- tests/Color_Tests.cpp | 7 ++++++- tests/Coordinate_Tests.cpp | 3 +-- tests/DummyReader_Tests.cpp | 9 +++++++-- tests/FFmpegReader_Tests.cpp | 9 +++++++-- tests/FFmpegWriter_Tests.cpp | 8 +++++++- tests/Fraction_Tests.cpp | 2 +- tests/Frame_Tests.cpp | 7 ++++++- tests/ImageWriter_Tests.cpp | 11 +++++++++-- tests/KeyFrame_Tests.cpp | 5 ++++- tests/Point_Tests.cpp | 5 ++++- tests/ReaderBase_Tests.cpp | 7 ++++++- tests/Settings_Tests.cpp | 2 +- tests/Timeline_Tests.cpp | 11 ++++++++++- 15 files changed, 83 insertions(+), 20 deletions(-) diff --git a/tests/Cache_Tests.cpp b/tests/Cache_Tests.cpp index d834a003..1220cf14 100644 --- a/tests/Cache_Tests.cpp +++ b/tests/Cache_Tests.cpp @@ -28,12 +28,17 @@ * along with OpenShot Library. If not, see . */ +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "CacheDisk.h" +#include "CacheMemory.h" #include "Json.h" +#include + using namespace openshot; TEST(Cache_Default_Constructor) diff --git a/tests/Clip_Tests.cpp b/tests/Clip_Tests.cpp index 17757be2..87272427 100644 --- a/tests/Clip_Tests.cpp +++ b/tests/Clip_Tests.cpp @@ -28,6 +28,9 @@ * along with OpenShot Library. If not, see . */ +#include +#include + #include "UnitTest++.h" // Work around older versions of UnitTest++ without REQUIRE @@ -37,7 +40,11 @@ // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Clip.h" +#include "Frame.h" +#include "Fraction.h" +#include "Timeline.h" +#include "Json.h" using namespace openshot; @@ -255,4 +262,3 @@ TEST(Verify_Parent_Timeline) } } // SUITE - diff --git a/tests/Color_Tests.cpp b/tests/Color_Tests.cpp index 388ac5ef..6827ddf0 100644 --- a/tests/Color_Tests.cpp +++ b/tests/Color_Tests.cpp @@ -28,10 +28,15 @@ * along with OpenShot Library. If not, see . */ +#include +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Color.h" +#include "KeyFrame.h" +#include "Json.h" SUITE(Color) { diff --git a/tests/Coordinate_Tests.cpp b/tests/Coordinate_Tests.cpp index b57af38f..0ed4a46a 100644 --- a/tests/Coordinate_Tests.cpp +++ b/tests/Coordinate_Tests.cpp @@ -31,9 +31,8 @@ #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Coordinate.h" -using namespace std; using namespace openshot; TEST(Coordinate_Default_Constructor) diff --git a/tests/DummyReader_Tests.cpp b/tests/DummyReader_Tests.cpp index b889391f..f2f1823d 100644 --- a/tests/DummyReader_Tests.cpp +++ b/tests/DummyReader_Tests.cpp @@ -28,11 +28,16 @@ * along with OpenShot Library. If not, see . */ +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "DummyReader.h" +#include "CacheMemory.h" +#include "Fraction.h" +#include "Frame.h" using namespace std; using namespace openshot; @@ -146,4 +151,4 @@ TEST (DummyReader_Invalid_Fake_Frame) { // Clean up cache.Clear(); r.Close(); -} \ No newline at end of file +} diff --git a/tests/FFmpegReader_Tests.cpp b/tests/FFmpegReader_Tests.cpp index b1827432..a72fd90e 100644 --- a/tests/FFmpegReader_Tests.cpp +++ b/tests/FFmpegReader_Tests.cpp @@ -28,10 +28,16 @@ * along with OpenShot Library. If not, see . */ +#include +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "FFmpegReader.h" +#include "Frame.h" +#include "Timeline.h" +#include "Json.h" using namespace std; using namespace openshot; @@ -272,4 +278,3 @@ TEST(Verify_Parent_Timeline) } } // SUITE(FFmpegReader) - diff --git a/tests/FFmpegWriter_Tests.cpp b/tests/FFmpegWriter_Tests.cpp index 83764b61..606b359d 100644 --- a/tests/FFmpegWriter_Tests.cpp +++ b/tests/FFmpegWriter_Tests.cpp @@ -28,10 +28,16 @@ * along with OpenShot Library. If not, see . */ +#include +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "FFmpegWriter.h" +#include "FFmpegReader.h" +#include "Fraction.h" +#include "Frame.h" using namespace std; using namespace openshot; diff --git a/tests/Fraction_Tests.cpp b/tests/Fraction_Tests.cpp index b061ba48..d2ef24ad 100644 --- a/tests/Fraction_Tests.cpp +++ b/tests/Fraction_Tests.cpp @@ -31,7 +31,7 @@ #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Fraction.h" using namespace std; using namespace openshot; diff --git a/tests/Frame_Tests.cpp b/tests/Frame_Tests.cpp index e5562523..f1049ca0 100644 --- a/tests/Frame_Tests.cpp +++ b/tests/Frame_Tests.cpp @@ -29,10 +29,15 @@ * along with OpenShot Library. If not, see . */ +#include +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Frame.h" +#include "Clip.h" +#include "Fraction.h" #include diff --git a/tests/ImageWriter_Tests.cpp b/tests/ImageWriter_Tests.cpp index e4e500dd..36b1288a 100644 --- a/tests/ImageWriter_Tests.cpp +++ b/tests/ImageWriter_Tests.cpp @@ -28,15 +28,22 @@ * along with OpenShot Library. If not, see . */ +#include +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" + +#ifdef USE_IMAGEMAGICK +#include "ImageWriter.h" +#include "ImageReader.h" +#include "FFmpegReader.h" +#include "Frame.h" using namespace std; using namespace openshot; -#ifdef USE_IMAGEMAGICK SUITE(ImageWriter) { diff --git a/tests/KeyFrame_Tests.cpp b/tests/KeyFrame_Tests.cpp index 84025165..24573f92 100644 --- a/tests/KeyFrame_Tests.cpp +++ b/tests/KeyFrame_Tests.cpp @@ -31,7 +31,10 @@ #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "KeyFrame.h" +#include "Coordinate.h" +#include "Fraction.h" +#include "Point.h" using namespace std; using namespace openshot; diff --git a/tests/Point_Tests.cpp b/tests/Point_Tests.cpp index cce78337..6a94dda5 100644 --- a/tests/Point_Tests.cpp +++ b/tests/Point_Tests.cpp @@ -31,7 +31,10 @@ #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Point.h" +#include "Enums.h" +#include "Coordinate.h" +#include "Json.h" SUITE(POINT) { diff --git a/tests/ReaderBase_Tests.cpp b/tests/ReaderBase_Tests.cpp index 3e68b40d..dec61efd 100644 --- a/tests/ReaderBase_Tests.cpp +++ b/tests/ReaderBase_Tests.cpp @@ -28,10 +28,15 @@ * along with OpenShot Library. If not, see . */ +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "ReaderBase.h" +#include "CacheBase.h" +#include "Frame.h" +#include "Json.h" using namespace std; using namespace openshot; diff --git a/tests/Settings_Tests.cpp b/tests/Settings_Tests.cpp index cc7b86d2..62dd2e23 100644 --- a/tests/Settings_Tests.cpp +++ b/tests/Settings_Tests.cpp @@ -31,7 +31,7 @@ #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Settings.h" using namespace std; using namespace openshot; diff --git a/tests/Timeline_Tests.cpp b/tests/Timeline_Tests.cpp index 0956366f..2a9cd632 100644 --- a/tests/Timeline_Tests.cpp +++ b/tests/Timeline_Tests.cpp @@ -28,10 +28,19 @@ * along with OpenShot Library. If not, see . */ +#include +#include +#include + #include "UnitTest++.h" // Prevent name clashes with juce::UnitTest #define DONT_SET_USING_JUCE_NAMESPACE 1 -#include "OpenShot.h" +#include "Timeline.h" +#include "Clip.h" +#include "Frame.h" +#include "Fraction.h" +#include "effects/Blur.h" +#include "effects/Negate.h" using namespace std; using namespace openshot;