1
0
Fork 0

refactor(P5b-2): 출력 형식 교집합 로직을 ProviderRegistry로 추출 (매트릭스 필터 테스트화)

MainWindow.RefreshAvailableOutputFormats에 박혀 있던 '큐 전체 공통 출력' 교집합 계산을
ProviderRegistry.AvailableOutputsForFiles 순수 쿼리로 추출 — 코드비하인드 18줄 → 2줄, 헤드리스 테스트 가능.

- ProviderRegistry.AvailableOutputsForFiles(sourcePaths): 비면 전체 출력, 아니면 OutputsForFile 교집합.
- MainWindow: 인라인 교집합 루프 제거 → 레지스트리 메서드 호출. UI(콤보 빌드)는 그대로.
- 테스트 2개: 빈 입력=전체, png+csv 혼합 시 jpg가 교집합에서 빠짐(매트릭스 필터 핵심 동작).

81 → 83개 테스트 전부 그린, 빌드 0경고/0오류.
This commit is contained in:
Yun Chan 2026-06-02 09:53:26 +09:00
parent ba5738e705
commit e95ec967e6
3 changed files with 43 additions and 19 deletions

View file

@ -952,25 +952,8 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow
{
if (OutputFormatCombo is null) return;
var engine = _engine;
IReadOnlyCollection<string> available;
if (_activeQueue.Count == 0)
{
available = engine.Providers.AllOutputExtensions;
}
else
{
HashSet<string>? intersection = null;
foreach (var item in _activeQueue)
{
var outs = engine.Providers.OutputsForFile(item.SourcePath);
var outSet = new HashSet<string>(outs, StringComparer.OrdinalIgnoreCase);
if (intersection is null) intersection = outSet;
else intersection.IntersectWith(outSet);
}
available = intersection ?? new HashSet<string>(StringComparer.OrdinalIgnoreCase);
}
var available = _engine.Providers.AvailableOutputsForFiles(
_activeQueue.Select(q => q.SourcePath).ToList());
var visible = AllFormats.Where(f => available.Contains(f.Extension)).ToList();
if (visible.Count == 0)