| 349 | |
| 350 | function test_video_shortcode_body() { |
| 351 | $width = 640; |
| 352 | $height = 360; |
| 353 | |
| 354 | $video =<<<VIDEO |
| 355 | [video width="640" height="360" mp4="http://wordpress-core-develop/wp-content/uploads/2013/12/XVMwB.mp4"] |
| 356 | <!-- WebM/VP8 for Firefox4, Opera, and Chrome --> |
| 357 | <source type="video/webm" src="myvideo.webm" /> |
| 358 | <!-- Ogg/Vorbis for older Firefox and Opera versions --> |
| 359 | <source type="video/ogg" src="myvideo.ogv" /> |
| 360 | <!-- Optional: Add subtitles for each language --> |
| 361 | <track kind="subtitles" src="subtitles.srt" srclang="en" /> |
| 362 | <!-- Optional: Add chapters --> |
| 363 | <track kind="chapters" src="chapters.srt" srclang="en" /> |
| 364 | [/video] |
| 365 | VIDEO; |
| 366 | |
| 367 | $w = $GLOBALS['content_width']; |
| 368 | $h = ceil( ( $height * $w ) / $width ); |
| 369 | |
| 370 | $content = apply_filters( 'the_content', $video ); |
| 371 | |
| 372 | $expected = '<div style="width: ' . $w . 'px; max-width: 100%;" class="wp-video">' . |
| 373 | '<!--[if lt IE 9]><script>document.createElement(\'video\');</script><![endif]--> |
| 374 | <video class="wp-video-shortcode" id="video-0-1" width="' . $w . '" height="' . $h . '" preload="metadata" controls="controls">' . |
| 375 | '<source type="video/mp4" src="http://wordpress-core-develop/wp-content/uploads/2013/12/XVMwB.mp4" />' . |
| 376 | '<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' . |
| 377 | '<!-- Ogg/Vorbis for older Firefox and Opera versions --><source type="video/ogg" src="myvideo.ogv" />' . |
| 378 | '<!-- Optional: Add subtitles for each language --><track kind="subtitles" src="subtitles.srt" srclang="en" />' . |
| 379 | '<!-- Optional: Add chapters --><track kind="chapters" src="chapters.srt" srclang="en" />' . |
| 380 | '<a href="http://wordpress-core-develop/wp-content/uploads/2013/12/XVMwB.mp4">' . |
| 381 | 'http://wordpress-core-develop/wp-content/uploads/2013/12/XVMwB.mp4</a></video></div> |
| 382 | '; |
| 383 | |
| 384 | $this->assertEquals( $expected, $content ); |
| 385 | } |