diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml
index 0ba2e311c..5ef999eb4 100644
--- a/.github/workflows/msbuild.yml
+++ b/.github/workflows/msbuild.yml
@@ -30,11 +30,15 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- ref: master
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v3
+ - name: Set up .NET SDK for archive regression tests
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '10.0.x'
+
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /t:Restore /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
@@ -45,12 +49,22 @@ jobs:
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:BuildInParallel=true /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
+ # Preserve packaged build artifacts before the regression runner rebuilds referenced projects.
# upload msi and zip artifacts so the publish job below can download and then update latest release via Linux
- uses: actions/upload-artifact@v6
with:
name: quicklook-build-files
path: Build/QuickLook-*.*
+ - name: Test archive view interaction and virtualization
+ working-directory: ${{env.GITHUB_WORKSPACE}}
+ shell: pwsh
+ run: |
+ $solutionDir = (Get-Location).Path + '\'
+ dotnet run --project ./Tests/ArchiveViewer.Regression/ArchiveViewer.Regression.csproj --configuration Release -p:Platform=AnyCPU -p:SolutionDir=$solutionDir
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+
+
publish:
# don't run in parallel - wait for build to complete first
needs: build
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListBox.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListBox.cs
new file mode 100644
index 000000000..a9eadf0e7
--- /dev/null
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListBox.cs
@@ -0,0 +1,86 @@
+// Copyright © 2017-2026 QL-Win Contributors
+// Licensed under the GNU General Public License, version 3 or later.
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Windows.Automation;
+using System.Windows.Automation.Peers;
+using System.Windows.Automation.Provider;
+using System.Windows.Controls;
+
+namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
+
+///
+/// Keeps data-item automation peers when visual containers are recycled.
+/// The flat list remains a List (not a falsely advertised hierarchical UIA tree).
+///
+public sealed class ArchiveFileListBox : ListBox
+{
+ private ArchiveListPeer _peer;
+ internal Action ExpansionRequested { get; set; }
+
+ protected override AutomationPeer OnCreateAutomationPeer() => _peer = new ArchiveListPeer(this);
+
+ internal void ResetAutomationPeers() => _peer?.ClearRows();
+
+ internal void RaiseExpansionChanged(ArchiveFileRow row, bool previous) => _peer?.RaiseExpansionChanged(row, previous);
+
+ private sealed class ArchiveListPeer(ArchiveFileListBox owner) : ListBoxAutomationPeer(owner)
+ {
+ private readonly Dictionary> _rows = [];
+
+ protected override ItemAutomationPeer CreateItemAutomationPeer(object item)
+ {
+ var row = (ArchiveFileRow)item;
+ if (_rows.TryGetValue(row, out var reference) && reference.TryGetTarget(out var peer))
+ return peer;
+ peer = new ArchiveRowPeer(item, this, owner);
+ _rows[row] = new WeakReference(peer);
+ return peer;
+ }
+
+ public void ClearRows() => _rows.Clear();
+
+ public void RaiseExpansionChanged(ArchiveFileRow row, bool previous)
+ {
+ if (_rows.TryGetValue(row, out var reference) && reference.TryGetTarget(out var peer))
+ peer.RaisePropertyChangedEvent(ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
+ previous ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed,
+ row.IsExpanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed);
+ }
+ }
+
+ private sealed class ArchiveRowPeer(object item, ListBoxAutomationPeer parent, ArchiveFileListBox owner)
+ : ListBoxItemAutomationPeer(item, parent), IExpandCollapseProvider
+ {
+ private ArchiveFileRow Row => (ArchiveFileRow)Item;
+
+ protected override string GetNameCore() => Row.Entry.Name;
+
+ protected override string GetHelpTextCore() =>
+ string.Format(CultureInfo.CurrentUICulture, ArchiveFileStrings.LevelFormat, Row.Depth + 1);
+
+ public override object GetPattern(PatternInterface patternInterface) =>
+ patternInterface == PatternInterface.ExpandCollapse && Row.HasChildren
+ ? this : base.GetPattern(patternInterface);
+
+ ExpandCollapseState IExpandCollapseProvider.ExpandCollapseState =>
+ !Row.HasChildren ? ExpandCollapseState.LeafNode :
+ Row.IsExpanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed;
+
+ void IExpandCollapseProvider.Expand() => SetExpanded(true);
+ void IExpandCollapseProvider.Collapse() => SetExpanded(false);
+
+ private void SetExpanded(bool expanded)
+ {
+ owner.Dispatcher.Invoke(() =>
+ {
+ if (!owner.IsEnabled) throw new ElementNotEnabledException();
+ if (!owner.Items.Contains(Row) || owner.ExpansionRequested == null)
+ throw new ElementNotAvailableException();
+ owner.ExpansionRequested(Row, expanded);
+ });
+ }
+ }
+}
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml
index a4ebca1ee..6903fa63e 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml
@@ -1,133 +1,154 @@
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
\ No newline at end of file
+
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml.cs
index bae67a9c6..1e2d5926a 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml.cs
@@ -1,4 +1,4 @@
-// Copyright © 2017-2026 QL-Win Contributors
+// Copyright © 2017-2026 QL-Win Contributors
//
// This file is part of QuickLook program.
//
@@ -15,45 +15,338 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-using QuickLook.Plugin.ArchiveViewer.ArchiveFile;
using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows;
using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
+///
+/// Presents an archive hierarchy with one virtualized items host instead of one
+/// nested TreeViewItem host per directory. The data model is already constructed
+/// off the UI thread by ArchiveInfoPanel.
+///
public partial class ArchiveFileListView : UserControl, IDisposable
{
+ private readonly BatchObservableCollection _rows = [];
+ private readonly Dictionary _rowCache = [];
+ private bool _disposed;
+
public ArchiveFileListView()
{
InitializeComponent();
+ fileList.ExpansionRequested = SetExpanded;
}
+ // Exposed to the ListBox via ElementName binding (no ambient DataContext required).
+ public ObservableCollection Rows => _rows;
+
public void Dispose()
{
- GC.SuppressFinalize(this);
+ if (_disposed)
+ return;
+ _disposed = true;
+ fileList.ExpansionRequested = null;
+ fileList.ResetAutomationPeers();
+ _rowCache.Clear();
+ _rows.ReplaceAll([]);
IconManager.ClearCache();
+ GC.SuppressFinalize(this);
}
public void SetDataContext(object context)
{
- treeGrid.DataContext = context;
+ if (_disposed)
+ return;
+
+ _rowCache.Clear();
+ var entries = context as IEnumerable;
+ fileList.ResetAutomationPeers();
+ if (entries == null)
+ {
+ _rows.ReplaceAll([]);
+ return;
+ }
+
+ var roots = entries.Select(entry => GetRow(entry, 0)).ToList();
+
+ // Preserve the original control's behavior of expanding one root item.
+ if (roots.Count == 1 && roots[0].HasChildren)
+ roots[0].IsExpanded = true;
+
+ var visible = new List();
+ foreach (var root in roots)
+ {
+ visible.Add(root);
+ if (root.IsExpanded)
+ visible.AddRange(EnumerateVisibleChildren(root));
+ }
+
+ _rows.ReplaceAll(visible);
+ }
+
+ private ArchiveFileRow GetRow(ArchiveFileEntry entry, int depth)
+ {
+ if (!_rowCache.TryGetValue(entry, out var row))
+ {
+ row = new ArchiveFileRow(entry, depth);
+ _rowCache.Add(entry, row);
+ }
+
+ return row;
+ }
+
+ private IEnumerable EnumerateVisibleChildren(ArchiveFileRow parent)
+ {
+ foreach (var child in parent.Entry.Children.Keys)
+ {
+ var row = GetRow(child, parent.Depth + 1);
+ yield return row;
+
+ // Keep expanded descendants when their ancestor is collapsed/re-expanded.
+ if (row.IsExpanded)
+ {
+ foreach (var descendant in EnumerateVisibleChildren(row))
+ yield return descendant;
+ }
+ }
+ }
+
+ private void ToggleFolder(object sender, RoutedEventArgs e)
+ {
+ if (!(sender is Button button) || !(button.DataContext is ArchiveFileRow row))
+ return;
+
+ SetExpanded(row, !row.IsExpanded);
+ SelectRow(row, true);
+ }
+
+ private void SetExpanded(ArchiveFileRow row, bool expanded)
+ {
+ if (_disposed || !row.HasChildren || row.IsExpanded == expanded)
+ return;
+
+ var index = _rows.IndexOf(row);
+ if (index < 0)
+ return;
+
+ // Reset invalidates ListBox selection. Preserve it unless collapsing its ancestor.
+ var selected = fileList.SelectedItem as ArchiveFileRow;
+ var restoreFocus = fileList.IsKeyboardFocusWithin;
+ if (row.IsExpanded)
+ {
+ // All descendants occupy a contiguous range in the flattened view.
+ var end = index + 1;
+ while (end < _rows.Count && _rows[end].Depth > row.Depth)
+ end++;
+
+ row.IsExpanded = false;
+ if (selected != null && _rows.IndexOf(selected) > index && _rows.IndexOf(selected) < end)
+ selected = row;
+ _rows.RemoveRange(index + 1, end - index - 1);
+ }
+ else
+ {
+ var children = EnumerateVisibleChildren(row).ToList();
+ row.IsExpanded = true;
+ _rows.InsertRange(index + 1, children);
+ }
+
+ // A Reset avoids thousands of change notifications; keep the clicked row
+ // reachable if the virtualizing panel rebuilt its realized item containers.
+ SelectRow(selected ?? row, restoreFocus);
+ fileList.RaiseExpansionChanged(row, !expanded);
+ }
- treeView.LayoutUpdated += (sender, e) =>
+ private void SelectRow(ArchiveFileRow row, bool restoreFocus = false)
+ {
+ fileList.SelectedItem = row;
+ fileList.ScrollIntoView(row);
+ // A recycled container can disappear during Reset. Restore focus only if
+ // the user was already navigating here; automation must not steal focus.
+ if (restoreFocus || fileList.IsKeyboardFocusWithin)
{
- // return when empty
- if (treeView.Items.Count == 0)
+ fileList.UpdateLayout();
+ (fileList.ItemContainerGenerator.ContainerFromItem(row) as ListBoxItem)?.Focus();
+ }
+ }
+
+ private void SynchronizeHeaders(object sender, ScrollChangedEventArgs e)
+ {
+ if (e.HorizontalChange != 0)
+ columnHeaders.ScrollToHorizontalOffset(e.HorizontalOffset);
+ }
+
+ private void ToggleRowByDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (_disposed || e.ChangedButton != MouseButton.Left)
+ return;
+
+ var source = e.OriginalSource as DependencyObject;
+ while (source != null && source != fileList)
+ {
+ // The expander already handles each click; do not toggle a third time.
+ if (source is Button)
+ return;
+ if (source is ListBoxItem item && item.Content is ArchiveFileRow row)
+ {
+ SetExpanded(row, !row.IsExpanded);
+ SelectRow(row, true);
+ e.Handled = true;
return;
+ }
+
+ source = source is FrameworkContentElement content ? content.Parent :
+ source is Visual ? VisualTreeHelper.GetParent(source) : LogicalTreeHelper.GetParent(source);
+ }
+ }
+
+ private void NavigateTree(object sender, KeyEventArgs e)
+ {
+ if (_disposed || Keyboard.Modifiers != ModifierKeys.None || _rows.Count == 0)
+ return;
+
+ var key = e.Key;
+ if (FlowDirection == FlowDirection.RightToLeft)
+ {
+ if (key == Key.Left) key = Key.Right;
+ else if (key == Key.Right) key = Key.Left;
+ }
- // return when there are more than one root nodes
- if (treeView.Items.Count > 1)
+ var row = fileList.SelectedItem as ArchiveFileRow;
+ var index = row == null ? -1 : _rows.IndexOf(row);
+ switch (key)
+ {
+ case Key.Down:
+ SelectRow(_rows[Math.Min(index + 1, _rows.Count - 1)]);
+ break;
+ case Key.Up:
+ SelectRow(_rows[Math.Max(index - 1, 0)]);
+ break;
+ case Key.Home:
+ SelectRow(_rows[0]);
+ break;
+ case Key.End:
+ SelectRow(_rows[_rows.Count - 1]);
+ break;
+ case Key.Right:
+ case Key.Add:
+ if (row == null) SelectRow(_rows[0]);
+ else if (!row.IsExpanded) SetExpanded(row, true);
+ else if (key == Key.Right && index + 1 < _rows.Count && _rows[index + 1].Depth > row.Depth)
+ SelectRow(_rows[index + 1]);
+ break;
+ case Key.Left:
+ case Key.Subtract:
+ if (row == null) SelectRow(_rows[0]);
+ else if (row.IsExpanded) SetExpanded(row, false);
+ else if (key == Key.Left)
+ for (var i = index - 1; i >= 0; i--)
+ if (_rows[i].Depth < row.Depth)
+ {
+ SelectRow(_rows[i]);
+ break;
+ }
+ break;
+ default:
return;
+ }
+ e.Handled = true;
+ }
+}
+
+///
+/// Expansion state belongs to the data item, not the recycled WPF container.
+///
+public sealed class ArchiveFileRow : INotifyPropertyChanged
+{
+ private bool _isExpanded;
+
+ public ArchiveFileRow(ArchiveFileEntry entry, int depth)
+ {
+ Entry = entry;
+ Depth = depth;
+ }
+
+ public ArchiveFileEntry Entry { get; }
+ public int Depth { get; }
+ public double IndentWidth => Math.Min(Depth * 16.0, 1024.0);
+ public bool HasChildren => Entry.IsFolder && Entry.Children.Count != 0;
+ public string ExpansionGlyph => !HasChildren ? string.Empty : IsExpanded ? "▾" : "▸";
- var root = (TreeViewItem)treeView.ItemContainerGenerator.ContainerFromItem(treeView.Items[0]);
- if (root == null)
+ public bool IsExpanded
+ {
+ get => _isExpanded;
+ set
+ {
+ if (_isExpanded == value)
return;
- root.IsExpanded = true;
- };
+ _isExpanded = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsExpanded)));
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ExpansionGlyph)));
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+}
+
+///
+/// Large expansions produce one collection Reset instead of N UI notifications.
+/// The underlying items remain available for ListBox's container virtualization.
+///
+internal sealed class BatchObservableCollection : ObservableCollection
+{
+ public void ReplaceAll(IEnumerable items)
+ {
+ Items.Clear();
+ if (Items is List list)
+ list.AddRange(items);
+ else
+ foreach (var item in items)
+ Items.Add(item);
+ NotifyReset();
+ }
+
+ public void InsertRange(int index, IEnumerable items)
+ {
+ var batch = items as IList ?? items.ToList();
+ if (batch.Count == 0)
+ return;
+
+ if (Items is List list)
+ list.InsertRange(index, batch);
+ else
+ foreach (var item in batch)
+ Items.Insert(index++, item);
+ NotifyReset();
+ }
+
+ public void RemoveRange(int index, int count)
+ {
+ if (count == 0)
+ return;
+
+ if (Items is List list)
+ list.RemoveRange(index, count);
+ else
+ for (var i = 0; i < count; i++)
+ Items.RemoveAt(index);
+ NotifyReset();
+ }
+
+ private void NotifyReset()
+ {
+ OnPropertyChanged(new PropertyChangedEventArgs("Count"));
+ OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
+ OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileStrings.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileStrings.cs
new file mode 100644
index 000000000..b579b2b2f
--- /dev/null
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileStrings.cs
@@ -0,0 +1,25 @@
+// Copyright © 2017-2026 QL-Win Contributors
+// Licensed under the GNU General Public License, version 3 or later.
+
+using QuickLook.Common.Helpers;
+using System.IO;
+
+namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
+
+///
+/// Accessible archive list labels translated through the plugin's existing language file.
+///
+public static class ArchiveFileStrings
+{
+ private static readonly string TranslationFile =
+ Path.Combine(Path.GetDirectoryName(typeof(ArchiveFileStrings).Assembly.Location), "Translations.config");
+
+ public static readonly string ArchiveContents =
+ TranslationHelper.Get("AV_ArchiveContents", TranslationFile, failsafe: "Archive contents");
+
+ public static readonly string ExpandOrCollapseFolder =
+ TranslationHelper.Get("AV_ExpandOrCollapseFolder", TranslationFile, failsafe: "Expand or collapse folder");
+
+ public static readonly string LevelFormat =
+ TranslationHelper.Get("AV_LevelFormat", TranslationFile, failsafe: "Level {0}");
+}
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs
index 858272fb0..68e4f7dce 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs
@@ -56,6 +56,28 @@ public object ConvertBack(object value, Type targetTypes, object parameter, Cult
}
}
+///
+/// Caps folder indentation to the current name-column width. Keep room for the
+/// 20-pixel expander, 18-pixel icon, and at least 64 pixels of filename text.
+///
+public sealed class AvailableIndentWidthConverter : IValueConverter
+{
+ private const double ReservedWidth = 20.0 + 18.0 + 64.0;
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is not double width || double.IsNaN(width) || double.IsInfinity(width))
+ return 0.0;
+
+ return Math.Max(0.0, width - ReservedWidth);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
+
public sealed class LevelToIndentConverter : DependencyObject, IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config
index 34d87e724..f2026150b 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config
@@ -5,147 +5,234 @@
استخراج إلى المجلد
هل تريد الاحتفاظ بترتيب ملفات الملصقات المخزنة؟
فتح باستخدام عارض الأرشيف
+ محتويات الأرشيف
+ توسيع المجلد أو طيه
+ المستوى {0}
Extreu a la carpeta
Voleu mantenir l'ordre dels fitxers de sticker emmagatzemats?
Obrir amb el Visualitzador d'arxius
+ Contingut de l'arxiu
+ Expandeix o replega la carpeta
+ Nivell {0}
חלץ לתיקייה
האם ברצונך לשמור על סדר קבצי המדבקות (sticker) המאוחסנים?
פתח באמצעות מציג הארכיון
+ תוכן הארכיון
+ הרחבה או כיווץ של תיקייה
+ רמה {0}
डायरेक्टरी में निकालें
क्या आप संग्रहीत स्टिकर फ़ाइलों का क्रम बनाए रखना चाहते हैं?
आर्काइव व्यूअर में खोलें
+ संग्रह की सामग्री
+ फ़ोल्डर को फैलाएँ या समेटें
+ स्तर {0}
डायरेक्टरीमध्ये काढा
आपण संग्रहित स्टिकर फायलींचा क्रम ठेवू इच्छिता?
आर्काइव्ह दर्शकात उघडा
+ संग्रहातील सामग्री
+ फोल्डर विस्तृत किंवा संकुचित करा
+ स्तर {0}
Kibontás mappába
Meg akarja tartani a tárolt sticker fájlok sorrendjét?
Megnyitás archív nézegetővel
+ Archívum tartalma
+ Mappa kibontása vagy összecsukása
+ {0}. szint
Pakk ut til mappe
Vil du beholde rekkefølgen på lagrede sticker-filer?
Åpne med arkivviseren
+ Arkivinnhold
+ Utvid eller skjul mappe
+ Nivå {0}
Uitpakken naar map
Wilt u de volgorde van opgeslagen stickerbestanden behouden?
Openen met Archiefviewer
+ Archiefinhoud
+ Map uitvouwen of samenvouwen
+ Niveau {0}
Extrahovať do priečinka
Chcete zachovať poradie uložených súborov so stickermi?
Otvoriť v prehliadači archívov
+ Obsah archívu
+ Rozbaliť alebo zbaliť priečinok
+ Úroveň {0}
Ekstrak ke folder
Apakah Anda ingin menjaga urutan file sticker yang tersimpan?
Buka dengan Penampil Arsip
+ Isi arsip
+ Perluas atau ciutkan folder
+ Tingkat {0}
Extract to directory
Do you want to keep the order of stored sticker files?
Open with App Viewer
Open with Archive Viewer
+ Archive contents
+ Expand or collapse folder
+ Level {0}
폴더로 추출
스티커 파일의 저장 순서를 유지하시겠습니까?
아카이브 뷰어로 열기
+ 압축 파일 내용
+ 폴더 펼치기 또는 접기
+ 수준 {0}
Extrair para a pasta
Deseja manter a ordem dos arquivos de stickers armazenados?
Abrir com o Visualizador de Arquivos
+ Conteúdo do arquivo compactado
+ Expandir ou recolher pasta
+ Nível {0}
Extrair para a pasta
Deseja manter a ordem dos ficheiros de stickers armazenados?
Abrir com o Visualizador de Arquivos
+ Conteúdo do arquivo
+ Expandir ou recolher pasta
+ Nível {0}
Извлечь в папку
Вы хотите сохранить порядок сохранённых файлов стикеров?
Открыть в просмотрщике архивов
+ Содержимое архива
+ Развернуть или свернуть папку
+ Уровень {0}
Klasöre çıkar
Saklanan sticker dosyalarının sırasını korumak istiyor musunuz?
Arşiv Görüntüleyici ile aç
+ Arşiv içeriği
+ Klasörü genişlet veya daralt
+ Düzey {0}
Trích xuất vào thư mục
Bạn có muốn giữ thứ tự các tệp sticker đã lưu không?
Mở bằng Trình xem lưu trữ
+ Nội dung tệp lưu trữ
+ Mở rộng hoặc thu gọn thư mục
+ Cấp {0}
Extraire vers le dossier
Voulez-vous conserver l'ordre des fichiers de stickers stockés ?
Ouvrir avec le visualiseur d'archives
+ Contenu de l’archive
+ Développer ou réduire le dossier
+ Niveau {0}
Extraer a la carpeta
¿Desea mantener el orden de los archivos de stickers almacenados?
Abrir con el visor de archivos
+ Contenido del archivo
+ Expandir o contraer carpeta
+ Nivel {0}
Estrai nella cartella
Vuoi mantenere l'ordine dei file sticker memorizzati?
Apri con il visualizzatore di archivi
+ Contenuto dell'archivio
+ Espandi o comprimi cartella
+ Livello {0}
Wyodrębnij do folderu
Czy chcesz zachować kolejność przechowywanych plików sticker?
Otwórz w przeglądarce archiwów
+ Zawartość archiwum
+ Rozwiń lub zwiń folder
+ Poziom {0}
Εξαγωγή σε φάκελο
Θέλετε να διατηρήσετε τη σειρά των αποθηκευμένων αρχείων sticker;
Άνοιγμα με το πρόγραμμα προβολής αρχείων
+ Περιεχόμενα αρχείου
+ Ανάπτυξη ή σύμπτυξη φακέλου
+ Επίπεδο {0}
Розпакувати до папки
Ви хочете зберегти порядок збережених файлів стікерів?
Відкрити у переглядачі архівів
+ Вміст архіву
+ Розгорнути або згорнути папку
+ Рівень {0}
提取到目录
是否需要保持已保存表情包文件的顺序?
在应用查看器中打开
在归档查看器中打开
+ 压缩包内容
+ 展开或折叠文件夹
+ 第 {0} 级
提取到資料夾
是否需要保留已儲存表情包檔案的順序?
在歸檔檢視器中開啟
+ 壓縮檔內容
+ 展開或摺疊資料夾
+ 第 {0} 層
フォルダに抽出
保存されたスタッカーファイルの順序を保持しますか?
アーカイブビューアで開く
+ アーカイブの内容
+ フォルダーを展開または折りたたむ
+ レベル {0}
In Ordner extrahieren
Möchten Sie die Reihenfolge der gespeicherten Sticker-Dateien beibehalten?
Mit Archiv-Viewer öffnen
+ Archivinhalt
+ Ordner erweitern oder reduzieren
+ Ebene {0}
Extrahera till mapp
Vill du behålla ordningen på sparade sticker-filer?
Öppna med Arkivvisare
+ Arkivinnehåll
+ Expandera eller dölj mapp
+ Nivå {0}
Extrageți în director
Doriți să păstrați ordinea fișierelor cu autocolante stocate?
Deschide cu vizualizatorul de arhive
+ Conținutul arhivei
+ Extinde sau restrânge dosarul
+ Nivelul {0}
diff --git a/Tests/ArchiveViewer.Regression/ArchiveViewer.Regression.csproj b/Tests/ArchiveViewer.Regression/ArchiveViewer.Regression.csproj
new file mode 100644
index 000000000..0368bc4a3
--- /dev/null
+++ b/Tests/ArchiveViewer.Regression/ArchiveViewer.Regression.csproj
@@ -0,0 +1,14 @@
+
+
+ Exe
+ net462
+ true
+ latest
+
+
+
+
+
+
+
+
diff --git a/Tests/ArchiveViewer.Regression/Program.cs b/Tests/ArchiveViewer.Regression/Program.cs
new file mode 100644
index 000000000..347bfa281
--- /dev/null
+++ b/Tests/ArchiveViewer.Regression/Program.cs
@@ -0,0 +1,556 @@
+using QuickLook.Plugin.ArchiveViewer.ArchiveFile;
+using QuickLook.Common.Helpers;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Xml;
+using System.Linq;
+using System.IO;
+using System.IO.Compression;
+using System.Windows;
+using System.Windows.Automation;
+using System.Windows.Automation.Peers;
+using System.Windows.Automation.Provider;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Threading;
+
+internal static class Program
+{
+ private static int _failures;
+
+ [STAThread]
+ private static int Main(string[] args)
+ {
+ // No Window.Show, desktop input, or external UI automation is used.
+ Run("Rows are keyboard focusable", FocusableRows);
+ Run("Right expands/enters; Left selects parent/collapses", TreeNavigation);
+ Run("Expansion retains selection and descendant state", ExpansionState);
+ Run("Up/Down/Home/End and leaves stay within the visible rows", BoundaryNavigation);
+ Run("RTL tree directions mirror correctly", RightToLeft);
+ Run("Double-click toggles rows without toggling expander twice", DoubleClick);
+ Run("Long names remain available in tooltips", FullNames);
+ Run("Automation exposes full names and expand/collapse", Automation);
+ Run("10000 children are batched and virtualized", LargeExpansion);
+ Run("Headers follow horizontal scrolling at narrow widths", NarrowLayout);
+ Run("Header columns align with row columns", ColumnAlignment);
+ Run("Long filename columns stay aligned across widths and scrolling", LongNameColumnAlignment);
+ Run("Deeply nested folders keep controls visible across window widths", DeepIndentLayout);
+ Run("Accessibility strings are localized in every plugin language", LocalizedAutomationLabels);
+ Run("Rows grow for larger fonts", LargeFonts);
+ Run("Empty, multiple roots and disposed views", Lifecycle);
+ Run("Actual ZIP parser: empty, files, multi-root and nested", ArchiveFixtures);
+ foreach (var path in args)
+ Run("Actual archive parsing and expansion", () => ExistingArchive(path));
+ Console.WriteLine($"Failures: {_failures}");
+ return _failures == 0 ? 0 : 1;
+ }
+
+ private static void Run(string name, Action test)
+ {
+ try { test(); Console.WriteLine("PASS " + name); }
+ catch (Exception e) { _failures++; Console.WriteLine("FAIL " + name + ": " + e.Message); }
+ }
+
+ private static void Check(bool condition, string message)
+ {
+ if (!condition) throw new Exception(message);
+ }
+
+ private static ArchiveFileListView View(params ArchiveFileEntry[] roots)
+ {
+ var view = new ArchiveFileListView();
+ view.SetDataContext(roots);
+ Layout(view);
+ return view;
+ }
+
+ private static ListBox List(ArchiveFileListView view) => (ListBox)view.FindName("fileList");
+
+ private static void Layout(FrameworkElement view)
+ {
+ view.Measure(new Size(800, 320));
+ view.Arrange(new Rect(0, 0, 800, 320));
+ view.UpdateLayout();
+ }
+
+ private static void Key(ListBox list, Key key)
+ {
+ var e = new KeyEventArgs(Keyboard.PrimaryDevice, new TestSource(), 0, key)
+ { RoutedEvent = Keyboard.PreviewKeyDownEvent };
+ list.RaiseEvent(e);
+ }
+
+ private static ArchiveFileEntry Tree()
+ {
+ var root = new ArchiveFileEntry("root", true);
+ var folder = new ArchiveFileEntry("folder", true, root);
+ var nested = new ArchiveFileEntry("nested", true, folder);
+ new ArchiveFileEntry("leaf.txt", false, nested);
+ new ArchiveFileEntry("root-file.txt", false, root);
+ return root;
+ }
+
+ private static void FocusableRows()
+ {
+ using (var view = View(Tree()))
+ {
+ var list = List(view);
+ Check(list.Focusable, "ListBox is not focusable");
+ var item = (ListBoxItem)list.ItemContainerGenerator.ContainerFromIndex(0);
+ Check(item != null && item.Focusable, "Row is not focusable");
+ }
+ }
+
+ private static void TreeNavigation()
+ {
+ using (var view = View(Tree()))
+ {
+ var list = List(view);
+ var folder = view.Rows[1];
+ list.SelectedItem = folder;
+ Key(list, System.Windows.Input.Key.Right);
+ Check(folder.IsExpanded && view.Rows.Count == 4, "Right did not expand folder");
+ Check(ReferenceEquals(list.SelectedItem, folder), "Expand lost selection");
+ Key(list, System.Windows.Input.Key.Right);
+ Check(((ArchiveFileRow)list.SelectedItem).Entry.Name == "nested", "Right did not enter first child");
+ Key(list, System.Windows.Input.Key.Left);
+ Check(ReferenceEquals(list.SelectedItem, folder), "Left did not return to parent");
+ Key(list, System.Windows.Input.Key.Left);
+ Check(!folder.IsExpanded && view.Rows.Count == 3, "Left did not collapse folder");
+ Key(list, System.Windows.Input.Key.Left);
+ Check(((ArchiveFileRow)list.SelectedItem).Entry.Name == "root", "Left did not select root");
+ }
+ }
+
+ private static void ExpansionState()
+ {
+ using (var view = View(Tree()))
+ {
+ var list = List(view);
+ var folder = view.Rows[1];
+ list.SelectedItem = folder;
+ Key(list, System.Windows.Input.Key.Right);
+ var nested = view.Rows[2];
+ list.SelectedItem = nested;
+ Key(list, System.Windows.Input.Key.Right);
+ Check(view.Rows.Count == 5, "Nested expansion failed");
+ list.SelectedItem = folder;
+ Key(list, System.Windows.Input.Key.Left);
+ Check(view.Rows.Count == 3 && nested.IsExpanded, "Collapse lost descendant state");
+ Key(list, System.Windows.Input.Key.Right);
+ Check(view.Rows.Count == 5 && ReferenceEquals(view.Rows[2], nested), "Reopen lost cached descendants");
+ }
+ }
+
+ private static void FullNames()
+ {
+ var name = new string('x', 240) + ".json";
+ using (var view = View(new ArchiveFileEntry(name, false)))
+ {
+ var item = (ListBoxItem)List(view).ItemContainerGenerator.ContainerFromIndex(0);
+ Check(item?.ToolTip as string == name, "Full file name not exposed in tooltip");
+ }
+ }
+
+ private static void BoundaryNavigation()
+ {
+ using (var view = View(Tree()))
+ {
+ var list = List(view);
+ Key(list, System.Windows.Input.Key.Down);
+ Check(ReferenceEquals(list.SelectedItem, view.Rows[0]), "First Down skipped the first row");
+ Key(list, System.Windows.Input.Key.Up);
+ Check(ReferenceEquals(list.SelectedItem, view.Rows[0]), "Up passed the first row");
+ Key(list, System.Windows.Input.Key.End);
+ var leaf = view.Rows.Last();
+ Check(ReferenceEquals(list.SelectedItem, leaf), "End did not select the final row");
+ Key(list, System.Windows.Input.Key.Right);
+ Check(ReferenceEquals(list.SelectedItem, leaf) && !leaf.IsExpanded, "A file was expanded");
+ Key(list, System.Windows.Input.Key.Down);
+ Check(ReferenceEquals(list.SelectedItem, leaf), "Down passed the final row");
+ Key(list, System.Windows.Input.Key.Home);
+ Check(ReferenceEquals(list.SelectedItem, view.Rows[0]), "Home did not select the first row");
+ }
+ }
+
+ private static void RightToLeft()
+ {
+ using (var view = View(Tree()))
+ {
+ view.FlowDirection = FlowDirection.RightToLeft;
+ var folder = view.Rows[1];
+ List(view).SelectedItem = folder;
+ Key(List(view), System.Windows.Input.Key.Left);
+ Check(folder.IsExpanded, "RTL Left did not expand");
+ Key(List(view), System.Windows.Input.Key.Right);
+ Check(!folder.IsExpanded, "RTL Right did not collapse");
+ }
+ }
+
+ private static void DoubleClick()
+ {
+ using (var view = View(Tree()))
+ {
+ var list = List(view);
+ var row = view.Rows[1];
+ var container = (ListBoxItem)list.ItemContainerGenerator.ContainerFromItem(row);
+ list.RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left)
+ { RoutedEvent = Control.MouseDoubleClickEvent, Source = container });
+ Check(row.IsExpanded, "Double-click did not expand folder");
+ Layout(view);
+ container = (ListBoxItem)list.ItemContainerGenerator.ContainerFromItem(row);
+ var expander = Visuals