Merge pull request #560 from GetStream/replace_random_png

feat(ui): Replace random png
This commit is contained in:
Salvatore Giordano
2021-07-26 09:33:19 +02:00
committed by GitHub
11 changed files with 391 additions and 31 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

@@ -0,0 +1,127 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
import 'package:mocktail/mocktail.dart';
import 'package:stream_chat_flutter/src/gradient_avatar.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'mocks.dart';
void main() {
testWidgets(
'control test',
(WidgetTester tester) async {
final client = MockClient();
final clientState = MockClientState();
when(() => client.state).thenReturn(clientState);
when(() => clientState.user).thenReturn(OwnUser(id: 'user-id'));
await tester.pumpWidget(
MaterialApp(
home: StreamChat(
client: client,
child: const Scaffold(
body: Center(
child: SizedBox(
width: 100,
height: 100,
child: GradientAvatar(name: 'demo user', userId: 'demo123'),
),
),
),
),
),
);
expect(find.byType(GradientAvatar), findsOneWidget);
},
);
testGoldens(
'golden test for the name "demo user"',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 100,
height: 100,
child: GradientAvatar(name: 'demo user', userId: 'demo123'),
),
),
),
),
);
await screenMatchesGolden(tester, 'gradient_avatar_0');
},
);
testGoldens(
'golden test for the name "demo"',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 100,
height: 100,
child: GradientAvatar(name: 'demo', userId: 'demo1'),
),
),
),
),
);
await screenMatchesGolden(tester, 'gradient_avatar_1');
},
);
testGoldens(
'control special character test',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 100,
height: 100,
child: GradientAvatar(
name: 'd123@/d de:\$as',
userId: 'demo123',
),
),
),
),
),
);
await screenMatchesGolden(tester, 'gradient_avatar_2');
},
);
testGoldens(
'control special character test 2',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 100,
height: 100,
child: GradientAvatar(name: '123@/d \$as', userId: 'demo123'),
),
),
),
),
);
await screenMatchesGolden(tester, 'gradient_avatar_3');
},
);
}
@@ -80,7 +80,7 @@ void main() {
});
const messageText = '''
a message.
a message.
with multiple lines
and a list:
- a. okasd
@@ -6,32 +6,8 @@ import 'package:stream_chat_flutter/src/reaction_bubble.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'mocks.dart';
import 'simple_frame.dart';
void main() {
testGoldens(
'it should show no reactions',
(WidgetTester tester) async {
await tester.pumpWidgetBuilder(
SimpleFrame(
child: StreamChatTheme(
data: StreamChatThemeData(),
child: const SizedBox(
child: ReactionBubble(
reactions: [],
borderColor: Colors.black,
backgroundColor: Colors.white,
maskColor: Colors.white,
),
),
),
),
surfaceSize: const Size(100, 100),
);
await screenMatchesGolden(tester, 'reaction_bubble_0');
},
);
testGoldens(
'it should show a like - light theme',
(WidgetTester tester) async {