Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Merge origin/main: the print studio took settings schema 42, FITS moves to 43

KnifeLemon621907e9944c
diff --cc src/Filee.Core/Settings/AppSettings.cs
index ef6a3867,ef6a3867..e0021201
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@@ -123,7 -123,7 +123,7 @@@ public sealed class DonutSetting
public sealed class AppSettings
{
/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>
-- public const int CurrentSchemaVersion = 42;
++ public const int CurrentSchemaVersion = 43;
public int SchemaVersion { get; set; } = CurrentSchemaVersion;
diff --cc src/Filee.Core/Settings/UserDataStore.cs
index 3ec195be,7a63fcee..10bb6e36
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@@ -807,10 -808,24 +808,28 @@@ internal static class SettingsMigration
// v41: PNG/JPEG download aliases learn the images donut; custom claims stay put.
if (from < 41)
changed |= LearnExtensions(profiles, out _, ["png_large", "jpg_large"]);
- // v42: FITS astronomy pictures (.fits, .fts) learn the images donut; custom claims stay put. (Schema 42 may be
- // renumbered if another change takes it first.)
+ // v42: the print studio for XLSX → PDF (a tool), after "Crop" as in a new library, and first on the back of the
+ // spreadsheets donut when it has room and the user hasn't put it on either face.
if (from < 42)
+ {
+ const string id = "tool-sheet-studio";
+ if (presets.All(p => p.Id != id))
+ {
+ var at = presets.FindIndex(p => p.Id == "tool-crop");
+ presets.Insert(at < 0 ? presets.Count : at + 1, BuiltInData.CreatePresets().Single(p => p.Id == id));
+ changed = true;
+ }
+ if (profiles.FirstOrDefault(p => p.Id == "spreadsheets") is { BackPresetIds: { } back } spreadsheets
+ && !back.Contains(id) && !spreadsheets.PresetIds.Contains(id) && back.Count < ToolbarProfile.MaxSlices)
+ {
+ back.Insert(0, id);
+ changed = true;
+ }
+ }
++ // v43: FITS astronomy pictures (.fits, .fts) learn the images donut; custom claims stay put. (Schema 43 may be
++ // renumbered if another change takes it first.)
++ if (from < 43)
+ changed |= LearnExtensions(profiles, out _, ["fits", "fts"]);
return changed;
}
diff --cc tests/Filee.Core.Tests/FitsFormatTests.cs
index 04d63d40,00000000..08107243
mode 100644,000000..100644
--- a/tests/Filee.Core.Tests/FitsFormatTests.cs
+++ b/tests/Filee.Core.Tests/FitsFormatTests.cs
@@@ -1,64 -1,0 +1,64 @@@
+// FITS astronomy pictures (issue #460): .fits and .fts are FITS, ".fit" is left for Garmin's FIT; the images donut
- // learns the extensions in schema 42 without taking them from a donut of the user's.
++// learns the extensions in schema 43 without taking them from a donut of the user's.
+
+using Filee.Core.Formats;
+using Filee.Core.Presets;
+using Filee.Core.Profiles;
+using Filee.Core.Settings;
+
+namespace Filee.Core.Tests;
+
+public class FitsFormatTests
+{
+ [Theory]
+ [InlineData("m31.fits")]
+ [InlineData("Light_001.FTS")]
+ public void Fits_extensions_are_read_only_images(string file)
+ {
+ var format = FormatRegistry.Detect(file);
+
+ Assert.Equal("fits", format?.Id);
+ Assert.Equal(FormatCategory.Image, format!.Category);
+ Assert.False(format.Writable);
+ }
+
+ [Fact]
+ public void Fit_is_not_taken_for_fits() =>
+ Assert.NotEqual("fits", FormatRegistry.Detect("ride.fit")?.Id);
+
+ [Fact]
+ public void Fresh_profiles_open_the_images_donut_for_fits() =>
+ Assert.Equal("images", ProfileSelector.Select(BuiltInData.CreateProfiles(), ["a.fits", "b.fts"])?.Id);
+
+ [Fact]
- public void Version_41_libraries_learn_fits_once_and_keep_a_custom_claim()
++ public void Version_42_libraries_learn_fits_once_and_keep_a_custom_claim()
+ {
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles();
+ var images = profiles.Single(p => p.Id == "images");
+ images.Extensions.RemoveAll(e => e is "fits" or "fts");
+ profiles.Add(new ToolbarProfile { Id = "astro", Extensions = ["fts"] });
+
- Assert.True(SettingsMigrations.ApplyToLibrary(41, presets, profiles));
++ Assert.True(SettingsMigrations.ApplyToLibrary(42, presets, profiles));
+
+ Assert.Contains("fits", images.Extensions);
+ Assert.DoesNotContain("fts", images.Extensions);
+ Assert.Equal("astro", ProfileSelector.Select(profiles, ["light.fts"])?.Id);
- Assert.False(SettingsMigrations.ApplyToLibrary(41, presets, profiles));
++ Assert.False(SettingsMigrations.ApplyToLibrary(42, presets, profiles));
+ }
+
+ [Fact]
+ public void Presets_saved_before_the_options_debayer_and_keep_tiffs_linear()
+ {
+ var old = System.Text.Json.JsonSerializer.Deserialize("""{"TargetFormat":"png","Image":{"Quality":80}}""",
+ FileeJsonContext.Default.Preset)!;
+ var newer = System.Text.Json.JsonSerializer.Deserialize("""{"TargetFormat":"tiff","Image":{"FitsTiff":"Sharpened"}}""",
+ FileeJsonContext.Default.Preset)!;
+
+ Assert.True(old.Image.FitsDebayer);
+ Assert.Equal(FitsTiffMode.Linear, old.Image.FitsTiff);
+ Assert.Equal(FitsTiffMode.Linear, newer.Image.FitsTiff); // a mode from a newer Filee
+ var stretched = new ImageOptions { FitsTiff = FitsTiffMode.Stretched, FitsDebayer = false }.Clone();
+ Assert.Equal((FitsTiffMode.Stretched, false), (stretched.FitsTiff, stretched.FitsDebayer));
+ }
+}