From: Vladimír Vondruš Date: Mon, 11 Dec 2017 02:24:22 +0000 (+0100) Subject: m.images: initial test. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=416692fe755926d0c83803aa6f3871bdaef2b1ed;p=blog.git m.images: initial test. --- diff --git a/doc/plugins/images-test.rst b/doc/plugins/images-test.rst index e3c49f47..cea68ab8 100644 --- a/doc/plugins/images-test.rst +++ b/doc/plugins/images-test.rst @@ -81,9 +81,3 @@ Image grid, inflated: {filename}/static/flowers.jpg {filename}/static/ship.jpg - -Image grid with a PNG file: - -.. image-grid:: - - {filename}/static/tiny.png diff --git a/doxygen/test/contents_image/tiny.png b/doxygen/test/contents_image/tiny.png index d154db27..1034d03d 120000 --- a/doxygen/test/contents_image/tiny.png +++ b/doxygen/test/contents_image/tiny.png @@ -1 +1 @@ -../../../doc/static/tiny.png \ No newline at end of file +../../../pelican-plugins/m/test/images/tiny.png \ No newline at end of file diff --git a/pelican-plugins/m/test/images/flowers.jpg b/pelican-plugins/m/test/images/flowers.jpg new file mode 120000 index 00000000..27421244 --- /dev/null +++ b/pelican-plugins/m/test/images/flowers.jpg @@ -0,0 +1 @@ +../../../../doc/static/flowers.jpg \ No newline at end of file diff --git a/pelican-plugins/m/test/images/page.html b/pelican-plugins/m/test/images/page.html new file mode 100644 index 00000000..40fc9b26 --- /dev/null +++ b/pelican-plugins/m/test/images/page.html @@ -0,0 +1,102 @@ + + + + + m.images | A Pelican Blog + + + + + + + + + + + + + +
+
+ +
+ + diff --git a/pelican-plugins/m/test/images/page.rst b/pelican-plugins/m/test/images/page.rst new file mode 100644 index 00000000..2cc494f1 --- /dev/null +++ b/pelican-plugins/m/test/images/page.rst @@ -0,0 +1,64 @@ +m.images +######## + +:summary: no. + +Image: + +.. image:: {filename}/ship.jpg + +Image with link: + +.. image:: {filename}/ship.jpg + :target: {filename}/ship.jpg + +Image, class on top, custom alt: + +.. image:: {filename}/ship.jpg + :class: m-fullwidth + :alt: A Ship + +Image with link, class on top: + +.. image:: {filename}/ship.jpg + :target: {filename}/ship.jpg + :class: m-fullwidth + +Figure: + +.. figure:: {filename}/ship.jpg + + A Ship + + Yes. + +Figure with link and only a caption: + +.. figure:: {filename}/ship.jpg + :target: {filename}/ship.jpg + + A Ship + +Figure with link and class on top: + +.. figure:: {filename}/ship.jpg + :target: {filename}/ship.jpg + :figclass: m-fullwidth + + A Ship + +Image grid: + +.. image-grid:: + + {filename}/ship.jpg + {filename}/flowers.jpg + + {filename}/flowers.jpg + {filename}/ship.jpg + +Image grid with a PNG file: + +.. image-grid:: + + {filename}/tiny.png diff --git a/pelican-plugins/m/test/images/ship.jpg b/pelican-plugins/m/test/images/ship.jpg new file mode 120000 index 00000000..3103a995 --- /dev/null +++ b/pelican-plugins/m/test/images/ship.jpg @@ -0,0 +1 @@ +../../../../doc/static/ship.jpg \ No newline at end of file diff --git a/doc/static/tiny.png b/pelican-plugins/m/test/images/tiny.png similarity index 100% rename from doc/static/tiny.png rename to pelican-plugins/m/test/images/tiny.png diff --git a/pelican-plugins/m/test/test_images.py b/pelican-plugins/m/test/test_images.py new file mode 100644 index 00000000..778c02bc --- /dev/null +++ b/pelican-plugins/m/test/test_images.py @@ -0,0 +1,13 @@ +from m.test import PluginTestCase + +class Images(PluginTestCase): + def __init__(self, *args, **kwargs): + super().__init__(__file__, '', *args, **kwargs) + + def test(self): + self.run_pelican({ + 'PLUGINS': ['m.htmlsanity', 'm.images'], + 'STATIC_PATHS': ['tiny.png', 'ship.jpg', 'flowers.jpg'] + }) + + self.assertEqual(*self.actual_expected_contents('page.html'))