Initial commit
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
2026-09-11 15:59:56 -03:00
commit 0037b0b9cf
651 changed files with 199705 additions and 0 deletions

16
test/archive_test.dart Normal file
View File

@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Test if the widget can be created', (WidgetTester tester) async {
/*await tester.pumpWidget(FluffyChatApp(
testWidget: Archive(),
testClient: await testClient(loggedIn: true),
));*/
return;
});
}

View File

@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'dart:convert';
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'utils/test_client.dart';
void main() async {
test('Check for missing /command hints', () async {
final translated =
jsonDecode(File('lib/l10n/intl_en.arb').readAsStringSync()).keys
.where((String k) => k.startsWith('commandHint_'))
.map((k) => k.replaceFirst('commandHint_', ''));
final commands = (await prepareTestClient()).commands.keys;
final missing = commands.where((c) => !translated.contains(c)).toList();
expect(
0,
missing.length,
reason:
'missing hints for $missing\nAdding hints? See scripts/generate_command_hints_glue.sh',
);
});
}

View File

@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
//import 'package:tatchat/pages/homeserver_picker.dart';
//import 'package:tatchat/main.dart';
import 'package:flutter_test/flutter_test.dart';
//import 'utils/test_client.dart';
void main() {
testWidgets('Test if the widget can be created', (WidgetTester tester) async {
/*await tester.pumpWidget(
FluffyChatApp(
client: await prepareTestClient(),
testWidget: HomeserverPicker(),
),
);*/
return;
});
}

View File

@@ -0,0 +1,48 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// ignore_for_file: depend_on_referenced_packages
import 'package:matrix/encryption/utils/key_verification.dart';
import 'package:matrix/matrix.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
Future<Client> prepareTestClient({
bool loggedIn = false,
Uri? homeserver,
String id = 'FluffyChat Widget Test',
}) async {
homeserver ??= Uri.parse('https://fakeserver.notexisting');
final client = Client(
'FluffyChat Widget Tests',
httpClient: FakeMatrixApi()
..api['GET']!['/.well-known/matrix/client'] = (req) => {},
verificationMethods: {
KeyVerificationMethod.numbers,
KeyVerificationMethod.emoji,
},
importantStateEvents: <String>{
'im.ponies.room_emotes', // we want emotes to work properly
},
database: await MatrixSdkDatabase.init(
'test',
database: await databaseFactoryFfi.openDatabase(':memory:'),
sqfliteFactory: databaseFactoryFfi,
),
supportedLoginTypes: {
AuthenticationTypes.password,
AuthenticationTypes.sso,
},
);
await client.checkHomeserver(homeserver);
if (loggedIn) {
await client.login(
LoginType.mLoginToken,
identifier: AuthenticationUserIdentifier(user: '@alice:example.invalid'),
password: '1234',
);
}
return client;
}

26
test/widget_test.dart Normal file
View File

@@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
//import 'package:tatchat/main.dart';
import 'package:flutter_test/flutter_test.dart';
//import 'utils/test_client.dart';
void main() {
testWidgets('Test if the app starts', (WidgetTester tester) async {
/* await tester.pumpWidget(FluffyChatApp(
client: await prepareTestClient(),
));*/
return;
});
}