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.

fix(ui): review PDF merge order and persist theme preview opacity

Mustafa1p7b4881e860f9
diff --git a/README.md b/README.md
index 38b0e492..916f8ac8 100644
--- a/README.md
+++ b/README.md
@@ -92,14 +92,14 @@ Filee shows new releases in its menu and updates itself, keeping your settings a
|---|---|
| **Images**: JPG, PNG, WEBP, AVIF, TIFF, BMP, GIF, APNG, ICO, ICNS, JPEG XL, JPEG 2000, PSD/PSB, TGA, PPM, HEIC, QOI, DDS, PCX, MNG, CUR, …; GIMP XCF, camera RAW (CR2, CR3, NEF, ARW, DNG, …), DICOM, OpenEXR, HDR, JPEG XR (Windows), iPhone Live Photo (LIVP) read | any of these (HEIC⁵), PDF, SVG (traced), resized, grayscale; Live/Motion Photos (iPhone, Android) → their video (MP4, MOV⁵) |
| **Vector**: SVG, SVGZ, EMF, WMF, AI · EPS, PS¹ · CDR, VSD, CGM, ODG, FODG² | PDF (vector), PNG and other images, SVG ↔ SVGZ, SVG → DXF/DWG, PDF → EPS/PS¹, SVG → EMF, WMF, ODG² |
-| **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, PPTX (a picture of each page), SVG²; merge, split, page ranges, compress (smaller PDFs) |
+| **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, PPTX (a picture of each page), SVG²; merge (review and rearrange the file order first), split, page ranges, compress (smaller PDFs) |
| **Documents**: DOCX, DOCM, DOTX, EML, Outlook MSG; OFD (Chinese e-invoices, official documents) read · DOC, ODT, FODT, OTT, RTF, WPS, WPD, Pages, ClarisWorks, MacWrite, T602, …² | PDF, DOCX, HWPX, EPUB, TXT, HTML; MSG → EML · ODT, FODT, OTT² |
| **Spreadsheets**: XLSX, XLSM, XLS, XLT, ODS, CSV, TSV · OTS, FODS, Numbers, ET² | PDF, XLSX, ODS, CSV, TSV, JSON, HWPX, HTML · XLT, OTS² |
| **Presentations**: PPTX, PPTM, POTX, POTM, PPSX · PPT, ODP, OTP, FODP, Keynote² | PDF, PNG, JPG, DOCX, HWPX · OTP² |
| **HWP**: HWP, HWPX | PDF, PNG, DOCX, HWPX ↔ HWP, TXT, Markdown, HTML |
-| **Text**: TXT, Markdown, HTML; MHTML (saved web pages) read · reStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter, Textile, man, OPML³ | PDF, DOCX, HWPX, EPUB · each other, PPTX slides³ |
+| **Text**: TXT (including LOG and script source PY, PAC, BAT, COMMAND), Markdown, HTML; MHTML (saved web pages) read · reStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter, Textile, man, OPML³ | UTF-8 TXT, PDF, DOCX, HWPX, EPUB · each other, PPTX slides³ |
| **E-books**: EPUB, KEPUB, MOBI, AZW3, AZW, AZW4, FB2, CBZ, CBR, CB7, HTMLZ, TXTZ · LIT, LRF, CHM, PDB, …⁴ | PDF, EPUB, KEPUB (Kobo), DOCX, TXT, HTML, HWPX · MOBI, AZW3⁴ |
-| **Video**⁵: MP4, MOV, MKV, WEBM, AVI, WMV, FLV, MPEG, TS, M2TS, 3GP, OGV, VOB, … | MP4 (H.264, HEVC, AV1), WEBM, MOV, MKV, AVI, GIF, APNG, MP3, M4A, 720p, subtitles (SRT, ASS, WebVTT) |
+| **Video**⁵: MP4, MOV, MKV, WEBM, AVI, WMV, FLV, MPEG (including Video CD DAT), TS, M2TS, 3GP, OGV, VOB, … | MP4 (H.264, HEVC, AV1), WEBM, MOV, MKV, AVI, GIF, APNG, MP3, M4A, 720p, subtitles (SRT, ASS, WebVTT) |
| **Audio**⁵: MP3, M4A, AAC, WAV, FLAC, OGG, OPUS, WMA, AIFF, AMR, APE, WavPack, TTA, DSD (DSF, DFF), DTS, AC3, E-AC3, … | MP3, M4A (AAC, ALAC), WAV, FLAC, OGG, OPUS, AAC, WavPack, TTA, W64, AC3, E-AC3 |
| **Subtitles**: SRT, ASS/SSA, WebVTT, SAMI (SMI), LRC, TTML, MicroDVD, SCC | each other as UTF-8 (Korean CP949 files read correctly) |
| **Archives**: ZIP, 7Z, RAR, TAR, TAR.GZ, TAR.BZ2, TAR.XZ, GZ, ISO, CAB, DMG, ALZ, EGG, … | extract, ZIP, 7Z, TAR, TAR.GZ; any files → one ZIP |
diff --git a/src/Filee.App/Services/RadialController.cs b/src/Filee.App/Services/RadialController.cs
index a43e5653..16e0bdd8 100644
--- a/src/Filee.App/Services/RadialController.cs
+++ b/src/Filee.App/Services/RadialController.cs
@@ -327,6 +327,13 @@ public sealed class RadialController(
return;
}
+ if (preset.TargetFormat == "pdf" && preset.Pdf.MergeIntoSingle && sources.Count > 1)
+ {
+ Close(animate: false);
+ _ = MergeInOrderAsync(sources, preset.Clone(), web);
+ return;
+ }
+
log.LogInformation("Converting {Count} file(s) with preset {Preset}{Web}", sources.Count, preset.Id,
web is null ? "" : " (from a browser)");
var job = conversions.Start(sources, preset, showInToast: false, web);
@@ -339,6 +346,27 @@ public sealed class RadialController(
ShowProgress(job);
}
+ private async Task MergeInOrderAsync(IReadOnlyList<string> files, Preset preset, WebDrop? web)
+ {
+ try
+ {
+ var ordered = await windows.ChooseMergeOrderAsync(files);
+ if (ordered is not null)
+ {
+ conversions.Start(ordered, preset, web: web);
+ web = null; // the conversion owns the browser drop now
+ }
+ }
+ catch (Exception ex) when (ex is not OutOfMemoryException)
+ {
+ log.LogError(ex, "Could not start the ordered PDF merge");
+ }
+ finally
+ {
+ web?.Dispose();
+ }
+ }
+
/// <summary>The crop tool on files from a browser: they are saved first, then it opens on them.</summary>
private async Task ShowToolForBrowserFilesAsync(WebDrop web, Filee.Core.Presets.Preset preset, PixelPoint? near)
{
diff --git a/src/Filee.App/Services/WindowService.cs b/src/Filee.App/Services/WindowService.cs
index 54eea3e7..ac4347e7 100644
--- a/src/Filee.App/Services/WindowService.cs
+++ b/src/Filee.App/Services/WindowService.cs
@@ -30,6 +30,27 @@ public sealed class WindowService(ILocalizer loc, IServiceProvider services, Mem
internal FormatRequestNoticeWindow? FormatRequestNotice => _formatRequestNotice;
private CropOverlayWindow? _cropOverlay;
+ private MergeOrderWindow? _mergeOrder;
+
+ internal MergeOrderWindow? MergeOrder => _mergeOrder;
+
+ /// <summary>Reviews the order of a PDF merge. Closing or cancelling starts no conversion.</summary>
+ public async Task<IReadOnlyList<string>?> ChooseMergeOrderAsync(IReadOnlyList<string> files)
+ {
+ _mergeOrder?.Close();
+ var dialog = new MergeOrderWindow { DataContext = new MergeOrderViewModel(files) };
+ var closed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
+ dialog.Closed += (_, _) =>
+ {
+ if (_mergeOrder == dialog) _mergeOrder = null;
+ closed.TrySetResult();
+ };
+ _mergeOrder = dialog;
+ dialog.Show();
+ dialog.Activate();
+ await closed.Task;
+ return dialog.Result;
+ }
public MainWindow? Main => _main;
diff --git a/src/Filee.App/ViewModels/MergeOrderViewModel.cs b/src/Filee.App/ViewModels/MergeOrderViewModel.cs
new file mode 100644
index 00000000..78ed4465
--- /dev/null
+++ b/src/Filee.App/ViewModels/MergeOrderViewModel.cs
@@ -0,0 +1,53 @@
+// The files in a merged PDF follow the order reviewed here. Moving a row changes only this copy of the selection.
+
+using System.Collections.ObjectModel;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
+namespace Filee.App.ViewModels;
+
+public sealed class MergeSource(string path)
+{
+ public string Path { get; } = path;
+ public string Name => System.IO.Path.GetFileName(Path);
+}
+
+public sealed partial class MergeOrderViewModel : ObservableObject
+{
+ public MergeOrderViewModel(IReadOnlyList<string> files)
+ {
+ Files = new(files.Select(file => new MergeSource(file)));
+ SelectedFile = Files.FirstOrDefault();
+ }
+
+ public ObservableCollection<MergeSource> Files { get; }
+
+ [ObservableProperty]
+ [NotifyCanExecuteChangedFor(nameof(MoveUpCommand))]
+ [NotifyCanExecuteChangedFor(nameof(MoveDownCommand))]
+ private MergeSource? _selectedFile;
+
+ private bool CanMoveUp() => SelectedFile is not null && Files.IndexOf(SelectedFile) > 0;
+ private bool CanMoveDown() => SelectedFile is not null && Files.IndexOf(SelectedFile) is var index && index >= 0 && index < Files.Count - 1;
+
+ [RelayCommand(CanExecute = nameof(CanMoveUp))]
+ private void MoveUp() => Move(-1);
+
+ [RelayCommand(CanExecute = nameof(CanMoveDown))]
+ private void MoveDown() => Move(1);
+
+ private void Move(int direction)
+ {
+ if (SelectedFile is not { } selected) return;
+ var index = Files.IndexOf(selected);
+ var target = index + direction;
+ if (index < 0 || target < 0 || target >= Files.Count) return;
+ Files.Move(index, target);
+ // ListBox can clear its selection while processing a collection move.
+ SelectedFile = selected;
+ MoveUpCommand.NotifyCanExecuteChanged();
+ MoveDownCommand.NotifyCanExecuteChanged();
+ }
+
+ public IReadOnlyList<string> OrderedFiles => Files.Select(file => file.Path).ToArray();
+}
diff --git a/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs b/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs
index badc7bc3..9ed9b8ae 100644
--- a/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs
@@ -26,6 +26,7 @@ public sealed partial class ThemePageViewModel : ObservableObject
Accent = Color.TryParse(theme.Accent, out var c) ? c : Colors.MediumPurple;
AccentHex = $"#{Accent.R:X2}{Accent.G:X2}{Accent.B:X2}";
CornerRadius = theme.CornerRadius;
+ DonutOpacityPercent = Math.Clamp(store.Settings.Donut.Opacity * 100, 10, 100);
ReduceMotion = theme.ReduceMotion ?? platform.PrefersReducedMotion;
PreviewItems =
[
@@ -49,6 +50,8 @@ public sealed partial class ThemePageViewModel : ObservableObject
public IBrush AccentBrush => new SolidColorBrush(Accent);
[ObservableProperty] private double _cornerRadius;
+ [ObservableProperty, NotifyPropertyChangedFor(nameof(DonutSliceOpacity))] private double _donutOpacityPercent;
+ public double DonutSliceOpacity => DonutOpacityPercent / 100;
[ObservableProperty] private bool _reduceMotion;
partial void OnModeChanged(Choice<ThemeMode>? oldValue, Choice<ThemeMode> newValue)
@@ -71,6 +74,13 @@ public sealed partial class ThemePageViewModel : ObservableObject
Accent = Color.FromRgb(color.R, color.G, color.B);
}
partial void OnCornerRadiusChanged(double value) => Save(t => t.CornerRadius = Math.Round(value));
+ partial void OnDonutOpacityPercentChanged(double value)
+ {
+ if (_loading)
+ return;
+ _store.Settings.Donut.Opacity = Math.Clamp(value / 100, 0.1, 1);
+ _store.SaveSettings();
+ }
partial void OnReduceMotionChanged(bool value) => Save(t => t.ReduceMotion = value);
[RelayCommand]
diff --git a/src/Filee.App/Views/MergeOrderWindow.axaml b/src/Filee.App/Views/MergeOrderWindow.axaml
new file mode 100644
index 00000000..50d6f221
--- /dev/null
+++ b/src/Filee.App/Views/MergeOrderWindow.axaml
@@ -0,0 +1,50 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:Filee.App.ViewModels"
+ x:Class="Filee.App.Views.MergeOrderWindow"
+ x:DataType="vm:MergeOrderViewModel"
+ Title="{DynamicResource merge.order_title}"
+ Icon="avares://Filee/Assets/Icons/filee.ico"
+ Width="600" Height="480" MinWidth="440" MinHeight="320"
+ WindowStartupLocation="CenterScreen">
+ <Window.KeyBindings>
+ <KeyBinding Gesture="Alt+Up" Command="{Binding MoveUpCommand}" />
+ <KeyBinding Gesture="Alt+Down" Command="{Binding MoveDownCommand}" />
+ </Window.KeyBindings>
+ <DockPanel Margin="20">
+ <StackPanel DockPanel.Dock="Top" Spacing="6" Margin="0,0,0,14">
+ <TextBlock Classes="h2" Text="{DynamicResource merge.order_title}" />
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource merge.order_hint}" />
+ </StackPanel>
+ <Grid DockPanel.Dock="Bottom" ColumnDefinitions="Auto,*" Margin="0,14,0,0">
+ <StackPanel Orientation="Horizontal" Spacing="8">
+ <Button x:Name="MoveUp" Content="↑" Command="{Binding MoveUpCommand}"
+ AutomationProperties.Name="{DynamicResource group.move_up}"
+ ToolTip.Tip="{DynamicResource group.move_up}" />
+ <Button x:Name="MoveDown" Content="↓" Command="{Binding MoveDownCommand}"
+ AutomationProperties.Name="{DynamicResource group.move_down}"
+ ToolTip.Tip="{DynamicResource group.move_down}" />
+ </StackPanel>
+ <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8">
+ <Button x:Name="CancelMerge" Content="{DynamicResource common.cancel}" Click="OnCancel" IsCancel="True" />
+ <Button x:Name="StartMerge" Classes="accent" Content="{DynamicResource preset.merge_pdf}" Click="OnMerge" IsDefault="True" />
+ </StackPanel>
+ </Grid>
+ <ListBox x:Name="FileOrder" ItemsSource="{Binding Files}" SelectedItem="{Binding SelectedFile}"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+ <ListBox.Styles>
+ <Style Selector="ListBoxItem">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch" />
+ </Style>
+ </ListBox.Styles>
+ <ListBox.ItemTemplate>
+ <DataTemplate x:DataType="vm:MergeSource">
+ <StackPanel Spacing="2" Margin="4,6" ToolTip.Tip="{Binding Path}">
+ <TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
+ <TextBlock Classes="caption" Text="{Binding Path}" TextTrimming="CharacterEllipsis" />
+ </StackPanel>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </DockPanel>
+</Window>
diff --git a/src/Filee.App/Views/MergeOrderWindow.axaml.cs b/src/Filee.App/Views/MergeOrderWindow.axaml.cs
new file mode 100644
index 00000000..46aa011e
--- /dev/null
+++ b/src/Filee.App/Views/MergeOrderWindow.axaml.cs
@@ -0,0 +1,26 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Filee.App.Services;
+using Filee.App.ViewModels;
+
+namespace Filee.App.Views;
+
+public partial class MergeOrderWindow : Window
+{
+ public MergeOrderWindow()
+ {
+ InitializeComponent();
+ Motion.Track(this);
+ }
+
+ public IReadOnlyList<string>? Result { get; private set; }
+
+ private void OnMerge(object? sender, RoutedEventArgs e)
+ {
+ if (DataContext is not MergeOrderViewModel vm || vm.Files.Count < 2) return;
+ Result = vm.OrderedFiles;
+ Close();
+ }
+
+ private void OnCancel(object? sender, RoutedEventArgs e) => Close();
+}
diff --git a/src/Filee.App/Views/Pages/ThemePage.axaml b/src/Filee.App/Views/Pages/ThemePage.axaml
index 6d96b46b..d0d207bc 100644
--- a/src/Filee.App/Views/Pages/ThemePage.axaml
+++ b/src/Filee.App/Views/Pages/ThemePage.axaml
@@ -66,12 +66,20 @@
<Border Grid.Row="1" Grid.Column="2" Classes="card" VerticalAlignment="Top">
<StackPanel Spacing="14">
<TextBlock Classes="label" Text="{DynamicResource theme.preview}" />
- <c:DonutMenu x:Name="PreviewDonut" Items="{Binding PreviewItems}" OuterRadius="120" CenterTitle="JPG × 3" HorizontalAlignment="Center" />
+ <c:DonutMenu x:Name="PreviewDonut" Items="{Binding PreviewItems}" SliceOpacity="{Binding DonutSliceOpacity}"
+ OuterRadius="120" CenterTitle="JPG × 3" HorizontalAlignment="Center" />
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Center">
<Button Classes="accent" Content="{DynamicResource common.save}" />
<Button Content="{DynamicResource common.cancel}" />
</StackPanel>
- <Slider Value="60" Maximum="100" />
+ <StackPanel Spacing="4">
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Right" Text="{Binding DonutOpacityPercent, StringFormat={}{0:0}%}" />
+ <TextBlock Classes="label" Text="{DynamicResource toolbar.opacity}" />
+ </DockPanel>
+ <Slider x:Name="OpacitySlider" Minimum="10" Maximum="100" Value="{Binding DonutOpacityPercent}"
+ TickFrequency="1" IsSnapToTickEnabled="True" AutomationProperties.Name="{DynamicResource toolbar.opacity}" />
+ </StackPanel>
<ToggleSwitch IsChecked="True" HorizontalAlignment="Center" />
</StackPanel>
</Border>
diff --git a/tests/Filee.App.Tests/MergeOrderTests.cs b/tests/Filee.App.Tests/MergeOrderTests.cs
new file mode 100644
index 00000000..44b0e4be
--- /dev/null
+++ b/tests/Filee.App.Tests/MergeOrderTests.cs
@@ -0,0 +1,149 @@
+// Issue #268: interact with the real order chooser, then inspect the actual merged PDF's pages.
+
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Headless;
+using Avalonia.Headless.XUnit;
+using Avalonia.Input;
+using Avalonia.Threading;
+using Filee.App.Services;
+using Filee.App.ViewModels;
+using Filee.App.Views;
+using Filee.Core.Conversion;
+using Filee.Core.Settings;
+using PdfSharp.Pdf;
+using PdfSharp.Pdf.IO;
+
+namespace Filee.App.Tests;
+
+public class MergeOrderTests
+{
+ private static void Click(Window window, string name)
+ {
+ var button = window.FindControl<Button>(name)!;
+ var at = button.TranslatePoint(new Point(button.Bounds.Width / 2, button.Bounds.Height / 2), window)!.Value;
+ window.MouseDown(at, MouseButton.Left);
+ window.MouseUp(at, MouseButton.Left);
+ RenderTests.Pump();
+ }
+
+ [AvaloniaTheory]
+ [InlineData(false)]
+ [InlineData(true)]
+ public async Task Donut_merge_waits_for_review_and_uses_the_chosen_order_or_cancels(bool cancel)
+ {
+ TestServices.EnsureInitialized();
+ var folder = Directory.CreateTempSubdirectory("filee-merge-order-").FullName;
+ var store = AppHost.Get<UserDataStore>();
+ var profile = store.Profiles.Single(p => p.Id == "pdf");
+ var previous = profile.PresetIds;
+ var preset = store.FindPreset("merge-pdf")!;
+ var previousOutput = preset.Output;
+ var conversions = AppHost.Get<ConversionService>();
+ var before = conversions.Jobs.Select(j => j.Job.Id).ToHashSet();
+ var radial = AppHost.Get<RadialController>();
+ var windows = AppHost.Get<WindowService>();
+ try
+ {
+ var inputs = new List<string>();
+ foreach (var width in new[] { 200, 300, 400 })
+ {
+ // Identical names in different folders stay distinguishable in the chooser.
+ var dir = Directory.CreateDirectory(Path.Combine(folder, width.ToString())).FullName;
+ var path = Path.Combine(dir, "source.pdf");
+ using var document = new PdfDocument();
+ var page = document.AddPage();
+ page.Width = PdfSharp.Drawing.XUnit.FromPoint(width);
+ page.Height = PdfSharp.Drawing.XUnit.FromPoint(500);
+ document.Save(path);
+ inputs.Add(path);
+ }
+ profile.PresetIds = ["merge-pdf"];
+ preset.Output = new() { Location = Filee.Core.Presets.OutputLocation.CustomFolder, CustomFolder = folder };
+ radial.ShowForFiles(450, 400, inputs);
+ var donut = radial.Window!.DonutControl;
+ Assert.True(donut.HandleKey(Key.Right));
+ Assert.True(donut.HandleKey(Key.Enter));
+ RenderTests.Pump();
+
+ var dialog = Assert.IsType<MergeOrderWindow>(windows.MergeOrder);
+ var vm = Assert.IsType<MergeOrderViewModel>(dialog.DataContext);
+ Assert.False(radial.IsVisible);
+ Assert.DoesNotContain(conversions.Jobs, j => !before.Contains(j.Job.Id));
+ Assert.Equal(inputs, vm.OrderedFiles);
+ Assert.False(dialog.FindControl<Button>("MoveUp")!.IsEffectivelyEnabled);
+ Click(dialog, "MoveDown"); // 300, 200, 400
+ Assert.Equal([inputs[1], inputs[0], inputs[2]], vm.OrderedFiles);
+ dialog.KeyPress(Key.Down, RawInputModifiers.Alt, PhysicalKey.ArrowDown, null); // 300, 400, 200
+ RenderTests.Pump();
+ Assert.Equal([inputs[1], inputs[2], inputs[0]], vm.OrderedFiles);
+ Assert.False(dialog.FindControl<Button>("MoveDown")!.IsEffectivelyEnabled);
+ Click(dialog, cancel ? "CancelMerge" : "StartMerge");
+
+ if (cancel)
+ {
+ await Task.Delay(50, TestContext.Current.CancellationToken);
+ Dispatcher.UIThread.RunJobs();
+ Assert.DoesNotContain(conversions.Jobs, j => !before.Contains(j.Job.Id));
+ Assert.Empty(Directory.EnumerateFiles(folder, "*.pdf"));
+ }
+ else
+ {
+ JobViewModel? started = null;
+ for (var i = 0; i < 200; i++)
+ {
+ Dispatcher.UIThread.RunJobs();
+ started = conversions.Jobs.FirstOrDefault(j => !before.Contains(j.Job.Id));
+ if (started?.Job.State is JobState.Completed or JobState.Failed) break;
+ await Task.Delay(20, TestContext.Current.CancellationToken);
+ }
+ Assert.NotNull(started);
+ Assert.Equal(JobState.Completed, started.Job.State);
+ Assert.Equal([inputs[1], inputs[2], inputs[0]], started.Job.Files.Select(f => f.SourcePath));
+ using var merged = PdfReader.Open(Assert.Single(started.Job.Outputs), PdfDocumentOpenMode.Import);
+ Assert.Equal([300d, 400d, 200d], merged.Pages.Cast<PdfPage>().Select(p => p.Width.Point));
+ }
+ Assert.All(inputs, path => Assert.True(File.Exists(path)));
+ }
+ finally
+ {
+ windows.MergeOrder?.Close();
+ radial.Close(animate: false);
+ profile.PresetIds = previous;
+ preset.Output = previousOutput;
+ Directory.Delete(folder, true);
+ }
+ }
+
+ [AvaloniaTheory]
+ [InlineData("en")]
+ [InlineData("es")]
+ [InlineData("ja")]
+ [InlineData("ko")]
+ [InlineData("zh-CN")]
+ [InlineData("pl")]
+ [InlineData("hi")]
+ [InlineData("ru")]
+ public void Chooser_renders_long_paths_at_its_minimum_width(string language)
+ {
+ TestServices.EnsureInitialized(language);
+ var vm = new MergeOrderViewModel([
+ @"C:\Documents\Quarterly reports\2026\This is a very long document name with spaces.pdf",
+ @"C:\Documents\Another folder\This is a very long document name with spaces.pdf",
+ @"C:\Documents\旅行の記録とملاحظات\中文-한국어-שלום.pdf"]);
+ var window = new MergeOrderWindow { DataContext = vm, Width = 440, Height = 360 };
+ try
+ {
+ window.Show();
+ RenderTests.Pump();
+ var merge = window.FindControl<Button>("StartMerge")!;
+ var cancel = window.FindControl<Button>("CancelMerge")!;
+ var down = window.FindControl<Button>("MoveDown")!;
+ Assert.True(merge.TranslatePoint(default, window)!.Value.X > down.TranslatePoint(default, window)!.Value.X + down.Bounds.Width);
+ Assert.True(cancel.TranslatePoint(default, window)!.Value.X + cancel.Bounds.Width <= merge.TranslatePoint(default, window)!.Value.X);
+ Assert.True(window.FindControl<ListBox>("FileOrder")!.Bounds.Height > 80);
+ RenderTests.Save(window, $"issue268-merge-order-{language}.png");
+ }
+ finally { window.Close(); }
+ }
+}
diff --git a/tests/Filee.App.Tests/ThemeOpacityTests.cs b/tests/Filee.App.Tests/ThemeOpacityTests.cs
new file mode 100644
index 00000000..59461f73
--- /dev/null
+++ b/tests/Filee.App.Tests/ThemeOpacityTests.cs
@@ -0,0 +1,65 @@
+// Issue #276: the opacity example in Theme must control and preview the persisted donut opacity.
+
+using Avalonia.Controls;
+using Avalonia.Headless.XUnit;
+using Filee.App.Controls;
+using Filee.App.Services;
+using Filee.App.ViewModels.Pages;
+using Filee.App.Views.Pages;
+using Filee.Core.Localization;
+using Filee.Core.Platform;
+using Filee.Core.Settings;
+
+namespace Filee.App.Tests;
+
+public class ThemeOpacityTests
+{
+ [AvaloniaTheory]
+ [InlineData(ThemeMode.Light)]
+ [InlineData(ThemeMode.Dark)]
+ public void Opacity_slider_updates_the_real_preview_and_survives_reopening(ThemeMode mode)
+ {
+ TestServices.EnsureInitialized();
+ var folder = Directory.CreateTempSubdirectory("filee-opacity-").FullName;
+ var store = new UserDataStore(folder);
+ store.Load();
+ store.Settings.Theme.Mode = mode;
+ store.Settings.Donut.Opacity = 0.72;
+ AppHost.Get<ThemeService>().Apply(store.Settings.Theme, "en");
+ var model = new ThemePageViewModel(store, AppHost.Get<ILocalizer>(), AppHost.Get<IPlatformServices>());
+ var page = new ThemePage { DataContext = model };
+ var window = new Window { Content = page, Width = 980, Height = 760 };
+ try
+ {
+ window.Show();
+ RenderTests.Pump();
+ var slider = page.FindControl<Slider>("OpacitySlider")!;
+ var preview = page.FindControl<DonutMenu>("PreviewDonut")!;
+ Assert.Equal(72, slider.Value);
+ Assert.Equal(0.72, preview.SliceOpacity, 6);
+
+ slider.Value = 30;
+ RenderTests.Pump();
+ Assert.Equal(0.30, preview.SliceOpacity, 6);
+ Assert.Equal(0.30, store.Settings.Donut.Opacity, 6);
+ RenderTests.Save(window, $"issue276-opacity-30-{mode}.png");
+
+ slider.Value = 100;
+ RenderTests.Pump();
+ Assert.Equal(1, preview.SliceOpacity);
+ RenderTests.Save(window, $"issue276-opacity-100-{mode}.png");
+
+ var reloaded = new UserDataStore(folder);
+ reloaded.Load();
+ var reopened = new ThemePageViewModel(reloaded, AppHost.Get<ILocalizer>(), AppHost.Get<IPlatformServices>());
+ Assert.Equal(100, reopened.DonutOpacityPercent);
+ Assert.Equal(1, reopened.DonutSliceOpacity);
+ }
+ finally
+ {
+ window.Close();
+ TestServices.EnsureInitialized();
+ Directory.Delete(folder, true);
+ }
+ }
+}