@@ 1622-1666 (lines=45) @@ | ||
1619 | /** |
|
1620 | * Test that a gallery block with too many images will be trimmed down to 4. |
|
1621 | */ |
|
1622 | public function test_long_gallery_is_trimmed() { |
|
1623 | $test_images = array( |
|
1624 | array( |
|
1625 | 'url' => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190317_1915122.jpg', |
|
1626 | 'alt' => 'This is how we roll.', |
|
1627 | 'type' => 'image/jpeg', |
|
1628 | ), |
|
1629 | array( |
|
1630 | 'url' => 'https://pentophoto.files.wordpress.com/2019/01/IMG_20190101_175338.jpg', |
|
1631 | 'alt' => 'Like a boss.', |
|
1632 | 'type' => 'image/jpeg', |
|
1633 | ), |
|
1634 | array( |
|
1635 | 'url' => 'https://pentophoto.files.wordpress.com/2020/02/wp-1582952469369.jpg', |
|
1636 | 'alt' => 'Is this really a selfie?', |
|
1637 | 'type' => 'image/jpeg', |
|
1638 | ), |
|
1639 | array( |
|
1640 | 'url' => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190318_152120.jpg', |
|
1641 | 'alt' => 'Keeping up with pop culture.', |
|
1642 | 'type' => 'image/jpeg', |
|
1643 | ), |
|
1644 | array( |
|
1645 | 'url' => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190317_1915122.jpg', |
|
1646 | 'alt' => 'Why does the raccoon miss out?! 😢', |
|
1647 | 'type' => 'image/jpeg', |
|
1648 | ), |
|
1649 | ); |
|
1650 | ||
1651 | $blocks = array( |
|
1652 | $this->generateGalleryData( $test_images ), |
|
1653 | ); |
|
1654 | ||
1655 | $expected_content = array( |
|
1656 | array( |
|
1657 | 'media' => array_slice( $test_images, 0, 4 ), |
|
1658 | ), |
|
1659 | ); |
|
1660 | ||
1661 | $expected_boundaries = array( false ); |
|
1662 | ||
1663 | $expected_blocks = array( $blocks ); |
|
1664 | ||
1665 | $this->assertTweetGenerated( $blocks, $expected_content, $expected_boundaries, $expected_blocks ); |
|
1666 | } |
|
1667 | ||
1668 | /** |
|
1669 | * Test that a gallery block with a GIF as the first image is trimmed down to just that GIF. |
|
@@ 1671-1716 (lines=46) @@ | ||
1668 | /** |
|
1669 | * Test that a gallery block with a GIF as the first image is trimmed down to just that GIF. |
|
1670 | */ |
|
1671 | public function test_gallery_starting_with_gif_is_trimmed() { |
|
1672 | $test_images = array( |
|
1673 | array( |
|
1674 | 'url' => 'https://jetpackme.files.wordpress.com/2018/10/jetpack-site-accelerator-toggle-gif.gif', |
|
1675 | 'alt' => 'This is probably a GIF.', |
|
1676 | 'type' => 'image/gif', |
|
1677 | ), |
|
1678 | array( |
|
1679 | 'url' => 'https://pentophoto.files.wordpress.com/2019/01/IMG_20190101_175338.jpg', |
|
1680 | 'alt' => 'Like a boss.', |
|
1681 | 'type' => 'image/jpeg', |
|
1682 | ), |
|
1683 | array( |
|
1684 | 'url' => 'https://pentophoto.files.wordpress.com/2020/02/wp-1582952469369.jpg', |
|
1685 | 'alt' => 'Is this really a selfie?', |
|
1686 | 'type' => 'image/jpeg', |
|
1687 | ), |
|
1688 | array( |
|
1689 | 'url' => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190318_152120.jpg', |
|
1690 | 'alt' => 'Keeping up with pop culture.', |
|
1691 | 'type' => 'image/jpeg', |
|
1692 | ), |
|
1693 | array( |
|
1694 | 'url' => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190317_1915122.jpg', |
|
1695 | 'alt' => 'Why does the raccoon miss out?! 😢', |
|
1696 | 'type' => 'image/jpeg', |
|
1697 | ), |
|
1698 | ); |
|
1699 | ||
1700 | $blocks = array( |
|
1701 | $this->generateGalleryData( $test_images ), |
|
1702 | ); |
|
1703 | ||
1704 | $expected_content = array( |
|
1705 | array( |
|
1706 | 'media' => array_slice( $test_images, 0, 1 ), |
|
1707 | ), |
|
1708 | ); |
|
1709 | ||
1710 | $expected_boundaries = array( false ); |
|
1711 | ||
1712 | $expected_blocks = array( $blocks ); |
|
1713 | ||
1714 | $this->assertTweetGenerated( $blocks, $expected_content, $expected_boundaries, $expected_blocks ); |
|
1715 | ||
1716 | } |
|
1717 | /** |
|
1718 | * Test that a gallery block with a GIF not as the first image has that GIF filtered out. |
|
1719 | */ |