-
Notifications
You must be signed in to change notification settings - Fork 261
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
Make console-output functions redirectable; add operator<< for Fraction, Point, Coordinate; new KeyFrame::PrintPoints & PrintValues with unit tests #661
Conversation
LOL. Which, of course, leads to CodeCov spanking me for not having sufficient coverage of the lines changed in the PR. Typical. |
Codecov Report
@@ Coverage Diff @@
## develop #661 +/- ##
===========================================
+ Coverage 46.24% 47.31% +1.06%
===========================================
Files 182 185 +3
Lines 16701 16839 +138
===========================================
+ Hits 7724 7968 +244
+ Misses 8977 8871 -106
Continue to review full report at Codecov.
|
ad764da
to
94cd4c0
Compare
Merge conflicts have been detected on this PR, please resolve. |
Merge conflicts have been detected on this PR, please resolve. |
- The function now takes a pointer to the output stream it will write to. The _default_ for that argument is a pointer to std::cout. - Any unit tests which wish to test the functionality can capture the output by passing an alternate buffer: std::stringstream output; reader.DisplayInfo(&output); CHECK(output.str() == "Expected output");
d05d61f
to
6a1579e
Compare
Well, having heard nothing on this after many months, I'm going to merge it. 😞 |
Redirectable output functions
To enable unit-testing of functions like
ReaderBase::DisplayInfo()
andKeyframe::PrintPoints()
(which normally dump information tostd::cout
), each such function has been updated to have a signature like this:The function now takes a pointer to the output stream to use, with
std::cout
being only the overridable default for that stream. In the output function,*out
is streamed to instead of the hardcodedstd::cout
:This makes it possible to unit test the functions by passing an alternate stream, then examining the captured output:
Unit tests for
ReaderBase::DisplayInfo()
(viaFFmpegReader
),WriterBase::DisplayInfo()
(viaFFmpegWriter
), andFrameMapper::PrintMapping()
are included in the PR.Output-stream compatible formatting for Coordinate, Point, Fraction
Also, the
operator<<
overloads takingopenshot::Coordinate
,openshot::Point
, andopenshot::Fraction
which I'd written for another PR that ended up on hold are included here, along with their unit tests.Updated
Keyframe::PrintPoints()
andKeyframe::PrintValues()
The new
operator<<(openshot::Fraction)
is used as part of a newKeyFrame::PrintValues()
implementation;KeyFrame::PrintPoints()
is also updated. Both have new unit tests. Sample output:(Ick! Way to screw up the formatting, Github! Well, it looks right on my screen:)