test: create basic tests #24
9 changed files with 21 additions and 13 deletions
|
@ -111,8 +111,7 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
testWidgets('Test correct rendering of entries',
|
||||
(WidgetTester tester) async {
|
||||
testWidgets('Test rendering of entries', (WidgetTester tester) async {
|
||||
// Delete all data
|
||||
await WalletManager.deleteAllData();
|
||||
expect((await WalletManager.listWallets()).length, equals(0));
|
||||
|
|
|
@ -136,7 +136,8 @@ class Wallet {
|
|||
: recurringEntries[recurringEntries.indexOf(ent)].lastRunDate.day,
|
||||
); // add the variable again to check if we aren't missing any entries
|
||||
logger.i(
|
||||
"Last recurred date is now on ${DateFormat.yMMMMd().format(m)} (${n.isAfter(m)})");
|
||||
"Last recurred date is now on ${DateFormat.yMMMMd().format(m)} (${n.isAfter(m)})",
|
||||
);
|
||||
}
|
||||
WalletManager.saveWallet(this); // save wallet
|
||||
}
|
||||
|
@ -173,7 +174,7 @@ class Wallet {
|
|||
fontFamily: 'MaterialIcons',
|
||||
),
|
||||
color: Colors.white,
|
||||
)
|
||||
),
|
||||
],
|
||||
currency: Currency.from(
|
||||
json: {
|
||||
|
|
|
@ -522,6 +522,7 @@ class Indicator extends StatelessWidget {
|
|||
/// Text shown next to the indicator circle
|
||||
final String text;
|
||||
|
||||
/// Text style of the indicator
|
||||
final TextStyle textStyle;
|
||||
|
||||
@override
|
||||
|
|
|
@ -192,7 +192,9 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
|||
onPressed: () {
|
||||
if (newEntry.data.name.isEmpty) {
|
||||
showMessage(
|
||||
AppLocalizations.of(context).errorEmptyName, context);
|
||||
AppLocalizations.of(context).errorEmptyName,
|
||||
context,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (widget.editEntry != null) {
|
||||
|
|
|
@ -315,7 +315,9 @@ class _CreateRecurringEntryViewState extends State<CreateRecurringEntryView> {
|
|||
onPressed: () {
|
||||
if (newEntry.data.name.isEmpty) {
|
||||
showMessage(
|
||||
AppLocalizations.of(context).errorEmptyName, context);
|
||||
AppLocalizations.of(context).errorEmptyName,
|
||||
context,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (widget.editEntry != null) {
|
||||
|
|
|
@ -490,6 +490,7 @@ class _HomeViewState extends State<HomeView> {
|
|||
}
|
||||
description.write("${line.replaceAll(regex, "")}\n");
|
||||
}
|
||||
if (!ctx.mounted) return;
|
||||
Navigator.of(ctx).pop();
|
||||
// show edit
|
||||
final newEntry =
|
||||
|
|
|
@ -146,7 +146,7 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
|||
(await SharedPreferences.getInstance())
|
||||
.getBool("useMaterialYou") ??
|
||||
false;
|
||||
if (!mounted) return;
|
||||
if (!context.mounted) return;
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (c) => PlatformDialog(
|
||||
|
@ -227,7 +227,7 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
|||
await WalletManager.saveWallet(
|
||||
selectedWallet!,
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
|
|
|
@ -70,7 +70,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
|
|||
final s = await SharedPreferences.getInstance();
|
||||
await s.setInt("yearlygraph", 1);
|
||||
_yearly = 1;
|
||||
if (!mounted) return;
|
||||
if (!ctx.mounted) return;
|
||||
Navigator.of(ctx).pop();
|
||||
setState(() {});
|
||||
},
|
||||
|
@ -90,7 +90,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
|
|||
final s = await SharedPreferences.getInstance();
|
||||
await s.setInt("yearlygraph", 2);
|
||||
_yearly = 2;
|
||||
if (!mounted) return;
|
||||
if (!ctx.mounted) return;
|
||||
Navigator.of(ctx).pop();
|
||||
setState(() {});
|
||||
},
|
||||
|
@ -128,7 +128,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
|
|||
final s = await SharedPreferences.getInstance();
|
||||
await s.setInt("monthlygraph", 1);
|
||||
_monthly = 1;
|
||||
if (!mounted) return;
|
||||
if (!ctx.mounted) return;
|
||||
Navigator.of(ctx).pop();
|
||||
setState(() {});
|
||||
},
|
||||
|
@ -148,7 +148,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
|
|||
final s = await SharedPreferences.getInstance();
|
||||
await s.setInt("monthlygraph", 2);
|
||||
_monthly = 2;
|
||||
if (!mounted) return;
|
||||
if (!ctx.mounted) return;
|
||||
Navigator.of(ctx).pop();
|
||||
setState(() {});
|
||||
},
|
||||
|
|
|
@ -75,7 +75,9 @@ class _TessdataListViewState extends State<TessdataListView> {
|
|||
onPressed: () async {
|
||||
await TessdataApi.deleteData(lang);
|
||||
_tessdata[i][lang] = true;
|
||||
if (mounted) Navigator.of(context).pop();
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
PlatformButton(
|
||||
|
|
Loading…
Reference in a new issue