From 029210cc329a015a939472a688209d3f3423242b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 30 May 2023 09:51:26 -0300 Subject: thumbs, content: integrate cached thumb sizes into content --- test/snapshot/image.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/snapshot/image.js') diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 6bec1cca..5e12cc25 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -8,7 +8,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { evaluate.snapshot(message, { name: 'image', extraDependencies: { - getSizeOfImageFile: () => 0, + getSizeOfImagePath: () => 0, }, ...opts, }); @@ -79,7 +79,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { quickSnapshot('link with file size', { extraDependencies: { - getSizeOfImageFile: () => 10 ** 6, + getSizeOfImagePath: () => 10 ** 6, }, slots: { path: ['media.albumCover', 'pingas', 'png'], -- cgit 1.3.0-6-gf8a5 From 145a4a292dea7dccb2bb9b58a760db32948c3918 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 30 May 2023 10:01:00 -0300 Subject: test: snapshot how thumbnail details are exposed in images --- test/snapshot/image.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/snapshot/image.js') diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 5e12cc25..a8796e11 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -98,4 +98,19 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { path: ['media.albumCover', 'beyond-canon', 'png'], }, }); + + evaluate.snapshot('thumbnail details', { + name: 'image', + extraDependencies: { + getSizeOfImagePath: () => 0, + getDimensionsOfImagePath: () => [900, 1200], + getThumbnailsAvailableForDimensions: () => + [['voluminous', 1200], ['middling', 900], ['petite', 20]], + getThumbnailEqualOrSmaller: () => 'voluminous', + }, + slots: { + thumb: 'gargantuan', + path: ['media.albumCover', 'beyond-canon', 'png'], + }, + }); }); -- cgit 1.3.0-6-gf8a5 From 8dd2a2fd71fe0e1643201aff87acda8bbcc41295 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 21 Aug 2023 09:37:17 -0300 Subject: test: move thumb-related utilities into image.js snapshot --- test/snapshot/image.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/snapshot/image.js') diff --git a/test/snapshot/image.js b/test/snapshot/image.js index a8796e11..48dcfb69 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -9,6 +9,10 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { name: 'image', extraDependencies: { getSizeOfImagePath: () => 0, + getDimensionsOfImagePath: () => [600, 600], + getThumbnailEqualOrSmaller: () => 'medium', + getThumbnailsAvailableForDimensions: () => + [['large', 800], ['medium', 400], ['small', 250]], }, ...opts, }); -- cgit 1.3.0-6-gf8a5 From d194fc4f537ee79b0558b54ff2e1fdc3e9cbf4d9 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 4 Sep 2023 20:48:54 -0300 Subject: test: update & fix-up image snapshot tests --- test/snapshot/image.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test/snapshot/image.js') diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 48dcfb69..8608ab69 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -4,15 +4,17 @@ import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { await evaluate.load(); - const quickSnapshot = (message, opts) => + const quickSnapshot = (message, {extraDependencies, ...opts}) => evaluate.snapshot(message, { name: 'image', extraDependencies: { + checkIfImagePathHasCachedThumbnails: path => !path.endsWith('.gif'), getSizeOfImagePath: () => 0, getDimensionsOfImagePath: () => [600, 600], getThumbnailEqualOrSmaller: () => 'medium', getThumbnailsAvailableForDimensions: () => [['large', 800], ['medium', 400], ['small', 250]], + ...extraDependencies, }, ...opts, }); @@ -106,6 +108,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { evaluate.snapshot('thumbnail details', { name: 'image', extraDependencies: { + checkIfImagePathHasCachedThumbnails: () => true, getSizeOfImagePath: () => 0, getDimensionsOfImagePath: () => [900, 1200], getThumbnailsAvailableForDimensions: () => @@ -117,4 +120,11 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { path: ['media.albumCover', 'beyond-canon', 'png'], }, }); + + quickSnapshot('thumb requested but source is gif', { + slots: { + thumb: 'medium', + path: ['media.flashArt', '5426', 'gif'], + }, + }); }); -- cgit 1.3.0-6-gf8a5 From 243af63c1ca36343f780b6e95b05493ff03ca68b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 24 Sep 2023 10:01:14 -0300 Subject: test: image: supply & test missingImagePaths --- test/snapshot/image.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/snapshot/image.js') diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 8608ab69..2a1e9805 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -14,6 +14,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { getThumbnailEqualOrSmaller: () => 'medium', getThumbnailsAvailableForDimensions: () => [['large', 800], ['medium', 400], ['small', 250]], + missingImagePaths: ['album-art/missing/cover.png'], ...extraDependencies, }, ...opts, @@ -114,6 +115,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { getThumbnailsAvailableForDimensions: () => [['voluminous', 1200], ['middling', 900], ['petite', 20]], getThumbnailEqualOrSmaller: () => 'voluminous', + missingImagePaths: [], }, slots: { thumb: 'gargantuan', @@ -127,4 +129,20 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { path: ['media.flashArt', '5426', 'gif'], }, }); + + quickSnapshot('missing image path', { + slots: { + thumb: 'medium', + path: ['media.albumCover', 'missing', 'png'], + link: true, + }, + }); + + quickSnapshot('missing image path w/ missingSourceContent', { + slots: { + thumb: 'medium', + path: ['media.albumCover', 'missing', 'png'], + missingSourceContent: `Cover's missing, whoops`, + }, + }); }); -- cgit 1.3.0-6-gf8a5