Skip to content

Commit

Permalink
Integration test cleanup (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored Apr 11, 2024
1 parent dc34272 commit 339ecdb
Showing 1 changed file with 33 additions and 20 deletions.
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.');

0 comments on commit 339ecdb

Please sign in to comment.