def setup_content(self, portal):
     portal.invokeFactory('News Item', 'my-newsitem')
     portal.invokeFactory('Image', 'my-image')
     self.newsitem = portal['my-newsitem']
     self.newsitem.setImage(generate_image(1024, 768))
     self.image = portal['my-image']
     self.image.setImage(generate_image(1024, 768))
Ejemplo n.º 2
0
 def setup_content(self, portal):
     portal.invokeFactory('News Item', 'my-newsitem')
     portal.invokeFactory('Image', 'my-image')
     self.newsitem = portal['my-newsitem']
     self.newsitem.setImage(generate_image(1024, 768))
     self.image = portal['my-image']
     self.image.setImage(generate_image(1024, 768))
    def test_plugin_view_newsitem_large(self):
        plugin = self.plugin
        newsitem = self.newsitem
        newsitem.setImage(generate_image(1920, 1080))

        plugin_view = plugin.view()
        view = newsitem.restrictedTraverse(plugin_view)

        # At newsitem, use image
        image_url = view.image_url()
        self.assertTrue('logo.png' not in image_url)

        self.assertEqual(view.image_width(), 1200)
        self.assertEqual(view.image_height(), 675)
Ejemplo n.º 4
0
    def test_plugin_view_image(self):
        plugin = self.plugin
        image = self.image

        plugin_view = plugin.view()
        view = image.restrictedTraverse(plugin_view)

        # At image, use local image
        image_url = view.image_url()
        self.assertTrue('logo.png' not in image_url)
        self.assertEqual(view.image_width(), 1024)
        self.assertEqual(view.image_height(), 768)

        # Set a larger image
        image.setImage(generate_image(1920, 1080))

        plugin_view = plugin.view()
        view = image.restrictedTraverse(plugin_view)

        self.assertEqual(view.image_width(), 1200)
        self.assertEqual(view.image_height(), 675)