Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration test cleanup #612

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions test_integration/bin/slide_notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,31 +208,44 @@ Iterable<String> _printSlides(List<Page> pages, {int? lastSlide}) sync* {
extension on Page {
Iterable<String> get noteLines sync* {
final elements = slideProperties?.notesPage?.pageElements;
if (elements != null) {
for (var element in elements) {
final text = element.shape?.text;
if (text != null) {
final value = text.textElements!
.map((e) => e.textRun?.content)
.whereType<String>()
.where((element) => element.isNotEmpty)
.join()
.trim();

if (value.isNotEmpty) {
// `value` may contain sections split by new-lines. Turn these into
// individual returned "lines" removing extra whitespace and
// blank lines
yield* LineSplitter.split(value)
.map((line) => line.trim())
.where((line) => line.isNotEmpty);
}
}

if (elements == null) {
return;
}

for (var element in elements) {
final text = element.shape?.text;
if (text == null) {
return;
}

yield* text.lines;
}
}
}

extension on TextContent {
Iterable<String> get lines sync* {
final value = textElements!
.map((e) => e.textRun?.content)
.whereType<String>()
.where((element) => element.isNotEmpty)
.join()
.trim();

if (value.isEmpty) {
return;
}

// `value` may contain sections split by new-lines. Turn these into
// individual returned "lines" removing extra whitespace and
// blank lines
yield* LineSplitter.split(value)
.map((line) => line.trim())
.where((line) => line.isNotEmpty);
}
}

final _parser = ArgParser()
..addOption('last-slide')
..addOption('html', help: 'HTML file to write content.');
Loading