| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 6 | * License as published by the Free Software Foundation; either | ||
| 7 | * version 2.1 of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * Lesser General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 15 | * License along with FFmpeg; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include "libavutil/common.h" | ||
| 20 | #include "libavcodec/htmlsubtitles.c" | ||
| 21 | |||
| 22 | static const char * const test_cases[] = { | ||
| 23 | /* latin guillemets and other < > garbage */ | ||
| 24 | "<<hello>>", // guillemets | ||
| 25 | "<<<b>hello</b>>>", // guillemets + tags | ||
| 26 | "< hello < 2000 > world >", // unlikely tags due to spaces | ||
| 27 | "<h1>TITLE</h1>", // likely unhandled tags | ||
| 28 | "< font color=red >red</font>", // invalid format of valid tag | ||
| 29 | "Foo <foo@bar.com>", // not a tag (not alnum) | ||
| 30 | |||
| 31 | "<b> foo <I> bar </B> bla </i>", // broken nesting | ||
| 32 | |||
| 33 | "A<br>B<BR/>C<br / >D< Br >E<brk><brk/>", // misc line breaks | ||
| 34 | }; | ||
| 35 | |||
| 36 | 1 | int main(void) | |
| 37 | { | ||
| 38 | int i; | ||
| 39 | AVBPrint dst; | ||
| 40 | |||
| 41 | 1 | av_bprint_init(&dst, 0, AV_BPRINT_SIZE_UNLIMITED); | |
| 42 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
|
9 | for (i = 0; i < FF_ARRAY_ELEMS(test_cases); i++) { |
| 43 | 8 | int ret = ff_htmlmarkup_to_ass(NULL, &dst, test_cases[i]); | |
| 44 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if (ret < 0) |
| 45 | ✗ | return ret; | |
| 46 | 8 | printf("%s --> %s\n", test_cases[i], dst.str); | |
| 47 | 8 | av_bprint_clear(&dst); | |
| 48 | } | ||
| 49 | 1 | av_bprint_finalize(&dst, NULL); | |
| 50 | 1 | return 0; | |
| 51 | } | ||
| 52 |