From 6eb3291c5e695d17c3b9d4bd01789c79f9846a81 Mon Sep 17 00:00:00 2001 From: routersys Date: Tue, 20 Oct 2026 09:10:25 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=8F=E3=83=BC=E3=83=8D=E3=82=B9=E3=81=AE?= =?UTF-8?q?=E3=82=B1=E3=83=BC=E3=82=B9=E3=81=A8=E5=9F=BA=E6=BA=96=E5=80=A4?= =?UTF-8?q?=E3=82=92=E5=8A=A0=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inflate.Harness/HarnessCases.cs | 70 ++++++++++-- Inflate.Harness/golden.json | 196 ++++++++++++++++++++++++++++++++ 2 files changed, 259 insertions(+), 7 deletions(-) create mode 100644 Inflate.Harness/golden.json diff --git a/Inflate.Harness/HarnessCases.cs b/Inflate.Harness/HarnessCases.cs index f1b7364..dbc5f5c 100644 --- a/Inflate.Harness/HarnessCases.cs +++ b/Inflate.Harness/HarnessCases.cs @@ -1,21 +1,77 @@ -using YukkuriMovieMaker.Plugin.Effects; +using System.Globalization; +using YukkuriMovieMaker.Commons; +using YukkuriMovieMaker.Json; namespace Inflate.Harness; internal static class HarnessCases { - public static IEnumerable<(string Name, IVideoEffect Effect, IReadOnlyList Frames)> All() + public static IEnumerable<(string Name, InflateEffect Effect, IReadOnlyList Frames)> All() { - yield break; + yield return ("default", Create(), [0]); + yield return ("height-animated-frames", Create(effect => effect.Height.CopyFrom(Linear(20d, 200d))), [0, 100, 200, 299]); + yield return ("light-animated-frames", Create(effect => effect.LightDirection.CopyFrom(Linear(-135d, 135d))), [0, 100, 200, 299]); + yield return ("amount-0", Create(effect => effect.Amount.Values[0].Value = 0), [0]); + yield return ("amount-50", Create(effect => effect.Amount.Values[0].Value = 50), [0]); + yield return ("height-0", Create(effect => effect.Height.Values[0].Value = 0), [0]); + yield return ("height-50", Create(effect => effect.Height.Values[0].Value = 50), [0]); + yield return ("height-300", Create(effect => effect.Height.Values[0].Value = 300), [0]); + yield return ("quality-balanced", Create(effect => effect.Quality = InflateQuality.Balanced), [0]); + yield return ("quality-ultra", Create(effect => effect.Quality = InflateQuality.Ultra), [0]); + yield return ("light-direction-90", Create(effect => effect.LightDirection.Values[0].Value = 90), [0]); + yield return ("light-direction-minus-135", Create(effect => effect.LightDirection.Values[0].Value = -135), [0]); + yield return ("light-elevation-0", Create(effect => effect.LightElevation.Values[0].Value = 0), [0]); + yield return ("light-elevation-90", Create(effect => effect.LightElevation.Values[0].Value = 90), [0]); + yield return ("ambient-0", Create(effect => effect.Ambient.Values[0].Value = 0), [0]); + yield return ("ambient-100", Create(effect => effect.Ambient.Values[0].Value = 100), [0]); + yield return ("specular-0", Create(effect => effect.Specular.Values[0].Value = 0), [0]); + yield return ("specular-200", Create(effect => effect.Specular.Values[0].Value = 200), [0]); + yield return ("sharpness-0", Create(effect => effect.Sharpness.Values[0].Value = 0), [0]); + yield return ("sharpness-100", Create(effect => effect.Sharpness.Values[0].Value = 100), [0]); + yield return ("reflection-0", Create(effect => effect.Reflection.Values[0].Value = 0), [0]); + yield return ("reflection-100", Create(effect => effect.Reflection.Values[0].Value = 100), [0]); + yield return ("rim-0", Create(effect => effect.Rim.Values[0].Value = 0), [0]); + yield return ("rim-100", Create(effect => effect.Rim.Values[0].Value = 100), [0]); + yield return ("color-keep-0", Create(effect => effect.ColorKeep.Values[0].Value = 0), [0]); + yield return ("color-keep-50", Create(effect => effect.ColorKeep.Values[0].Value = 50), [0]); } - public static IEnumerable<(string Name, Func Create, Action Change, int Frame)> Transitions() + public static IEnumerable<(string Name, Func Create, Action Change, int Frame)> Transitions() { - yield break; + yield return ("amount-100-to-0", () => Create(), effect => effect.Amount.Values[0].Value = 0, 0); + yield return ("amount-0-to-100", () => Create(effect => effect.Amount.Values[0].Value = 0), effect => effect.Amount.Values[0].Value = 100, 0); + yield return ("amount-100-to-50", () => Create(), effect => effect.Amount.Values[0].Value = 50, 0); + yield return ("height-100-to-200", () => Create(), effect => effect.Height.Values[0].Value = 200, 0); + yield return ("height-100-to-0", () => Create(), effect => effect.Height.Values[0].Value = 0, 0); + yield return ("quality-high-to-ultra", () => Create(), effect => effect.Quality = InflateQuality.Ultra, 0); + yield return ("quality-high-to-balanced", () => Create(), effect => effect.Quality = InflateQuality.Balanced, 0); + yield return ("light-direction-minus-45-to-90", () => Create(), effect => effect.LightDirection.Values[0].Value = 90, 0); + yield return ("light-elevation-50-to-10", () => Create(), effect => effect.LightElevation.Values[0].Value = 10, 0); + yield return ("ambient-30-to-0", () => Create(), effect => effect.Ambient.Values[0].Value = 0, 0); + yield return ("specular-80-to-0", () => Create(), effect => effect.Specular.Values[0].Value = 0, 0); + yield return ("sharpness-50-to-100", () => Create(), effect => effect.Sharpness.Values[0].Value = 100, 0); + yield return ("reflection-30-to-100", () => Create(), effect => effect.Reflection.Values[0].Value = 100, 0); + yield return ("rim-20-to-100", () => Create(), effect => effect.Rim.Values[0].Value = 100, 0); + yield return ("color-keep-100-to-0", () => Create(), effect => effect.ColorKeep.Values[0].Value = 0, 0); } - public static IEnumerable<(string Name, IVideoEffect Effect)> Benchmarks() + public static IEnumerable<(string Name, InflateEffect Effect)> Benchmarks() { - yield break; + yield return ("quality-balanced", Create(effect => effect.Quality = InflateQuality.Balanced)); + yield return ("default", Create()); + yield return ("quality-ultra", Create(effect => effect.Quality = InflateQuality.Ultra)); + yield return ("height-animated", Create(effect => effect.Height.CopyFrom(Linear(20d, 200d)))); + yield return ("light-animated", Create(effect => effect.LightDirection.CopyFrom(Linear(-135d, 135d)))); + yield return ("amount-0", Create(effect => effect.Amount.Values[0].Value = 0)); + } + + static Animation Linear(double from, double to) + => Json.LoadFromText(string.Create(CultureInfo.InvariantCulture, $$"""{"AnimationType":"直線移動","Values":[{"Value":{{from}}},{"Value":{{to}}}]}""")) ?? throw new HarnessException("アニメーションを読み込めません。"); + + public static InflateEffect Create(Action? configure = null) + { + var effect = new InflateEffect(); + configure?.Invoke(effect); + return effect; } } diff --git a/Inflate.Harness/golden.json b/Inflate.Harness/golden.json new file mode 100644 index 0000000..d865d6c --- /dev/null +++ b/Inflate.Harness/golden.json @@ -0,0 +1,196 @@ +{ + "adapter": "Intel(R) Iris(R) Xe Graphics", + "driver": "32.0.101.7085", + "input": "synthetic 640x480 89838D8976198E40", + "canvas": "1280x720", + "cases": [ + { + "name": "default", + "frames": [ + 0 + ], + "hash": "5E413532E9415A974D6DDEEE25682B2B11FE5E8F502EFEBA56ACB35E157E14BF" + }, + { + "name": "height-animated-frames", + "frames": [ + 0, + 100, + 200, + 299 + ], + "hash": "B695C5496E09CBF56A5A2A1DACAD97BE0FEC83649665FD673B5049B9A0240CDC" + }, + { + "name": "light-animated-frames", + "frames": [ + 0, + 100, + 200, + 299 + ], + "hash": "4EBEE322F9C5D68344BF6A929A56BCE1EB1BFC82BAAA8ACF5B49DDA993E7FE3C" + }, + { + "name": "amount-0", + "frames": [ + 0 + ], + "hash": "0A700F76CEDDBAD7C4B6A2C19D46939C1A93940E86C6EFEF1E5A53DB48D2A020" + }, + { + "name": "amount-50", + "frames": [ + 0 + ], + "hash": "80B04573FA947CC8CBAAD0464AF935D0558C60A2FBB8B8E4C415C3650EFDCE97" + }, + { + "name": "height-0", + "frames": [ + 0 + ], + "hash": "7046BFF0FE9B95E20B1A142AF79B2C9D1042A47A0D68BF3FF7D4B4BA28470749" + }, + { + "name": "height-50", + "frames": [ + 0 + ], + "hash": "5B61BDC0C355F058EAEC780AA2038195270229450EFCE5CF144F9F808AA356D8" + }, + { + "name": "height-300", + "frames": [ + 0 + ], + "hash": "EF745CFC3E153115047A8748890DF22B3DB47A46C1B321E5FC59E15D95C79CFB" + }, + { + "name": "quality-balanced", + "frames": [ + 0 + ], + "hash": "16E840EF062E69ADAF4169A2196922F856654FB3E68AC50449920B05135810C9" + }, + { + "name": "quality-ultra", + "frames": [ + 0 + ], + "hash": "E676677800943FB2F27A36A2F8B6791DD92CFF6FAA2E16C1C0E757BACBD531CC" + }, + { + "name": "light-direction-90", + "frames": [ + 0 + ], + "hash": "2B96BF50BB42FD6EB308CBCF2395DB0BF4CEC8DAC27D8A98BDEDE7AB4B2DAEA2" + }, + { + "name": "light-direction-minus-135", + "frames": [ + 0 + ], + "hash": "4E421D920DE5CC8E2E21B8A8A7C09B00A6E1C6EB7BD946128A65B84B62E73508" + }, + { + "name": "light-elevation-0", + "frames": [ + 0 + ], + "hash": "B724612D295FD7F3219822D21A71086F1EA72512E852B697CEA737AB5A868442" + }, + { + "name": "light-elevation-90", + "frames": [ + 0 + ], + "hash": "687C4DE2C04BBEB8FFC30CF95600E5A0326BA3163C6547E2866A62DAE17E210C" + }, + { + "name": "ambient-0", + "frames": [ + 0 + ], + "hash": "E6814D23030735EC00B07434F82D23CCBA0C0ED4091AE0A7DBE8E1195061C4FB" + }, + { + "name": "ambient-100", + "frames": [ + 0 + ], + "hash": "7089598AB75AF71CA580322372CDB51BCDE105A2CD211A7EC5F17C3843BB088D" + }, + { + "name": "specular-0", + "frames": [ + 0 + ], + "hash": "7520B4CD0CE60B9600358D7C1090EF86C1A15BC85EFD41EAD427A07A2F0EA36C" + }, + { + "name": "specular-200", + "frames": [ + 0 + ], + "hash": "6427A36A5CB1AFC3E71B607D2A5A2375A1881B0EA2C193DD1D452794FE143033" + }, + { + "name": "sharpness-0", + "frames": [ + 0 + ], + "hash": "E9F7A660C14C45DE4FE1599DBE0611A5FC155B7B78F852E6BAAA53E32DF16289" + }, + { + "name": "sharpness-100", + "frames": [ + 0 + ], + "hash": "A90DFB5EAABA348DCD0B1B09D3CB638FCDF20525DBB25723FD5B4707286CF318" + }, + { + "name": "reflection-0", + "frames": [ + 0 + ], + "hash": "63AA58C0655B582EAE4E65B6C79D92931314B858370AD1C044EB3346A99CE25F" + }, + { + "name": "reflection-100", + "frames": [ + 0 + ], + "hash": "246D5AF1BE35F2BDA8E69E945E1917998A677C0C3700CB3FAFE08BF5B42F10B9" + }, + { + "name": "rim-0", + "frames": [ + 0 + ], + "hash": "722F6F84AFFC6B3AD0164F7CF5330FE242C5E91C98A74D21E102C042004E32EB" + }, + { + "name": "rim-100", + "frames": [ + 0 + ], + "hash": "1CB27C4FB9488F9E67CFED6D43511B55C943FB3CF294A0D8B5143C7ABF61E8F1" + }, + { + "name": "color-keep-0", + "frames": [ + 0 + ], + "hash": "14D6472254538AE72FC12F4AD0A6E577AC53AB377988021AD265019BA6564870" + }, + { + "name": "color-keep-50", + "frames": [ + 0 + ], + "hash": "7FB457792C18D7F1308ED9974FA2BDE33E8E02A5D0F65895F8AA237297BA0A7F" + } + ] +} \ No newline at end of file