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 remote-tracking branch 'origin/main' into pr230-fix

KnifeLemon84e8e2ab67af
diff --cc README.ko.md
index 9e8e211f,0d7a050d..0a08c8bb
--- a/README.ko.md
+++ b/README.ko.md
@@@ -34,7 -34,7 +34,7 @@@
<table>
<tr>
<td width="33%" valign="top"><b>커서 바로 옆에서</b><br>앱 창을 열 필요가 없어요. 끌고 있는 파일에 맞는 형식만 지금 있는 자리에 나타나요.</td>
- <td width="33%" valign="top"><b>249가지 형식, 다른 프로그램 없이</b><br>이미지, PDF, 워드, 엑셀, 파워포인트, HWP, 전자책, 압축 파일, 글꼴, CAD, 3D 모델을 오피스·한컴오피스·LibreOffice 없이 변환해요.</td>
- <td width="33%" valign="top"><b>253가지 형식, 다른 프로그램 없이</b><br>이미지, PDF, 워드, 엑셀, 파워포인트, HWP, 전자책, 압축 파일, 글꼴, CAD, 3D 모델, 지리 정보 데이터를 오피스·한컴오피스·LibreOffice 없이 변환해요.</td>
++ <td width="33%" valign="top"><b>254가지 형식, 다른 프로그램 없이</b><br>이미지, PDF, 워드, 엑셀, 파워포인트, HWP, 전자책, 압축 파일, 글꼴, CAD, 3D 모델, 지리 정보 데이터를 오피스·한컴오피스·LibreOffice 없이 변환해요.</td>
<td width="33%" valign="top"><b>내 컴퓨터 안에서만</b><br>아무것도 업로드하지 않아요. 오프라인으로 동작하고 결과는 원본 옆에 저장해요.</td>
</tr>
</table>
diff --cc README.md
index 7930004a,a2d7909c..2eaf167e
--- a/README.md
+++ b/README.md
@@@ -34,7 -34,7 +34,7 @@@
<table>
<tr>
<td width="33%" valign="top"><b>Right at your cursor</b><br>No app window to open. The formats appear where you already are, only the ones that make sense for the files you drag.</td>
- <td width="33%" valign="top"><b>249 formats, no other software</b><br>Images, PDF, Word, Excel, PowerPoint, HWP, e-books, archives, fonts, CAD and 3D models work without Office, Hancom Office or LibreOffice.</td>
- <td width="33%" valign="top"><b>253 formats, no other software</b><br>Images, PDF, Word, Excel, PowerPoint, HWP, e-books, archives, fonts, CAD, 3D models and geospatial data work without Office, Hancom Office or LibreOffice.</td>
++ <td width="33%" valign="top"><b>254 formats, no other software</b><br>Images, PDF, Word, Excel, PowerPoint, HWP, e-books, archives, fonts, CAD, 3D models and geospatial data work without Office, Hancom Office or LibreOffice.</td>
<td width="33%" valign="top"><b>Stays on your computer</b><br>Nothing is uploaded. Filee works offline and saves the result next to the original.</td>
</tr>
</table>
diff --cc README.zh-CN.md
index 86332117,60d19428..ec9f0c1b
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@@ -34,7 -34,7 +34,7 @@@
<table>
<tr>
<td width="33%" valign="top"><b>就在光标旁</b><br>无需打开应用窗口。只显示适合当前拖动文件的格式,就在你所在的位置。</td>
- <td width="33%" valign="top"><b>249 种格式,无需其他软件</b><br>图片、PDF、Word、Excel、PowerPoint、HWP、电子书、压缩包、字体、CAD 和 3D 模型,无需 Office、韩文办公软件或 LibreOffice。</td>
- <td width="33%" valign="top"><b>253 种格式,无需其他软件</b><br>图片、PDF、Word、Excel、PowerPoint、HWP、电子书、压缩包、字体、CAD、3D 模型和地理信息数据,无需 Office、韩文办公软件或 LibreOffice。</td>
++ <td width="33%" valign="top"><b>254 种格式,无需其他软件</b><br>图片、PDF、Word、Excel、PowerPoint、HWP、电子书、压缩包、字体、CAD、3D 模型和地理信息数据,无需 Office、韩文办公软件或 LibreOffice。</td>
<td width="33%" valign="top"><b>只在你的电脑上</b><br>不上传任何文件。Filee 离线工作,结果保存在原文件旁边。</td>
</tr>
</table>
diff --cc tests/Filee.Core.Tests/UserDataStoreTests.cs
index d3e227b0,7c369ac8..dd334f01
--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs
+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs
@@@ -784,29 -788,94 +788,117 @@@ public class UserDataStoreTest
Assert.DoesNotContain("potm", profiles.Single(p => p.Id == "presentations").Extensions);
}
+ [Fact]
+ public void Version_26_libraries_learn_ofd_on_the_office_donut_and_nothing_else()
+ {
+ // As written with schema 26: no OFD, and the user took RTF off the office donut.
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles();
+ var office = profiles.Single(p => p.Id == "office");
+ office.Extensions.RemoveAll(e => e is "ofd" or "rtf");
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(26, presets, profiles));
+
+ Assert.Contains("ofd", office.Extensions);
+ Assert.DoesNotContain("rtf", office.Extensions);
+ Assert.False(SettingsMigrations.ApplyToLibrary(26, presets, profiles)); // once only
+
+ // A donut of the user that already opens .ofd files keeps them.
+ profiles = BuiltInData.CreateProfiles();
+ profiles.Single(p => p.Id == "office").Extensions.Remove("ofd");
+ profiles.Insert(0, new ToolbarProfile { Id = "invoices", Name = "Invoices", Extensions = ["ofd"] });
+ Assert.False(SettingsMigrations.ApplyToLibrary(26, presets, profiles));
+ Assert.DoesNotContain("ofd", profiles.Single(p => p.Id == "office").Extensions);
+ }
+
+ [Fact]
+ public void Version_24_libraries_get_geospatial_presets_and_their_donut_after_models()
+ {
+ // As written with schema 24: no geospatial formats.
+ var geoIds = BuiltInData.GeoPresets().Select(p => p.Id).ToHashSet();
+ var presets = BuiltInData.CreatePresets().Where(p => !geoIds.Contains(p.Id)).ToList();
+ var profiles = BuiltInData.CreateProfiles().Where(p => p.Id != "geo").ToList();
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(24, presets, profiles));
+
+ Assert.Equal(["to-geojson", "to-shp", "to-kml", "to-gpx", "to-kmz"], presets.Where(p => geoIds.Contains(p.Id)).Select(p => p.Id));
+ Assert.Equal(["geojson", "shp", "kml", "gpx"], presets.Where(p => geoIds.Contains(p.Id)).Select(p => p.TargetFormat).Take(4));
+ var ids = profiles.Select(p => p.Id).ToList();
+ Assert.Equal(ids.IndexOf("models") + 1, ids.IndexOf("geo"));
+ Assert.Equal(ids.IndexOf("mixed") - 1, ids.IndexOf("geo"));
+ var geo = profiles.Single(p => p.Id == "geo");
+ Assert.Equal(["geojson", "kml", "kmz", "gpx", "shp"], geo.Extensions);
+ Assert.Equal(BuiltInData.GeoProfile().PresetIds, geo.PresetIds);
+ Assert.All(geo.PresetIds, id => Assert.Contains(presets, p => p.Id == id));
+ Assert.False(SettingsMigrations.ApplyToLibrary(24, presets, profiles)); // once only
+ }
+
+ [Fact]
+ public void The_geospatial_donut_leaves_out_extensions_a_profile_of_the_user_takes_and_is_skipped_when_all_are_taken()
+ {
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles().Where(p => p.Id != "geo").ToList();
+ profiles.Insert(0, new ToolbarProfile { Id = "earth", Name = "Earth", Extensions = ["kml", "kmz"] });
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(24, presets, profiles));
+ Assert.Equal(["geojson", "gpx", "shp"], profiles.Single(p => p.Id == "geo").Extensions);
+
+ var taken = BuiltInData.CreateProfiles().Where(p => p.Id != "geo").ToList();
+ taken.Insert(0, new ToolbarProfile { Id = "all", Name = "All", Extensions = ["geojson", "kml", "kmz", "gpx", "shp"] });
+ var geoIds = BuiltInData.GeoPresets().Select(p => p.Id).ToHashSet();
+ var withoutPresets = BuiltInData.CreatePresets().Where(p => !geoIds.Contains(p.Id)).ToList();
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(24, withoutPresets, taken)); // the presets are still added
+ Assert.DoesNotContain(taken, p => p.Id == "geo");
+ Assert.Contains(withoutPresets, p => p.Id == "to-shp");
+ }
+
+ [Fact]
+ public void A_geospatial_donut_of_the_user_is_not_replaced()
+ {
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles();
+ var mine = profiles.Single(p => p.Id == "geo");
+ mine.PresetIds = ["to-kml"];
+ mine.Extensions = ["kml"];
+
+ SettingsMigrations.ApplyToLibrary(24, presets, profiles);
+
+ var geo = profiles.Single(p => p.Id == "geo");
+ Assert.Equal(["to-kml"], geo.PresetIds);
+ // The extensions of the default donut that no donut takes yet are added to it, after the user's own.
+ Assert.Equal(["kml", "geojson", "kmz", "gpx", "shp"], geo.Extensions);
+ }
+
+ [Fact]
+ public void Version_24_settings_get_the_geo_engine_after_the_3d_models_engine()
+ {
+ using var dir = new TempDir();
+ File.WriteAllText(Path.Combine(dir.Path, "settings.json"),
+ """{ "schemaVersion": 24, "enginePriority": ["magick", "cad", "model3d", "archive", "pandoc", "libreoffice"] }""");
+
+ var store = new UserDataStore(dir.Path);
+ store.Load();
+
+ Assert.Equal(["magick", "cad", "model3d", "geo", "archive", "pandoc", "libreoffice"], store.Settings.EnginePriority);
+ Assert.Equal(AppSettings.CurrentSchemaVersion, store.Settings.SchemaVersion);
+ }
+
+ [Fact]
+ public void A_new_library_has_the_geospatial_donut_with_presets_that_exist()
+ {
+ using var dir = new TempDir();
+ var store = new UserDataStore(dir.Path);
+ store.Load();
+
+ var ids = store.Profiles.Select(p => p.Id).ToList();
+ Assert.Equal(ids.IndexOf("models") + 1, ids.IndexOf("geo"));
+ var geo = store.Profiles.Single(p => p.Id == "geo");
+ Assert.All(geo.PresetIds, id => Assert.NotNull(store.FindPreset(id)));
+ Assert.Equal("shp", store.FindPreset("to-shp")!.TargetFormat);
+ Assert.Equal("csv", store.FindPreset("to-csv")!.TargetFormat);
+ }
+
[Fact]
public void Version_27_libraries_get_one_zip_on_the_archives_donut_after_extract()
{