2023-12-31 07:29:40 +08:00
|
|
|
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
2023-11-09 13:11:13 +08:00
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:integration_test/integration_test.dart';
|
|
|
|
|
|
|
|
import '../util/base.dart';
|
|
|
|
import '../util/common_operations.dart';
|
|
|
|
import '../util/expectation.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
|
|
|
const emoji = '😁';
|
|
|
|
|
|
|
|
group('Icon', () {
|
|
|
|
testWidgets('Update page icon in sidebar', (tester) async {
|
|
|
|
await tester.initializeAppFlowy();
|
|
|
|
await tester.tapGoButton();
|
|
|
|
|
|
|
|
// create document, board, grid and calendar views
|
|
|
|
for (final value in ViewLayoutPB.values) {
|
2023-12-27 11:42:39 +08:00
|
|
|
await tester.createNewPageWithNameUnderParent(
|
2023-11-09 13:11:13 +08:00
|
|
|
name: value.name,
|
|
|
|
parentName: gettingStarted,
|
|
|
|
layout: value,
|
|
|
|
);
|
|
|
|
|
|
|
|
// update its icon
|
|
|
|
await tester.updatePageIconInSidebarByName(
|
|
|
|
name: value.name,
|
|
|
|
parentName: gettingStarted,
|
|
|
|
layout: value,
|
|
|
|
icon: emoji,
|
|
|
|
);
|
|
|
|
|
|
|
|
tester.expectViewHasIcon(
|
|
|
|
value.name,
|
|
|
|
value,
|
|
|
|
emoji,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
testWidgets('Update page icon in title bar', (tester) async {
|
|
|
|
await tester.initializeAppFlowy();
|
|
|
|
await tester.tapGoButton();
|
|
|
|
|
|
|
|
// create document, board, grid and calendar views
|
|
|
|
for (final value in ViewLayoutPB.values) {
|
2023-12-27 11:42:39 +08:00
|
|
|
await tester.createNewPageWithNameUnderParent(
|
2023-11-09 13:11:13 +08:00
|
|
|
name: value.name,
|
|
|
|
parentName: gettingStarted,
|
|
|
|
layout: value,
|
|
|
|
);
|
|
|
|
|
|
|
|
// update its icon
|
|
|
|
await tester.updatePageIconInTitleBarByName(
|
|
|
|
name: value.name,
|
|
|
|
layout: value,
|
|
|
|
icon: emoji,
|
|
|
|
);
|
|
|
|
|
|
|
|
tester.expectViewHasIcon(
|
|
|
|
value.name,
|
|
|
|
value,
|
|
|
|
emoji,
|
|
|
|
);
|
|
|
|
|
|
|
|
tester.expectViewTitleHasIcon(
|
|
|
|
value.name,
|
|
|
|
value,
|
|
|
|
emoji,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|