Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1. C++17 2. Compatible with Catch2 2.13.10 #937

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
endif()

#### Set C++ standard level
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
62 changes: 31 additions & 31 deletions tests/AudioWaveformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ TEST_CASE( "Extract waveform data piano.wav", "[libopenshot][audiowaveformer]" )

if (channel == 0) {
CHECK(waveform.rms_samples.size() == 107);
CHECK(waveform.rms_samples[0] == Approx(0.04879f).margin(0.00001));
CHECK(waveform.rms_samples[86] == Approx(0.13578f).margin(0.00001));
CHECK(waveform.rms_samples[87] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.04879f).margin(0.00001));
CHECK(waveform.rms_samples[86] == Detail::Approx(0.13578f).margin(0.00001));
CHECK(waveform.rms_samples[87] == Detail::Approx(0.0f).margin(0.00001));
} else if (channel == 1) {
CHECK(waveform.rms_samples.size() == 107);
CHECK(waveform.rms_samples[0] == Approx(0.04879f).margin(0.00001));
CHECK(waveform.rms_samples[86] == Approx(0.13578f).margin(0.00001));
CHECK(waveform.rms_samples[87] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.04879f).margin(0.00001));
CHECK(waveform.rms_samples[86] == Detail::Approx(0.13578f).margin(0.00001));
CHECK(waveform.rms_samples[87] == Detail::Approx(0.0f).margin(0.00001));
}

waveform.clear();
Expand All @@ -63,14 +63,14 @@ TEST_CASE( "Extract waveform data sintel", "[libopenshot][audiowaveformer]" )

if (channel == 0) {
CHECK(waveform.rms_samples.size() == 1058);
CHECK(waveform.rms_samples[0] == Approx(0.00001f).margin(0.00001));
CHECK(waveform.rms_samples[1037] == Approx(0.00003f).margin(0.00001));
CHECK(waveform.rms_samples[1038] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.00001f).margin(0.00001));
CHECK(waveform.rms_samples[1037] == Detail::Approx(0.00003f).margin(0.00001));
CHECK(waveform.rms_samples[1038] == Detail::Approx(0.0f).margin(0.00001));
} else if (channel == 1) {
CHECK(waveform.rms_samples.size() == 1058);
CHECK(waveform.rms_samples[0] == Approx(0.00001f ).margin(0.00001));
CHECK(waveform.rms_samples[1037] == Approx(0.00003f).margin(0.00001));
CHECK(waveform.rms_samples[1038] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.00001f ).margin(0.00001));
CHECK(waveform.rms_samples[1037] == Detail::Approx(0.00003f).margin(0.00001));
CHECK(waveform.rms_samples[1038] == Detail::Approx(0.0f).margin(0.00001));
}

waveform.clear();
Expand All @@ -93,9 +93,9 @@ TEST_CASE( "Extract waveform data sintel (all channels)", "[libopenshot][audiowa
AudioWaveformData waveform = waveformer.ExtractSamples(-1, 20, false);

CHECK(waveform.rms_samples.size() == 1058);
CHECK(waveform.rms_samples[0] == Approx(0.00001f).margin(0.00001));
CHECK(waveform.rms_samples[1037] == Approx(0.00003f).margin(0.00001));
CHECK(waveform.rms_samples[1038] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.00001f).margin(0.00001));
CHECK(waveform.rms_samples[1037] == Detail::Approx(0.00003f).margin(0.00001));
CHECK(waveform.rms_samples[1038] == Detail::Approx(0.0f).margin(0.00001));

waveform.clear();

Expand All @@ -118,10 +118,10 @@ TEST_CASE( "Normalize & scale waveform data piano.wav", "[libopenshot][audiowave

if (channel == 0) {
CHECK(waveform.rms_samples.size() == 107);
CHECK(waveform.rms_samples[0] == Approx(0.07524f).margin(0.00001));
CHECK(waveform.rms_samples[35] == Approx(0.20063f).margin(0.00001));
CHECK(waveform.rms_samples[86] == Approx(0.2094f).margin(0.00001));
CHECK(waveform.rms_samples[87] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.07524f).margin(0.00001));
CHECK(waveform.rms_samples[35] == Detail::Approx(0.20063f).margin(0.00001));
CHECK(waveform.rms_samples[86] == Detail::Approx(0.2094f).margin(0.00001));
CHECK(waveform.rms_samples[87] == Detail::Approx(0.0f).margin(0.00001));
}

waveform.clear();
Expand Down Expand Up @@ -164,28 +164,28 @@ TEST_CASE( "AudioWaveformData struct methods", "[libopenshot][audiowaveformer]"
waveform.rms_samples[s] = 1.0;
waveform.max_samples[s] = 1.0;
}
CHECK(waveform.rms_samples[0] == Approx(1.0f).margin(0.00001));
CHECK(waveform.rms_samples[9] == Approx(1.0f).margin(0.00001));
CHECK(waveform.max_samples[0] == Approx(1.0f).margin(0.00001));
CHECK(waveform.max_samples[9] == Approx(1.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(1.0f).margin(0.00001));
CHECK(waveform.rms_samples[9] == Detail::Approx(1.0f).margin(0.00001));
CHECK(waveform.max_samples[0] == Detail::Approx(1.0f).margin(0.00001));
CHECK(waveform.max_samples[9] == Detail::Approx(1.0f).margin(0.00001));

// Scale all values by 2
waveform.scale(10, 2.0);
CHECK(waveform.rms_samples.size() == 10);
CHECK(waveform.max_samples.size() == 10);
CHECK(waveform.rms_samples[0] == Approx(2.0f).margin(0.00001));
CHECK(waveform.rms_samples[9] == Approx(2.0f).margin(0.00001));
CHECK(waveform.max_samples[0] == Approx(2.0f).margin(0.00001));
CHECK(waveform.max_samples[9] == Approx(2.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(2.0f).margin(0.00001));
CHECK(waveform.rms_samples[9] == Detail::Approx(2.0f).margin(0.00001));
CHECK(waveform.max_samples[0] == Detail::Approx(2.0f).margin(0.00001));
CHECK(waveform.max_samples[9] == Detail::Approx(2.0f).margin(0.00001));

// Zero out all values
waveform.zero(10);
CHECK(waveform.rms_samples.size() == 10);
CHECK(waveform.max_samples.size() == 10);
CHECK(waveform.rms_samples[0] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[9] == Approx(0.0f).margin(0.00001));
CHECK(waveform.max_samples[0] == Approx(0.0f).margin(0.00001));
CHECK(waveform.max_samples[9] == Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[0] == Detail::Approx(0.0f).margin(0.00001));
CHECK(waveform.rms_samples[9] == Detail::Approx(0.0f).margin(0.00001));
CHECK(waveform.max_samples[0] == Detail::Approx(0.0f).margin(0.00001));
CHECK(waveform.max_samples[9] == Detail::Approx(0.0f).margin(0.00001));

// Access vectors and verify size
std::vector<std::vector<float>> vectors = waveform.vectors();
Expand Down
16 changes: 8 additions & 8 deletions tests/CVTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ TEST_CASE( "Track_Video", "[libopenshot][opencv][tracker]" )
int height = ((float)fd.y2*360) - y;

// Compare if tracked data is equal to pre-tested ones
CHECK(x == Approx(256).margin(1));
CHECK(y == Approx(132).margin(1));
CHECK(width == Approx(180).margin(1));
CHECK(height == Approx(166).margin(2));
CHECK(x == Detail::Approx(256).margin(1));
CHECK(y == Detail::Approx(132).margin(1));
CHECK(width == Detail::Approx(180).margin(1));
CHECK(height == Detail::Approx(166).margin(2));
}


Expand Down Expand Up @@ -178,9 +178,9 @@ TEST_CASE( "SaveLoad_Protobuf", "[libopenshot][opencv][tracker]" )
float height_2 = fd_2.y2 - y_2;

// Compare first tracker data with second tracker data
CHECK(x_1 == Approx(x_2).margin(0.01));
CHECK(y_1 == Approx(y_2).margin(0.01));
CHECK(width_1 == Approx(width_2).margin(0.01));
CHECK(height_1 == Approx(height_2).margin(0.01));
CHECK(x_1 == Detail::Approx(x_2).margin(0.01));
CHECK(y_1 == Detail::Approx(y_2).margin(0.01));
CHECK(width_1 == Detail::Approx(width_2).margin(0.01));
CHECK(height_1 == Detail::Approx(height_2).margin(0.01));

}
26 changes: 13 additions & 13 deletions tests/Caption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ TEST_CASE( "caption effect", "[libopenshot][caption]" )
CHECK(c1.color.GetColorHex(1) == "#ffffff");
CHECK(c1.stroke.GetColorHex(1) == "#a9a9a9");
CHECK(c1.background.GetColorHex(1) == "#000000");
CHECK(c1.background_alpha.GetValue(1) == Approx(0.0f).margin(0.00001));
CHECK(c1.left.GetValue(1) == Approx(0.10f).margin(0.00001));
CHECK(c1.right.GetValue(1) == Approx(0.10f).margin(0.00001));
CHECK(c1.top.GetValue(1) == Approx(0.75).margin(0.00001));
CHECK(c1.stroke_width.GetValue(1) == Approx(0.5f).margin(0.00001));
CHECK(c1.font_size.GetValue(1) == Approx(30.0f).margin(0.00001));
CHECK(c1.font_alpha.GetValue(1) == Approx(1.0f).margin(0.00001));
CHECK(c1.background_alpha.GetValue(1) == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.left.GetValue(1) == Detail::Approx(0.10f).margin(0.00001));
CHECK(c1.right.GetValue(1) == Detail::Approx(0.10f).margin(0.00001));
CHECK(c1.top.GetValue(1) == Detail::Approx(0.75).margin(0.00001));
CHECK(c1.stroke_width.GetValue(1) == Detail::Approx(0.5f).margin(0.00001));
CHECK(c1.font_size.GetValue(1) == Detail::Approx(30.0f).margin(0.00001));
CHECK(c1.font_alpha.GetValue(1) == Detail::Approx(1.0f).margin(0.00001));
CHECK(c1.font_name == "sans");
CHECK(c1.fade_in.GetValue(1) == Approx(0.35f).margin(0.00001));
CHECK(c1.fade_out.GetValue(1) == Approx(0.35f).margin(0.00001));
CHECK(c1.background_corner.GetValue(1) == Approx(10.0f).margin(0.00001));
CHECK(c1.background_padding.GetValue(1) == Approx(20.0f).margin(0.00001));
CHECK(c1.line_spacing.GetValue(1) == Approx(1.0f).margin(0.00001));
CHECK(c1.fade_in.GetValue(1) == Detail::Approx(0.35f).margin(0.00001));
CHECK(c1.fade_out.GetValue(1) == Detail::Approx(0.35f).margin(0.00001));
CHECK(c1.background_corner.GetValue(1) == Detail::Approx(10.0f).margin(0.00001));
CHECK(c1.background_padding.GetValue(1) == Detail::Approx(20.0f).margin(0.00001));
CHECK(c1.line_spacing.GetValue(1) == Detail::Approx(1.0f).margin(0.00001));
CHECK(c1.CaptionText() == "00:00:00:000 --> 00:10:00:000\nEdit this caption with our caption editor");

// Load clip with video
Expand Down Expand Up @@ -229,4 +229,4 @@ TEST_CASE( "caption effect", "[libopenshot][caption]" )

// Close QApplication
app.quit();
}
}
50 changes: 25 additions & 25 deletions tests/Clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ TEST_CASE( "default constructor", "[libopenshot][clip]" )
CHECK(c1.gravity == GRAVITY_CENTER);
CHECK(c1.scale == SCALE_FIT);
CHECK(c1.Layer() == 0);
CHECK(c1.Position() == Approx(0.0f).margin(0.00001));
CHECK(c1.Start() == Approx(0.0f).margin(0.00001));
CHECK(c1.End() == Approx(0.0f).margin(0.00001));
CHECK(c1.Position() == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.Start() == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.End() == Detail::Approx(0.0f).margin(0.00001));
}

TEST_CASE( "path string constructor", "[libopenshot][clip]" )
Expand All @@ -61,9 +61,9 @@ TEST_CASE( "path string constructor", "[libopenshot][clip]" )
CHECK(c1.gravity == GRAVITY_CENTER);
CHECK(c1.scale == SCALE_FIT);
CHECK(c1.Layer() == 0);
CHECK(c1.Position() == Approx(0.0f).margin(0.00001));
CHECK(c1.Start() == Approx(0.0f).margin(0.00001));
CHECK(c1.End() == Approx(4.39937f).margin(0.00001));
CHECK(c1.Position() == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.Start() == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.End() == Detail::Approx(4.39937f).margin(0.00001));
}

TEST_CASE( "basic getters and setters", "[libopenshot][clip]" )
Expand All @@ -77,9 +77,9 @@ TEST_CASE( "basic getters and setters", "[libopenshot][clip]" )
CHECK(c1.gravity == GRAVITY_CENTER);
CHECK(c1.scale == SCALE_FIT);
CHECK(c1.Layer() == 0);
CHECK(c1.Position() == Approx(0.0f).margin(0.00001));
CHECK(c1.Start() == Approx(0.0f).margin(0.00001));
CHECK(c1.End() == Approx(0.0f).margin(0.00001));
CHECK(c1.Position() == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.Start() == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.End() == Detail::Approx(0.0f).margin(0.00001));

// Change some properties
c1.Layer(1);
Expand All @@ -88,9 +88,9 @@ TEST_CASE( "basic getters and setters", "[libopenshot][clip]" )
c1.End(10.5);

CHECK(c1.Layer() == 1);
CHECK(c1.Position() == Approx(5.0f).margin(0.00001));
CHECK(c1.Start() == Approx(3.5f).margin(0.00001));
CHECK(c1.End() == Approx(10.5f).margin(0.00001));
CHECK(c1.Position() == Detail::Approx(5.0f).margin(0.00001));
CHECK(c1.Start() == Detail::Approx(3.5f).margin(0.00001));
CHECK(c1.End() == Detail::Approx(10.5f).margin(0.00001));
}

TEST_CASE( "properties", "[libopenshot][clip]" )
Expand Down Expand Up @@ -121,7 +121,7 @@ TEST_CASE( "properties", "[libopenshot][clip]" )
CHECK(success == true);

// Check for specific things
CHECK(root["alpha"]["value"].asDouble() == Approx(1.0f).margin(0.01));
CHECK(root["alpha"]["value"].asDouble() == Detail::Approx(1.0f).margin(0.01));
CHECK(root["alpha"]["keyframe"].asBool() == true);

// Get properties JSON string at frame 250
Expand All @@ -136,7 +136,7 @@ TEST_CASE( "properties", "[libopenshot][clip]" )
CHECK(success == true);

// Check for specific things
CHECK(root["alpha"]["value"].asDouble() == Approx(0.5f).margin(0.01));
CHECK(root["alpha"]["value"].asDouble() == Detail::Approx(0.5f).margin(0.01));
CHECK_FALSE(root["alpha"]["keyframe"].asBool());

// Get properties JSON string at frame 250 (again)
Expand Down Expand Up @@ -165,7 +165,7 @@ TEST_CASE( "properties", "[libopenshot][clip]" )
CHECK(success == true);

// Check for specific things
CHECK(root["alpha"]["value"].asDouble() == Approx(0.0f).margin(0.00001));
CHECK(root["alpha"]["value"].asDouble() == Detail::Approx(0.0f).margin(0.00001));
CHECK(root["alpha"]["keyframe"].asBool() == true);

// Free up the reader we allocated
Expand Down Expand Up @@ -321,23 +321,23 @@ TEST_CASE( "access frames past reader length", "[libopenshot][clip]" )
// Get the last valid frame #
std::shared_ptr<openshot::Frame> frame = c1.GetFrame(30);

CHECK(frame->GetAudioSamples(0)[0] == Approx(30.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[600] == Approx(30.4081631).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[1200] == Approx(30.8163261).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[0] == Detail::Approx(30.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[600] == Detail::Approx(30.4081631).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[1200] == Detail::Approx(30.8163261).margin(0.00001));

// Get the +1 past the end of the reader (should be audio silence)
frame = c1.GetFrame(31);

CHECK(frame->GetAudioSamples(0)[0] == Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[600] == Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[1200] == Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[0] == Detail::Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[600] == Detail::Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[1200] == Detail::Approx(0.0).margin(0.00001));

// Get the +2 past the end of the reader (should be audio silence)
frame = c1.GetFrame(32);

CHECK(frame->GetAudioSamples(0)[0] == Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[600] == Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[1200] == Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[0] == Detail::Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[600] == Detail::Approx(0.0).margin(0.00001));
CHECK(frame->GetAudioSamples(0)[1200] == Detail::Approx(0.0).margin(0.00001));
}

TEST_CASE( "setting and clobbering readers", "[libopenshot][clip]" )
Expand Down Expand Up @@ -489,4 +489,4 @@ TEST_CASE( "resample_audio_8000_to_48000_reverse", "[libopenshot][clip]" )
map.Close();
reader.Close();
clip.Close();
}
}
40 changes: 20 additions & 20 deletions tests/Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ TEST_CASE( "default constructor", "[libopenshot][color]" )
// Create an empty color
openshot::Color c1;

CHECK(c1.red.GetValue(0) == Approx(0.0f).margin(0.00001));
CHECK(c1.green.GetValue(0) == Approx(0.0f).margin(0.00001));
CHECK(c1.blue.GetValue(0) == Approx(0.0f).margin(0.00001));
CHECK(c1.red.GetValue(0) == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.green.GetValue(0) == Detail::Approx(0.0f).margin(0.00001));
CHECK(c1.blue.GetValue(0) == Detail::Approx(0.0f).margin(0.00001));
}

TEST_CASE( "Keyframe constructor", "[libopenshot][color]" )
Expand All @@ -41,10 +41,10 @@ TEST_CASE( "Keyframe constructor", "[libopenshot][color]" )
}
auto c = openshot::Color(kfs[0], kfs[1], kfs[2], kfs[3]);

CHECK(c.red.GetLong(100) == Approx(20).margin(0.01));
CHECK(c.green.GetLong(100) == Approx(40).margin(0.01));
CHECK(c.blue.GetLong(100) == Approx(60).margin(0.01));
CHECK(c.alpha.GetLong(100) == Approx(80).margin(0.01));
CHECK(c.red.GetLong(100) == Detail::Approx(20).margin(0.01));
CHECK(c.green.GetLong(100) == Detail::Approx(40).margin(0.01));
CHECK(c.blue.GetLong(100) == Detail::Approx(60).margin(0.01));
CHECK(c.alpha.GetLong(100) == Detail::Approx(80).margin(0.01));
}

TEST_CASE( "Animate_Colors", "[libopenshot][color]" )
Expand All @@ -63,9 +63,9 @@ TEST_CASE( "Animate_Colors", "[libopenshot][color]" )
c1.blue.AddPoint(1000, 65);

// Check the color at frame 500
CHECK(c1.red.GetLong(500) == Approx(0).margin(0.01));
CHECK(c1.green.GetLong(500) == Approx(187).margin(0.01));
CHECK(c1.blue.GetLong(500) == Approx(160).margin(0.01));
CHECK(c1.red.GetLong(500) == Detail::Approx(0).margin(0.01));
CHECK(c1.green.GetLong(500) == Detail::Approx(187).margin(0.01));
CHECK(c1.blue.GetLong(500) == Detail::Approx(160).margin(0.01));
}

TEST_CASE( "HEX_Value", "[libopenshot][color]" )
Expand All @@ -90,10 +90,10 @@ TEST_CASE( "QColor ctor", "[libopenshot][color]" )
QColor qc(Qt::red);
openshot::Color c(qc);

CHECK(c.red.GetLong(1) == Approx(255.0).margin(0.0001));
CHECK(c.green.GetLong(1) == Approx(0.0).margin(0.0001));
CHECK(c.blue.GetLong(1) == Approx(0.0).margin(0.0001));
CHECK(c.alpha.GetLong(1) == Approx(255.0).margin(0.0001));
CHECK(c.red.GetLong(1) == Detail::Approx(255.0).margin(0.0001));
CHECK(c.green.GetLong(1) == Detail::Approx(0.0).margin(0.0001));
CHECK(c.blue.GetLong(1) == Detail::Approx(0.0).margin(0.0001));
CHECK(c.alpha.GetLong(1) == Detail::Approx(255.0).margin(0.0001));
}

TEST_CASE( "std::string construction", "[libopenshot][color]" )
Expand Down Expand Up @@ -121,12 +121,12 @@ TEST_CASE( "Distance", "[libopenshot][color]" )
openshot::Color::GetDistance(
c1.red.GetInt(1), c1.blue.GetInt(1), c1.green.GetInt(1),
c2.red.GetInt(1), c2.blue.GetInt(1), c2.green.GetInt(1)
) == Approx(19.0f).margin(0.001));
) == Detail::Approx(19.0f).margin(0.001));
CHECK(
openshot::Color::GetDistance(
c3.red.GetInt(1), c3.blue.GetInt(1), c3.green.GetInt(1),
c4.red.GetInt(1), c4.blue.GetInt(1), c4.green.GetInt(1)
) == Approx(764.0f).margin(0.001));
) == Detail::Approx(764.0f).margin(0.001));
}

TEST_CASE( "RGBA_Constructor", "[libopenshot][color]" )
Expand Down Expand Up @@ -177,8 +177,8 @@ TEST_CASE( "SetJson", "[libopenshot][color]" ) {
openshot::Color c;
CHECK_THROWS_AS(c.SetJson("}{"), openshot::InvalidJSON);
c.SetJson(json_input);
CHECK(c.red.GetLong(10) == Approx(0).margin(0.01));
CHECK(c.green.GetLong(10) == Approx(128).margin(0.01));
CHECK(c.blue.GetLong(10) == Approx(64).margin(0.01));
CHECK(c.alpha.GetLong(10) == Approx(192).margin(0.01));
CHECK(c.red.GetLong(10) == Detail::Approx(0).margin(0.01));
CHECK(c.green.GetLong(10) == Detail::Approx(128).margin(0.01));
CHECK(c.blue.GetLong(10) == Detail::Approx(64).margin(0.01));
CHECK(c.alpha.GetLong(10) == Detail::Approx(192).margin(0.01));
}