diff --git a/docs/index.rst b/docs/index.rst index ceebf29..eec6bb5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,4 +15,5 @@ Documentation plugins faq contribute + license changelog diff --git a/docs/license.rst b/docs/license.rst new file mode 100644 index 0000000..d6e6b7b --- /dev/null +++ b/docs/license.rst @@ -0,0 +1,54 @@ +========= + License +========= + +Sigal itself is available under the MIT license, but it also relies on several +librairies (thanks!): + +- `Colorbox `__ (MIT) +- `Galleria `__ (MIT) +- `Photoswipe `__ (MIT) +- `JQuery `__ (MIT) +- `JQuery TouchSwipe `__ (MIT) +- `Skeleton `__ (MIT) +- `normalize.css `__ (MIT) +- `Leaflet `__ (BSD) +- `echo `__ (MIT) + +The ``tests/sample/pictures`` directory contain images used for the unit +tests: + +- ``11.jpg``, ``21.jpg``, ``22.jpg``, ``3.jpg`` : From @saimn +- ``1.jpg``, ``2.jpg`` : From @edwinsteele + (https://github.com/saimn/sigal/pull/297#issuecomment-365879755) +- ``example.gif`` : + https://commons.wikimedia.org/wiki/File:00_nuvolosit%C3%A0_media_AM.GIF + (CC-BY-3.0) +- ``CMB_Timeline300_no_WMAP.jpg`` : + https://en.wikipedia.org/wiki/File:CMB_Timeline300_no_WMAP.jpg + (Public domain) +- ``KeckObservatory20071020.jpg`` : + https://commons.wikimedia.org/wiki/File:KeckObservatory20071020.jpg + (CC-BY-3.0) +- ``flickr_jerquiaga_2394751088_cc-by-nc.jpg`` + http://www.flickr.com/photos/jerquiaga/2394751088/ (CC-BY-NC) +- ``hélicoïde.jpg`` : https://commons.wikimedia.org/wiki/File:Helicoid.PNG + (CC BY-SA 3.0) +- ``Hubble Interacting Galaxy NGC 5257.jpg`` + https://commons.wikimedia.org/wiki/File:Hubble_Interacting_Galaxy_NGC_5257_(2008-04-24).jpg + (Public domain) +- ``Hubble ultra deep field.jpg`` : + https://commons.wikimedia.org/wiki/File%3AHubble_ultra_deep_field.jpg + (Public domain) +- ``m57_the_ring_nebula-587px.jpg`` + https://commons.wikimedia.org/wiki/File%3AM57_The_Ring_Nebula.JPG + (Public domain) +- ``noexif.png`` : https://commons.wikimedia.org/wiki/File:Ilc_9yr_moll4096.png + (Public domain) +- ``should_be_created.jpg``, ``should_be_ignored_1.jpg``, + ``should_be_ignored2.jpg``, ``should_be_ignored3.jpg``, + ``should_be_ignored.jpg`` : from the apollo 7 mission, public domain: + https://www.flickr.com/photos/projectapolloarchive/21756099278/in/album-72157657129869694/ + (https://github.com/saimn/sigal/pull/233#issuecomment-275430083) +- ``example video.ogv`` : https://commons.wikimedia.org/wiki/File:I-15bis.ogv + (GFDL) diff --git a/tests/sample/pictures/accentué/11.jpg b/tests/sample/pictures/accentué/11.jpg new file mode 100644 index 0000000..e2bd3d3 Binary files /dev/null and b/tests/sample/pictures/accentué/11.jpg differ diff --git a/tests/sample/pictures/accentué/superdupont_source_wikipedia_en.jpg b/tests/sample/pictures/accentué/superdupont_source_wikipedia_en.jpg deleted file mode 100644 index eb2cac4..0000000 Binary files a/tests/sample/pictures/accentué/superdupont_source_wikipedia_en.jpg and /dev/null differ diff --git a/tests/sample/pictures/dir1/test1/50a1d0bc-763d-457e-b634-c87f16a64270.gif b/tests/sample/pictures/dir1/test1/50a1d0bc-763d-457e-b634-c87f16a64270.gif deleted file mode 100644 index 28eabe1..0000000 Binary files a/tests/sample/pictures/dir1/test1/50a1d0bc-763d-457e-b634-c87f16a64270.gif and /dev/null differ diff --git a/tests/sample/pictures/dir1/test1/CMB_Timeline300_no_WMAP.jpg b/tests/sample/pictures/dir1/test1/CMB_Timeline300_no_WMAP.jpg new file mode 100644 index 0000000..e040d03 Binary files /dev/null and b/tests/sample/pictures/dir1/test1/CMB_Timeline300_no_WMAP.jpg differ diff --git a/tests/sample/pictures/dir1/test1/archlinux-kiss-1024x640.png b/tests/sample/pictures/dir1/test1/archlinux-kiss-1024x640.png deleted file mode 100644 index 828f84d..0000000 Binary files a/tests/sample/pictures/dir1/test1/archlinux-kiss-1024x640.png and /dev/null differ diff --git a/tests/sample/pictures/dir1/test1/example.gif b/tests/sample/pictures/dir1/test1/example.gif new file mode 100644 index 0000000..1bde45e Binary files /dev/null and b/tests/sample/pictures/dir1/test1/example.gif differ diff --git a/tests/sample/pictures/dir1/test2/CMB_Timeline300_no_WMAP.jpg b/tests/sample/pictures/dir1/test2/CMB_Timeline300_no_WMAP.jpg new file mode 100644 index 0000000..e040d03 Binary files /dev/null and b/tests/sample/pictures/dir1/test2/CMB_Timeline300_no_WMAP.jpg differ diff --git a/tests/sample/pictures/dir1/test2/archlinux-kiss-1024x640.png b/tests/sample/pictures/dir1/test2/archlinux-kiss-1024x640.png deleted file mode 100644 index 828f84d..0000000 Binary files a/tests/sample/pictures/dir1/test2/archlinux-kiss-1024x640.png and /dev/null differ diff --git a/tests/sample/pictures/dir2/KeckObservatory20071020.jpg b/tests/sample/pictures/dir2/KeckObservatory20071020.jpg new file mode 100644 index 0000000..2a212c7 Binary files /dev/null and b/tests/sample/pictures/dir2/KeckObservatory20071020.jpg differ diff --git a/tests/sample/pictures/dir2/exo20101028-b-full.jpg b/tests/sample/pictures/dir2/exo20101028-b-full.jpg deleted file mode 100644 index 263ec88..0000000 Binary files a/tests/sample/pictures/dir2/exo20101028-b-full.jpg and /dev/null differ diff --git a/tests/sample/pictures/dir2/index.md b/tests/sample/pictures/dir2/index.md index 2f2e4a1..ecd38b2 100644 --- a/tests/sample/pictures/dir2/index.md +++ b/tests/sample/pictures/dir2/index.md @@ -10,19 +10,22 @@ This is an [example link](http://example.com/ "With a Title"). ### Image sources -- *Hubble Interacting Galaxy NGC 5257* By NASA, ESA, the Hubble Heritage +- *Hubble Interacting Galaxy NGC 5257* : By NASA, ESA, the Hubble Heritage (STScI/AURA)-ESA/Hubble Collaboration, and A. Evans (University of Virginia, - Charlottesville/NRAO/Stony Brook University) [Public domain], via Wikimedia - Commons + Charlottesville/NRAO/Stony Brook University) [Public domain], + from Wikimedia Commons -- *Hubble ultra deep field.jpg* Par NASA and the European Space Agency. [Public - domain], via - Wikimedia Commons +- *Hubble ultra deep field.jpg* : By NASA and the European Space Agency. + [Public domain], + from Wikimedia Commons -- *m57_the_ring_nebula-587px.jpg* By The Hubble Heritage Team +- *m57_the_ring_nebula-587px.jpg* : By The Hubble Heritage Team (AURA/STScI/NASA) [Public domain], via - Wikimedia Commons + href="https://commons.wikimedia.org/wiki/File%3AM57_The_Ring_Nebula.JPG"> + from Wikimedia Commons -- *exo20101028-b-full.jpg* +- *KeckObservatory20071020.jpg* : By SiOwl [CC BY 3.0] + from Wikimedia Commons diff --git a/tests/sample/pictures/exifTest/noexif.png b/tests/sample/pictures/exifTest/noexif.png index 828f84d..ad4ac7a 100644 Binary files a/tests/sample/pictures/exifTest/noexif.png and b/tests/sample/pictures/exifTest/noexif.png differ diff --git a/tests/sample/pictures/video/example video.ogv b/tests/sample/pictures/video/example video.ogv new file mode 100644 index 0000000..439d092 Binary files /dev/null and b/tests/sample/pictures/video/example video.ogv differ diff --git a/tests/sample/pictures/video/stallman software-freedom-day-low.ogv b/tests/sample/pictures/video/stallman software-freedom-day-low.ogv deleted file mode 100644 index 0a88cb4..0000000 Binary files a/tests/sample/pictures/video/stallman software-freedom-day-low.ogv and /dev/null differ diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index 7fbf5ab..b6839b2 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -13,10 +13,10 @@ plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright', 'sigal.plugins.watermark', 'sigal.plugins.feeds', 'sigal.plugins.nomedia', 'sigal.plugins.extended_caching'] copyright = '© An example copyright message' -adjust_options = {'color': 0.0, 'brightness': 1.0, +adjust_options = {'color': 0.9, 'brightness': 1.0, 'contrast': 1.0, 'sharpness': 0.0} watermark = 'watermark.png' -watermark_position = 'tile' +watermark_position = (10, 10) watermark_opacity = 0.3 theme = 'colorbox' diff --git a/tests/sample/watermark.png b/tests/sample/watermark.png index 083dfa1..26da438 100644 Binary files a/tests/sample/watermark.png and b/tests/sample/watermark.png differ diff --git a/tests/test_cli.py b/tests/test_cli.py index ba55a4b..9a7d3bb 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -34,8 +34,8 @@ def test_build(tmpdir, disconnect_signals): assert result.exit_code == 0 os.symlink(join(TESTGAL, 'watermark.png'), join(tmpdir, 'watermark.png')) - os.symlink(join(TESTGAL, 'pictures', 'dir2', 'exo20101028-b-full.jpg'), - join(tmpdir, 'pictures', 'exo20101028-b-full.jpg')) + os.symlink(join(TESTGAL, 'pictures', 'dir2', 'KeckObservatory20071020.jpg'), + join(tmpdir, 'pictures', 'KeckObservatory20071020.jpg')) result = runner.invoke(build, ['-n', 1, '--debug']) assert result.exit_code == 1 @@ -76,7 +76,7 @@ atom_feed = {'feed_url': 'http://example.org/feed.atom', 'nb_items': 10} '-n', 1, '--debug']) assert result.exit_code == 0 assert os.path.isfile(join(tmpdir, 'build', 'thumbnails', - 'exo20101028-b-full.jpg')) + 'KeckObservatory20071020.jpg')) assert os.path.isfile(join(tmpdir, 'build', 'feed.atom')) assert os.path.isfile(join(tmpdir, 'build', 'feed.rss')) assert os.path.isfile(join(tmpdir, 'build', 'watermark.png')) diff --git a/tests/test_gallery.py b/tests/test_gallery.py index f152b4b..04bea5d 100644 --- a/tests/test_gallery.py +++ b/tests/test_gallery.py @@ -22,16 +22,16 @@ REF = { 'name': 'test1', 'thumbnail': 'test1/thumbnails/11.tn.jpg', 'subdirs': [], - 'medias': ['11.jpg', 'archlinux-kiss-1024x640.png', + 'medias': ['11.jpg', 'CMB_Timeline300_no_WMAP.jpg', 'flickr_jerquiaga_2394751088_cc-by-nc.jpg', - '50a1d0bc-763d-457e-b634-c87f16a64270.gif'], + 'example.gif'], }, 'dir1/test2': { 'title': 'test2', 'name': 'test2', 'thumbnail': 'test2/thumbnails/21.tn.jpg', 'subdirs': [], - 'medias': ['21.jpg', '22.jpg', 'archlinux-kiss-1024x640.png'], + 'medias': ['21.jpg', '22.jpg', 'CMB_Timeline300_no_WMAP.jpg'], }, 'dir1/test3': { 'title': '01 First title alphabetically', @@ -45,7 +45,7 @@ REF = { 'name': 'dir2', 'thumbnail': 'dir2/thumbnails/m57_the_ring_nebula-587px.tn.jpg', 'subdirs': [], - 'medias': ['exo20101028-b-full.jpg', + 'medias': ['KeckObservatory20071020.jpg', 'Hubble Interacting Galaxy NGC 5257.jpg', 'Hubble ultra deep field.jpg', 'm57_the_ring_nebula-587px.jpg'], @@ -55,15 +55,15 @@ REF = { 'name': 'accentué', 'thumbnail': 'accentué/thumbnails/hélicoïde.tn.jpg', 'subdirs': [], - 'medias': ['hélicoïde.jpg', 'superdupont_source_wikipedia_en.jpg'], + 'medias': ['hélicoïde.jpg', '11.jpg'], }, 'video': { 'title': 'video', 'name': 'video', 'thumbnail': ('video/thumbnails/' - 'stallman software-freedom-day-low.tn.jpg'), + 'example video.tn.jpg'), 'subdirs': [], - 'medias': ['stallman software-freedom-day-low.ogv'] + 'medias': ['example video.ogv'] } } @@ -97,9 +97,9 @@ def test_media_orig(settings, tmpdir): m = Image('11.jpg', 'dir1/test1', settings) assert m.big == 'original/11.jpg' - m = Video('stallman software-freedom-day-low.ogv', 'video', settings) - assert m.filename == 'stallman software-freedom-day-low.webm' - assert m.big == 'original/stallman software-freedom-day-low.ogv' + m = Video('example video.ogv', 'video', settings) + assert m.filename == 'example video.webm' + assert m.big == 'original/example video.ogv' assert os.path.isfile(join(settings['destination'], m.path, m.big)) settings['use_orig'] = True @@ -138,14 +138,13 @@ def test_image(settings, tmpdir): def test_video(settings, tmpdir): settings['destination'] = str(tmpdir) - m = Video('stallman software-freedom-day-low.ogv', 'video', settings) - file_path = join('video', 'stallman software-freedom-day-low.webm') + m = Video('example video.ogv', 'video', settings) + file_path = join('video', 'example video.webm') assert str(m) == file_path assert m.dst_path == join(settings['destination'], file_path) os.makedirs(join(settings['destination'], 'video', 'thumbnails')) - assert m.thumbnail == join('thumbnails', - 'stallman software-freedom-day-low.tn.jpg') + assert m.thumbnail == join('thumbnails', 'example video.tn.jpg') assert os.path.isfile(m.thumb_path) @@ -222,14 +221,14 @@ def test_medias_sort(settings): a = Album('dir1/test2', settings, album['subdirs'], album['medias'], gal) a.sort_medias(settings['medias_sort_attr']) assert [im.filename for im in a.images] == ['22.jpg', '21.jpg', - 'archlinux-kiss-1024x640.png'] + 'CMB_Timeline300_no_WMAP.jpg'] settings['medias_sort_attr'] = 'meta.order' settings['medias_sort_reverse'] = False a = Album('dir1/test2', settings, album['subdirs'], album['medias'], gal) a.sort_medias(settings['medias_sort_attr']) assert [im.filename for im in a.images] == [ - 'archlinux-kiss-1024x640.png', '21.jpg', '22.jpg'] + 'CMB_Timeline300_no_WMAP.jpg', '21.jpg', '22.jpg'] def test_gallery(settings, tmpdir): @@ -275,7 +274,7 @@ def test_ignores(settings, tmpdir): assert 'test2' not in os.listdir(join(tmp, 'dir1')) assert 'accentué' not in os.listdir(tmp) - assert 'archlinux-kiss-1024x640.png' not in os.listdir( + assert 'CMB_Timeline300_no_WMAP.jpg' not in os.listdir( join(tmp, 'dir1', 'test1')) assert 'Hubble Interacting Galaxy NGC 5257.jpg' not in os.listdir( join(tmp, 'dir2')) diff --git a/tests/test_image.py b/tests/test_image.py index f19c94e..6f3c5aa 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -9,10 +9,10 @@ from sigal.image import (generate_image, generate_thumbnail, get_exif_tags, from sigal.settings import create_settings, Status CURRENT_DIR = os.path.dirname(__file__) -TEST_IMAGE = 'exo20101028-b-full.jpg' +TEST_IMAGE = 'KeckObservatory20071020.jpg' SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', TEST_IMAGE) -TEST_GIF_IMAGE = '50a1d0bc-763d-457e-b634-c87f16a64270.gif' +TEST_GIF_IMAGE = 'example.gif' SRC_GIF_FILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir1', 'test1', TEST_GIF_IMAGE) @@ -60,7 +60,7 @@ def test_resize_image_portrait(tmpdir): # Hence we test that the shorter side has the smallest length. assert im.size[0] == 200 - landscape_image = 'exo20101028-b-full.jpg' + landscape_image = 'KeckObservatory20071020.jpg' landscape_src = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', landscape_image) landscape_dst = str(tmpdir.join(landscape_image)) @@ -109,8 +109,8 @@ def test_generate_image_processor(tmpdir): @pytest.mark.parametrize( ("image", "path", "wide_size", "high_size"), - [(TEST_IMAGE, SRCFILE, (185, 150), (150, 122)), - (TEST_GIF_IMAGE, SRC_GIF_FILE, (127, 150), (150, 177))]) + [(TEST_IMAGE, SRCFILE, (200, 133), (150, 100)), + (TEST_GIF_IMAGE, SRC_GIF_FILE, (134, 150), (150, 167))]) def test_generate_thumbnail(tmpdir, image, path, wide_size, high_size): "Test the generate_thumbnail function." diff --git a/tests/test_plugins.py b/tests/test_plugins.py index fac7a65..1b062c4 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -19,7 +19,7 @@ def test_plugins(settings, tmpdir, disconnect_signals): gal.build() out_html = os.path.join(settings['destination'], - 'dir2', 'exo20101028-b-full.jpg.html') + 'dir2', 'KeckObservatory20071020.jpg.html') assert os.path.isfile(out_html) for path, dirs, files in os.walk(os.path.join(str(tmpdir), "nomedia")): diff --git a/tests/test_utils.py b/tests/test_utils.py index 4541f82..915f3db 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,7 +6,7 @@ SAMPLE_DIR = os.path.join(CURRENT_DIR, 'sample') def test_copy(tmpdir): - filename = 'exo20101028-b-full.jpg' + filename = 'KeckObservatory20071020.jpg' src = os.path.join(SAMPLE_DIR, 'pictures', 'dir2', filename) dst = str(tmpdir.join(filename)) utils.copy(src, dst) @@ -19,7 +19,7 @@ def test_copy(tmpdir): assert os.path.islink(dst) assert os.readlink(dst) == src - filename = 'exo20101028-b-full.jpg' + filename = 'KeckObservatory20071020.jpg' src = os.path.join(SAMPLE_DIR, 'pictures', 'dir2', filename) utils.copy(src, dst, symlink=True) assert os.path.islink(dst) diff --git a/tests/test_video.py b/tests/test_video.py index 342a41a..af1790a 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -5,7 +5,7 @@ from sigal.video import video_size, generate_video, process_video from sigal.settings import create_settings, Status CURRENT_DIR = os.path.dirname(__file__) -TEST_VIDEO = 'stallman software-freedom-day-low.ogv' +TEST_VIDEO = 'example video.ogv' SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'video', TEST_VIDEO) diff --git a/tests/test_zip.py b/tests/test_zip.py index 5f19544..0065133 100644 --- a/tests/test_zip.py +++ b/tests/test_zip.py @@ -29,9 +29,9 @@ def test_zipped_correctly(tmpdir): assert os.path.basename(zipped1[0]) == 'archive.zip' zip_file = zipfile.ZipFile(zipped1[0], 'r') - expected = ('11.jpg', 'archlinux-kiss-1024x640.png', + expected = ('11.jpg', 'CMB_Timeline300_no_WMAP.jpg', 'flickr_jerquiaga_2394751088_cc-by-nc.jpg', - '50a1d0bc-763d-457e-b634-c87f16a64270.gif') + 'example.gif') for filename in zip_file.namelist(): assert filename in expected