File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,9 @@ jobs:
202202
203203 - name : Test libopenshot
204204 run : |
205+ # Allow unit tests which require a display screen
206+ export DISPLAY=:0.0
207+ export QT_QPA_PLATFORM=offscreen
205208 cmake --build build --target coverage -- VERBOSE=1
206209
207210 - name : Install libopenshot
Original file line number Diff line number Diff line change @@ -204,10 +204,10 @@ std::shared_ptr<openshot::Frame> Caption::GetFrame(std::shared_ptr<openshot::Fra
204204 // Wrap languages which do not use spaces
205205 bool use_spaces = true ;
206206 if (line.length () > 20 && words.length () == 1 ) {
207- words = line.split (" " );
208- use_spaces = false ;
207+ words = line.split (" " );
208+ use_spaces = false ;
209209 }
210- int words_remaining = words.length ();
210+ int words_remaining = words.length ();
211211 while (words_remaining > 0 ) {
212212 bool words_displayed = false ;
213213 for (int word_index = words.length (); word_index > 0 ; word_index--) {
@@ -222,11 +222,11 @@ std::shared_ptr<openshot::Frame> Caption::GetFrame(std::shared_ptr<openshot::Fra
222222
223223 // Create path and add text to it (for correct border and fill)
224224 QPainterPath path1;
225- QString fitting_line;
225+ QString fitting_line;
226226 if (use_spaces) {
227- fitting_line = words.mid (0 , word_index).join (" " );
227+ fitting_line = words.mid (0 , word_index).join (" " );
228228 } else {
229- fitting_line = words.mid (0 , word_index).join (" " );
229+ fitting_line = words.mid (0 , word_index).join (" " );
230230 }
231231 path1.addText (p, font, fitting_line);
232232 text_paths.push_back (path1);
Original file line number Diff line number Diff line change 2323
2424TEST_CASE ( " caption effect" , " [libopenshot][caption]" )
2525{
26+ // Check for QT Platform Environment variable - and ignore these tests if it's set to offscreen
27+ if (std::getenv (" QT_QPA_PLATFORM" ) != nullptr ) {
28+ std::string qt_platform_env = std::getenv (" QT_QPA_PLATFORM" );
29+ if (qt_platform_env == " offscreen" ) {
30+ std::cout << " Ignoring Caption unit tests due to invalid QT Platform: offscreen" << std::endl;
31+ return ;
32+ }
33+ }
34+
2635 int argc;
2736 char * argv[2 ];
2837 QGuiApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
You can’t perform that action at this time.
0 commit comments