Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import org.junit.runner.RunWith
* ./gradlew connectedProDebugAndroidTest \
* -Pandroid.testInstrumentationRunnerArguments.class=app.opendocument.droid.test.ScreenshotTests \
* -Pandroid.testInstrumentationRunnerArguments.device=phone \
* -Pandroid.testInstrumentationRunnerArguments.locales=en-US,de-DE
* -Pandroid.testInstrumentationRunnerArguments.locales=en-US+de-DE
* ```
*
* Wants android 15 or newer, and says so rather than photographing what an older one draws.
Expand Down Expand Up @@ -599,7 +599,11 @@ class ScreenshotTests {

// --- what the run was asked for -----------------------------------------

/** The locales to photograph: every one the listing is written in, unless fewer were named. */
/**
* The locales to photograph: every one the listing is written in, unless fewer were named.
*
* A plus separates them as well as a comma, which AGP 9.4.0 cuts such a property at.
*/
private fun locales(spoken: JSONObject): List<String> {
val known = spoken.keys().asSequence().sorted().toList()

Expand All @@ -608,7 +612,7 @@ class ScreenshotTests {
return known
}

val wanted = given.split(",").map { it.trim() }.filter { it.isNotEmpty() }
val wanted = given.split(',', '+').map { it.trim() }.filter { it.isNotEmpty() }
val unknown = wanted.filterNot { it in known }
Assert.assertTrue(
"no such locale: ${unknown.joinToString()}. One of ${known.joinToString()}",
Expand Down
13 changes: 12 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ platform :android do
"android.testInstrumentationRunnerArguments.class" =>
"app.opendocument.droid.test.ScreenshotTests",
"android.testInstrumentationRunnerArguments.device" => device,
"android.testInstrumentationRunnerArguments.locales" => languages.join(",")
# a plus, not a comma: AGP 9.4.0 cuts one of these at the first comma
"android.testInstrumentationRunnerArguments.locales" => languages.join("+")
}
)

Expand All @@ -342,6 +343,16 @@ platform :android do
)
end

# a short list photographs as a complete run, so the count is what catches it.
# Per language rather than as a set, which a release runner does not have.
missing = languages - taken.map { |path| File.basename(File.dirname(path)) }.uniq
unless missing.empty?
UI.user_error!(
"the run photographed #{missing.length} of #{languages.length} languages: " \
"nothing came out for #{missing.join(', ')}"
)
end

FileUtils.mkdir_p(SCREENSHOT_DIR)
taken.each do |path|
locale = File.basename(File.dirname(path))
Expand Down
Loading