Merge Tanemaki → Tane rename into main
This commit is contained in:
commit
e65d82017a
66 changed files with 293 additions and 293 deletions
|
|
@ -3,7 +3,7 @@ import 'package:tane/data/export_import/seed_label_codec.dart';
|
|||
|
||||
void main() {
|
||||
group('SeedLabelCodec.encode', () {
|
||||
test('encodes all fields as a tanemaki://seed URI', () {
|
||||
test('encodes all fields as a tane://seed URI', () {
|
||||
final uri = SeedLabelCodec.encode(
|
||||
const SeedLabelData(
|
||||
varietyLabel: 'Acelga de Perales',
|
||||
|
|
@ -13,9 +13,9 @@ void main() {
|
|||
origin: 'Perales',
|
||||
),
|
||||
);
|
||||
expect(uri, startsWith('tanemaki://seed?'));
|
||||
expect(uri, startsWith('tane://seed?'));
|
||||
final parsed = Uri.parse(uri);
|
||||
expect(parsed.scheme, 'tanemaki');
|
||||
expect(parsed.scheme, 'tane');
|
||||
expect(parsed.host, 'seed');
|
||||
expect(parsed.queryParameters, {
|
||||
'v': 'Acelga de Perales',
|
||||
|
|
@ -74,15 +74,15 @@ void main() {
|
|||
group('SeedLabelCodec.decode', () {
|
||||
test('rejects a foreign scheme', () {
|
||||
expect(SeedLabelCodec.decode('https://seed?v=x'), isNull);
|
||||
expect(SeedLabelCodec.decode('tanemaki://other?v=x'), isNull);
|
||||
expect(SeedLabelCodec.decode('tane://other?v=x'), isNull);
|
||||
});
|
||||
|
||||
test('rejects a payload without a variety', () {
|
||||
expect(SeedLabelCodec.decode('tanemaki://seed?s=Beta%20vulgaris'), isNull);
|
||||
expect(SeedLabelCodec.decode('tane://seed?s=Beta%20vulgaris'), isNull);
|
||||
});
|
||||
|
||||
test('ignores an unparseable year rather than throwing', () {
|
||||
final decoded = SeedLabelCodec.decode('tanemaki://seed?v=Maíz&y=old');
|
||||
final decoded = SeedLabelCodec.decode('tane://seed?v=Maíz&y=old');
|
||||
expect(decoded?.varietyLabel, 'Maíz');
|
||||
expect(decoded?.year, isNull);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void main() {
|
|||
.listSync()
|
||||
.whereType<File>()
|
||||
.map((f) => f.uri.pathSegments.last)
|
||||
.where((n) => n.startsWith('tanemaki-auto-'))
|
||||
.where((n) => n.startsWith('tane-auto-'))
|
||||
.toList()
|
||||
..sort();
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ void main() {
|
|||
expect(await service.runIfDue(), isTrue);
|
||||
|
||||
final copies = autoCopies();
|
||||
expect(copies, ['tanemaki-auto-2026-07-10.tanemaki']);
|
||||
expect(copies, ['tane-auto-2026-07-10.tane']);
|
||||
final bytes = File('${dir.path}/${copies.single}').readAsBytesSync();
|
||||
expect(BackupBox.looksSealed(bytes), isTrue);
|
||||
});
|
||||
|
|
@ -117,12 +117,12 @@ void main() {
|
|||
);
|
||||
|
||||
expect(await service.runIfDue(), isTrue);
|
||||
expect(autoCopies(), ['tanemaki-auto-2026-07-10.tanemaki']);
|
||||
expect(autoCopies(), ['tane-auto-2026-07-10.tane']);
|
||||
});
|
||||
|
||||
test('rotation keeps only the newest three copies', () async {
|
||||
for (final d in ['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04']) {
|
||||
File('${dir.path}/tanemaki-auto-$d.tanemaki').writeAsBytesSync([0]);
|
||||
File('${dir.path}/tane-auto-$d.tane').writeAsBytesSync([0]);
|
||||
}
|
||||
final service = newService(
|
||||
newExporter(),
|
||||
|
|
@ -133,9 +133,9 @@ void main() {
|
|||
await service.runIfDue();
|
||||
|
||||
expect(autoCopies(), [
|
||||
'tanemaki-auto-2020-01-03.tanemaki',
|
||||
'tanemaki-auto-2020-01-04.tanemaki',
|
||||
'tanemaki-auto-2026-07-10.tanemaki',
|
||||
'tane-auto-2020-01-03.tane',
|
||||
'tane-auto-2020-01-04.tane',
|
||||
'tane-auto-2026-07-10.tane',
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ void main() {
|
|||
// runIfDue is a no-op today, but an explicit tap still makes a copy.
|
||||
expect(await service.runIfDue(), isFalse);
|
||||
expect(await service.backupNow(), isTrue);
|
||||
expect(autoCopies(), ['tanemaki-auto-2026-07-10.tanemaki']);
|
||||
expect(autoCopies(), ['tane-auto-2026-07-10.tane']);
|
||||
});
|
||||
|
||||
test('a failed backup returns false and never throws', () async {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void main() {
|
|||
|
||||
await service.exportBackup();
|
||||
|
||||
expect(files.savedName, endsWith('.tanemaki'));
|
||||
expect(files.savedName, endsWith('.tane'));
|
||||
expect(BackupBox.looksSealed(files.saved!), isTrue);
|
||||
expect(String.fromCharCodes(files.saved!).contains('Secret'), isFalse);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ const _labels = [
|
|||
commonName: 'Acelga',
|
||||
scientificName: 'Beta vulgaris',
|
||||
details: '2006 · Perales',
|
||||
qrData: 'tanemaki://seed?v=Acelga+de+Perales&y=2006',
|
||||
qrData: 'tane://seed?v=Acelga+de+Perales&y=2006',
|
||||
),
|
||||
LabelSheetLabel(
|
||||
varietyLabel: 'Alubia de Tolosa',
|
||||
qrData: 'tanemaki://seed?v=Alubia+de+Tolosa',
|
||||
qrData: 'tane://seed?v=Alubia+de+Tolosa',
|
||||
),
|
||||
];
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ void main() {
|
|||
final service = LabelSheetService(files: _RecordingFileService());
|
||||
final bytes = await service.buildPdf(
|
||||
labels: const [
|
||||
LabelSheetLabel(varietyLabel: 'Maíz', qrData: 'tanemaki://seed?v=Maíz'),
|
||||
LabelSheetLabel(varietyLabel: 'Maíz', qrData: 'tane://seed?v=Maíz'),
|
||||
],
|
||||
format: LabelSheetFormat.stickers,
|
||||
);
|
||||
|
|
@ -68,7 +68,7 @@ void main() {
|
|||
final service = LabelSheetService(files: _RecordingFileService());
|
||||
final bytes = await service.buildPdf(
|
||||
labels: const [
|
||||
LabelSheetLabel(varietyLabel: 'بامية', qrData: 'tanemaki://seed?v=x'),
|
||||
LabelSheetLabel(varietyLabel: 'بامية', qrData: 'tane://seed?v=x'),
|
||||
],
|
||||
format: LabelSheetFormat.cards,
|
||||
rtl: true,
|
||||
|
|
@ -82,11 +82,11 @@ void main() {
|
|||
final saved = await service.saveLabels(
|
||||
labels: _labels,
|
||||
format: LabelSheetFormat.cards,
|
||||
suggestedName: 'tanemaki-labels-2026-07-10.pdf',
|
||||
suggestedName: 'tane-labels-2026-07-10.pdf',
|
||||
);
|
||||
|
||||
expect(saved, isTrue);
|
||||
expect(files.savedName, 'tanemaki-labels-2026-07-10.pdf');
|
||||
expect(files.savedName, 'tane-labels-2026-07-10.pdf');
|
||||
expect(String.fromCharCodes(files.saved!.take(5)), '%PDF-');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ void main() {
|
|||
final saved = await service.saveCatalog(
|
||||
title: 'What I share',
|
||||
date: 'July 9, 2026',
|
||||
suggestedName: 'tanemaki-catalog-2026-07-09.pdf',
|
||||
suggestedName: 'tane-catalog-2026-07-09.pdf',
|
||||
rows: const [ShareCatalogRow(name: 'Maize', mode: 'To give away')],
|
||||
);
|
||||
|
||||
expect(saved, isTrue);
|
||||
expect(files.savedName, 'tanemaki-catalog-2026-07-09.pdf');
|
||||
expect(files.savedName, 'tane-catalog-2026-07-09.pdf');
|
||||
expect(String.fromCharCodes(files.saved!.take(5)), '%PDF-');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void main() {
|
|||
|
||||
setUp(() {
|
||||
PackageInfo.setMockInitialValues(
|
||||
appName: 'Tanemaki',
|
||||
appName: 'Tane',
|
||||
packageName: 'org.comunes.tane',
|
||||
version: '0.1.0',
|
||||
buildNumber: '1',
|
||||
|
|
@ -38,7 +38,7 @@ void main() {
|
|||
await tester.tap(find.text('About')); // drawer entry
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('種まき'), findsOneWidget);
|
||||
expect(find.text('種'), findsOneWidget);
|
||||
expect(find.textContaining('digital Plantare'), findsOneWidget);
|
||||
await disposeTree(tester);
|
||||
});
|
||||
|
|
@ -57,12 +57,12 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
|
||||
// The backup section pushed the About tile below the fold.
|
||||
await tester.scrollUntilVisible(find.text('About Tanemaki'), 200);
|
||||
await tester.tap(find.text('About Tanemaki'));
|
||||
await tester.scrollUntilVisible(find.text('About Tane'), 200);
|
||||
await tester.tap(find.text('About Tane'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Explanation text and kanji are shown above the fold.
|
||||
expect(find.text('種まき'), findsOneWidget);
|
||||
expect(find.text('種'), findsOneWidget);
|
||||
expect(find.textContaining('helps people and collectives'), findsOneWidget);
|
||||
expect(find.textContaining('digital Plantare'), findsOneWidget);
|
||||
|
||||
|
|
@ -87,8 +87,8 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Settings'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.scrollUntilVisible(find.text('About Tanemaki'), 200);
|
||||
await tester.tap(find.text('About Tanemaki'));
|
||||
await tester.scrollUntilVisible(find.text('About Tane'), 200);
|
||||
await tester.tap(find.text('About Tane'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.scrollUntilVisible(find.text('Open-source licenses'), 200);
|
||||
|
|
|
|||
|
|
@ -109,12 +109,12 @@ void main() {
|
|||
expect(find.text('Copy saved'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('saving a backup writes a sealed .tanemaki file', (tester) async {
|
||||
testWidgets('saving a backup writes a sealed .tane file', (tester) async {
|
||||
await tester.pumpWidget(section());
|
||||
await tester.tap(find.text('Save a backup'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(files.savedName, endsWith('.tanemaki'));
|
||||
expect(files.savedName, endsWith('.tane'));
|
||||
expect(BackupBox.looksSealed(files.savedBytes!), isTrue);
|
||||
expect(find.text('Copy saved'), findsOneWidget);
|
||||
});
|
||||
|
|
@ -210,7 +210,7 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text('This file could not be read as a Tanemaki copy'),
|
||||
find.text('This file could not be read as a Tane copy'),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
|
|
@ -228,7 +228,7 @@ void main() {
|
|||
await tester.tap(find.byKey(const Key('backup.recoverySave')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(files.savedName, 'tanemaki-recovery.pdf');
|
||||
expect(files.savedName, 'tane-recovery.pdf');
|
||||
expect(String.fromCharCodes(files.savedBytes!.take(5)), '%PDF-');
|
||||
// The seed itself never appears in the clear in the PDF stream metadata;
|
||||
// the QR encodes the human code, which IS the secret — that's the point
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void main() {
|
|||
const longLocales = [AppLocale.es, AppLocale.pt, AppLocale.ast];
|
||||
|
||||
setUpAll(() => PackageInfo.setMockInitialValues(
|
||||
appName: 'Tanemaki',
|
||||
appName: 'Tane',
|
||||
packageName: 'org.comunes.tane',
|
||||
version: '0.1.0',
|
||||
buildNumber: '1',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue