diff --git a/src/Filee.Core/Presets/BuiltInData.cs b/src/Filee.Core/Presets/BuiltInData.cs index e1c69d961..8e041b974 100644 --- a/src/Filee.Core/Presets/BuiltInData.cs +++ b/src/Filee.Core/Presets/BuiltInData.cs @@ -739,7 +739,7 @@ public static List CreateProfiles() { "images" => (["to-png", "to-jpg", "to-webp", "to-gif", "to-pdf", "trace-svg"], ["tool-crop", "rotate", "remove-background", "merge-images", "compress-image", "half-size", "tool-image-edit", "zip-all"]), - "pdf" => (["to-png", "to-jpg", "to-docx", "pdf-slides", "to-txt", "to-hwpx", "to-hwp"], + "pdf" => (["to-png", "to-jpg", "to-docx", "to-xlsx", "pdf-slides", "to-txt", "to-hwpx", "to-hwp"], ["pdf-edit", "pdf-split", "merge-pdf", "compress-pdf", "remove-metadata", "to-tiff", "to-html", "zip-all"]), "office" => (["to-pdf", "to-hwpx", "to-hwp", "to-docx", "to-txt", "to-png", "merge-pdf"], ["translate", "to-md", "pdf-long-image", "zip-all"]), diff --git a/tests/Filee.Core.Tests/BackFaceTests.SlotTable.cs b/tests/Filee.Core.Tests/BackFaceTests.SlotTable.cs index a867d7a46..72a6648d9 100644 --- a/tests/Filee.Core.Tests/BackFaceTests.SlotTable.cs +++ b/tests/Filee.Core.Tests/BackFaceTests.SlotTable.cs @@ -6,11 +6,12 @@ namespace Filee.Core.Tests; public partial class BackFaceTests { // Slot table of #806, with Translate from #836 first on the document, text and e-book backs, and Crop video (#830) - // after Cut a clip. This is a new-install/reset contract, not migration input. + // after Cut a clip, and XLSX (#1343) after Word on the PDF front. This is a new-install/reset contract, not + // migration input. internal static readonly Dictionary ExpectedFaces = new() { ["images"] = (["to-png", "to-jpg", "to-webp", "to-gif", "to-pdf", "trace-svg"], ["tool-crop", "rotate", "remove-background", "merge-images", "compress-image", "half-size", "tool-image-edit", "zip-all"]), - ["pdf"] = (["to-png", "to-jpg", "to-docx", "pdf-slides", "to-txt", "to-hwpx", "to-hwp"], ["pdf-edit", "pdf-split", "merge-pdf", "compress-pdf", "remove-metadata", "to-tiff", "to-html", "zip-all"]), + ["pdf"] = (["to-png", "to-jpg", "to-docx", "to-xlsx", "pdf-slides", "to-txt", "to-hwpx", "to-hwp"], ["pdf-edit", "pdf-split", "merge-pdf", "compress-pdf", "remove-metadata", "to-tiff", "to-html", "zip-all"]), ["office"] = (["to-pdf", "to-hwpx", "to-hwp", "to-docx", "to-txt", "to-png", "merge-pdf"], ["translate", "to-md", "pdf-long-image", "zip-all"]), ["spreadsheets"] = (["to-pdf", "to-xlsx", "to-csv", "to-hwpx", "to-hwp", "merge-pdf"], ["tool-sheet-studio", "to-docx", "to-vcf", "to-ics", "zip-all"]), ["presentations"] = (["to-pdf", "to-png", "to-jpg", "to-pptx", "to-hwpx", "to-hwp", "merge-pdf"], ["to-odp", "pdf-long-image", "to-docx", "zip-all"]), diff --git a/tests/Filee.Core.Tests/BackFaceTests.cs b/tests/Filee.Core.Tests/BackFaceTests.cs index 767c0947f..3c2ebc267 100644 --- a/tests/Filee.Core.Tests/BackFaceTests.cs +++ b/tests/Filee.Core.Tests/BackFaceTests.cs @@ -235,8 +235,8 @@ public void Back_from_Filee_1_0_1_or_1_1_0_a_new_library_gets_its_new_back_faces // The fronts as read are the new ones, so the new back faces; the migrations before 30 then add front slots, and // v31, v33 and v37 back slots, as for any library of that schema. Assert.Equal(schema == 4 - ? ["to-png", "to-jpg", "pdf-long-image", "to-docx", "pdf-slides", "to-hwp", "to-md", "to-epub"] - : ["to-png", "to-jpg", "pdf-long-image", "to-docx", "pdf-slides", "to-txt", "to-md", "to-epub", "to-hwpx", "to-hwp"], + ? ["to-png", "to-jpg", "pdf-long-image", "to-docx", "to-xlsx", "pdf-slides", "to-hwp", "to-md", "to-epub"] + : ["to-png", "to-jpg", "pdf-long-image", "to-docx", "to-xlsx", "pdf-slides", "to-txt", "to-md", "to-epub", "to-hwpx", "to-hwp"], Profile(back, "pdf").PresetIds); Assert.Equal(["pdf-edit", "pdf-split", "merge-pdf", "compress-pdf", "remove-metadata", "to-tiff", "to-html", "zip-all"], Profile(back, "pdf").BackPresetIds); diff --git a/tests/Filee.Core.Tests/PdfXlsxSlotTests.cs b/tests/Filee.Core.Tests/PdfXlsxSlotTests.cs new file mode 100644 index 000000000..c2651c0f4 --- /dev/null +++ b/tests/Filee.Core.Tests/PdfXlsxSlotTests.cs @@ -0,0 +1,30 @@ +// PDF → XLSX (#1343, #1187) works but was on no PDF donut, so people didn't find it. A new library has it on the PDF +// front, after DOCX; an existing library keeps its donuts as they are (#806), and the user adds it from the palette. + +using Filee.Core.Presets; +using Filee.Core.Profiles; + +namespace Filee.Core.Tests; + +public class PdfXlsxSlotTests +{ + private static ToolbarProfile Pdf(List profiles) => profiles.Single(p => p.Id == "pdf"); + + [Fact] + public void A_new_library_has_XLSX_on_the_PDF_front_after_DOCX() + { + var pdf = Pdf(BuiltInData.CreateProfiles()); + + Assert.Equal(pdf.PresetIds.IndexOf("to-docx") + 1, pdf.PresetIds.IndexOf("to-xlsx")); + Assert.DoesNotContain("to-xlsx", pdf.BackPresetIds!); + } + + [Fact] + public void The_schema_58_PDF_donut_stays_without_it() + { + var pdf = Pdf(BuiltInData.ProfilesSchema58()); + + Assert.DoesNotContain("to-xlsx", pdf.PresetIds); + Assert.DoesNotContain("to-xlsx", pdf.BackPresetIds!); + } +}