Add image-library dedupe and untagged filter, UI text scaling, table paste
Image library:
- "Clean up duplicates" finds byte-identical images by md5, keeps one
file per group (preferring the most-used, then the oldest), merges
the tags/descriptions and captions of the copies, repoints slides in
open decks and in .md presentations on disk, and deletes the copies
after a confirmation that lists every group.
- A header toggle filters to images without tags/description, so it is
easy to see which ones still need attention.
- The delete warning now also lists presentations on disk that still
reference the image (marked "not open"), next to the open decks.
Editor and accessibility (already in tree):
- Interface text scaling up to 200%, keyboard-operable panel divider,
keyboard-first add-slide dialog, and screen-reader improvements.
- Paste a spreadsheet/CSV/markdown selection into a table cell to fill
the whole grid.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:36:44 +02:00
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:ocideck/utils/table_clipboard.dart';
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
group('parseClipboardTable', () {
|
|
|
|
|
test('parses a spreadsheet (TSV) selection', () {
|
|
|
|
|
expect(parseClipboardTable('Naam\tScore\nJan\t8\nPiet\t9'), [
|
|
|
|
|
['Naam', 'Score'],
|
|
|
|
|
['Jan', '8'],
|
|
|
|
|
['Piet', '9'],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('handles Windows line endings and the trailing newline', () {
|
|
|
|
|
expect(parseClipboardTable('a\tb\r\nc\td\r\n'), [
|
|
|
|
|
['a', 'b'],
|
|
|
|
|
['c', 'd'],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('a single spreadsheet row is still a table', () {
|
|
|
|
|
expect(parseClipboardTable('a\tb\tc'), [
|
|
|
|
|
['a', 'b', 'c'],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('pads ragged rows to a rectangle', () {
|
|
|
|
|
expect(parseClipboardTable('a\tb\tc\nd\te'), [
|
|
|
|
|
['a', 'b', 'c'],
|
|
|
|
|
['d', 'e', ''],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('quoted cells may contain delimiters and newlines', () {
|
|
|
|
|
expect(parseClipboardTable('"regel 1\nregel 2"\t"met\ttab"\nx\ty'), [
|
|
|
|
|
['regel 1\nregel 2', 'met\ttab'],
|
|
|
|
|
['x', 'y'],
|
|
|
|
|
]);
|
|
|
|
|
expect(parseClipboardTable('"a ""quote"""\tb'), [
|
|
|
|
|
['a "quote"', 'b'],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('parses comma and semicolon CSV with consistent columns', () {
|
|
|
|
|
expect(parseClipboardTable('Naam,Score\nJan,8'), [
|
|
|
|
|
['Naam', 'Score'],
|
|
|
|
|
['Jan', '8'],
|
|
|
|
|
]);
|
|
|
|
|
expect(parseClipboardTable('Naam;Score\nJan;8'), [
|
|
|
|
|
['Naam', 'Score'],
|
|
|
|
|
['Jan', '8'],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('prefers the semicolon when commas are decimal separators', () {
|
|
|
|
|
expect(parseClipboardTable('Prijs;Marge\n1,50;0,25\n2,00;0,30'), [
|
|
|
|
|
['Prijs', 'Marge'],
|
|
|
|
|
['1,50', '0,25'],
|
|
|
|
|
['2,00', '0,30'],
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('parses a markdown table and drops the separator row', () {
|
2026-06-11 22:17:07 +02:00
|
|
|
expect(parseClipboardTable('| Naam | Score |\n|---|---:|\n| Jan | 8 |'), [
|
|
|
|
|
['Naam', 'Score'],
|
|
|
|
|
['Jan', '8'],
|
|
|
|
|
]);
|
Add image-library dedupe and untagged filter, UI text scaling, table paste
Image library:
- "Clean up duplicates" finds byte-identical images by md5, keeps one
file per group (preferring the most-used, then the oldest), merges
the tags/descriptions and captions of the copies, repoints slides in
open decks and in .md presentations on disk, and deletes the copies
after a confirmation that lists every group.
- A header toggle filters to images without tags/description, so it is
easy to see which ones still need attention.
- The delete warning now also lists presentations on disk that still
reference the image (marked "not open"), next to the open decks.
Editor and accessibility (already in tree):
- Interface text scaling up to 200%, keyboard-operable panel divider,
keyboard-first add-slide dialog, and screen-reader improvements.
- Paste a spreadsheet/CSV/markdown selection into a table cell to fill
the whole grid.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:36:44 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('plain text is not a table', () {
|
|
|
|
|
expect(parseClipboardTable('gewoon wat tekst'), isNull);
|
|
|
|
|
expect(parseClipboardTable('regel een\nregel twee'), isNull);
|
|
|
|
|
// A sentence with a comma stays a sentence.
|
|
|
|
|
expect(parseClipboardTable('hallo, wereld'), isNull);
|
|
|
|
|
// Inconsistent comma counts: prose, not CSV.
|
|
|
|
|
expect(parseClipboardTable('een, twee en drie\nvier, vijf, zes'), isNull);
|
|
|
|
|
expect(parseClipboardTable(' '), isNull);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|