diff --git a/.github/workflows/selenium-lab-tests.yaml b/.github/workflows/selenium-lab-tests.yaml index 240b090ceb..a5cbf02a84 100644 --- a/.github/workflows/selenium-lab-tests.yaml +++ b/.github/workflows/selenium-lab-tests.yaml @@ -8,6 +8,9 @@ on: pr: description: "A PR number to build and test in the lab. If empty, will build and test from main." required: false + test_filter: + description: "A filter to run a subset of the tests. If empty, all tests will run." + required: false schedule: # Runs every night at 2am PST / 10am UTC, testing against the main branch. - cron: '0 10 * * *' @@ -191,6 +194,11 @@ jobs: extra_flags="" fi + filter="${{ github.event.inputs.test_filter }}" + if [[ "$filter" != "" ]]; then + extra_flags="$extra_flags --filter $filter" + fi + python3 build/test.py \ --no-build \ --reporters spec --spec-hide-passed \ diff --git a/lib/text/ui_text_displayer.js b/lib/text/ui_text_displayer.js index 8346c2b829..c4f4229d78 100644 --- a/lib/text/ui_text_displayer.js +++ b/lib/text/ui_text_displayer.js @@ -623,12 +623,7 @@ shaka.text.UITextDisplayer = class { // TODO: Implement lineAlignment of 'CENTER'. if (cue.line != null) { if (cue.lineInterpretation == Cue.lineInterpretation.PERCENTAGE) { - // When setting absolute positioning, you need to set x/y/width/height - // so the element is positioned correctly. Set these as default and - // other settings will override them. style.position = 'absolute'; - style.left = '0'; - style.top = '0'; if (cue.writingMode == Cue.writingMode.HORIZONTAL_TOP_TO_BOTTOM) { style.width = '100%'; if (cue.lineAlign == Cue.lineAlign.START) { diff --git a/test/test/assets/screenshots/chrome-Linux/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/chrome-Linux/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..6b132c4c9d Binary files /dev/null and b/test/test/assets/screenshots/chrome-Linux/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/chrome-Linux/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/chrome-Linux/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..61476d273a Binary files /dev/null and b/test/test/assets/screenshots/chrome-Linux/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/chrome-Mac/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/chrome-Mac/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..608e2f9e95 Binary files /dev/null and b/test/test/assets/screenshots/chrome-Mac/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/chrome-Mac/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/chrome-Mac/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..13e18ce93b Binary files /dev/null and b/test/test/assets/screenshots/chrome-Mac/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/chrome-Windows/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/chrome-Windows/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..ca768cd48b Binary files /dev/null and b/test/test/assets/screenshots/chrome-Windows/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/chrome-Windows/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/chrome-Windows/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..af2104f73d Binary files /dev/null and b/test/test/assets/screenshots/chrome-Windows/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/firefox-Linux/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/firefox-Linux/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..2f80e4bc8b Binary files /dev/null and b/test/test/assets/screenshots/firefox-Linux/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/firefox-Linux/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/firefox-Linux/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..61476d273a Binary files /dev/null and b/test/test/assets/screenshots/firefox-Linux/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/firefox-Mac/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/firefox-Mac/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..91962e9751 Binary files /dev/null and b/test/test/assets/screenshots/firefox-Mac/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/firefox-Mac/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/firefox-Mac/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..5fba6f14e4 Binary files /dev/null and b/test/test/assets/screenshots/firefox-Mac/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/firefox-Windows/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/firefox-Windows/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..405e95c75e Binary files /dev/null and b/test/test/assets/screenshots/firefox-Windows/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/firefox-Windows/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/firefox-Windows/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..6aaf5a8e3d Binary files /dev/null and b/test/test/assets/screenshots/firefox-Windows/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/msedge-Linux/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/msedge-Linux/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..8c7d77f21a Binary files /dev/null and b/test/test/assets/screenshots/msedge-Linux/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/msedge-Linux/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/msedge-Linux/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..61476d273a Binary files /dev/null and b/test/test/assets/screenshots/msedge-Linux/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/msedge-Mac/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/msedge-Mac/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..608e2f9e95 Binary files /dev/null and b/test/test/assets/screenshots/msedge-Mac/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/msedge-Mac/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/msedge-Mac/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..13e18ce93b Binary files /dev/null and b/test/test/assets/screenshots/msedge-Mac/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/msedge-Windows/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/msedge-Windows/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..ca768cd48b Binary files /dev/null and b/test/test/assets/screenshots/msedge-Windows/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/msedge-Windows/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/msedge-Windows/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..af2104f73d Binary files /dev/null and b/test/test/assets/screenshots/msedge-Windows/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/review.html b/test/test/assets/screenshots/review.html index 8719d6a148..66f502fb71 100644 --- a/test/test/assets/screenshots/review.html +++ b/test/test/assets/screenshots/review.html @@ -34,8 +34,10 @@ 'firefox-Linux', 'firefox-Mac', 'firefox-Windows', - 'safari-Mac', + 'msedge-Linux', + 'msedge-Mac', 'msedge-Windows', + 'safari-Mac', 'xboxone', ]; @@ -75,6 +77,7 @@ 'line-0', 'line-1', 'line-50', + 'line-85-position-50-size-63', 'bold-long', 'italic-long', 'underline-long', diff --git a/test/test/assets/screenshots/safari-Mac/webvtt-native-line-85-position-50-size-63.png b/test/test/assets/screenshots/safari-Mac/webvtt-native-line-85-position-50-size-63.png new file mode 100644 index 0000000000..ac9a334666 Binary files /dev/null and b/test/test/assets/screenshots/safari-Mac/webvtt-native-line-85-position-50-size-63.png differ diff --git a/test/test/assets/screenshots/safari-Mac/webvtt-ui-line-85-position-50-size-63.png b/test/test/assets/screenshots/safari-Mac/webvtt-ui-line-85-position-50-size-63.png new file mode 100644 index 0000000000..782c6e78ec Binary files /dev/null and b/test/test/assets/screenshots/safari-Mac/webvtt-ui-line-85-position-50-size-63.png differ diff --git a/test/text/web_vtt_layout_integration.js b/test/text/web_vtt_layout_integration.js index af2286d25b..de2724f470 100644 --- a/test/text/web_vtt_layout_integration.js +++ b/test/text/web_vtt_layout_integration.js @@ -248,6 +248,23 @@ filterDescribe('WebVTT layout', shaka.test.TextLayoutTests.supported, () => { await helper.checkScreenshot('line-50'); }); + // Regression case for http://b/259121343 + // The top center of the cue box should be 85% from the top and + // horizontally centered. + // NOTE: The native version is wrong on Chrome and Edge due to layout bugs + // in Chrome. https://crbug.com/1411464 + it('align to bottom center with restricted size', async () => { + parseAndDisplay([ + 'WEBVTT\n', + '\n', + '00:00:00.000 --> 00:00:05.000 ', // continued on next line + 'line:85% position:50% size:63%\n', + 'This is a test\n', + ].join('')); + + await helper.checkScreenshot('line-85-position-50-size-63'); + }); + // FIXME: UI version is slightly wrong: gaps between lines when bold it('bold long', async () => { parseAndDisplay([