-
Notifications
You must be signed in to change notification settings - Fork 247
Introduce defaultLocale system property #2203
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c45dc13
Add default locale system prop
nishatoma 17dd374
Move locale proprety to correct module and update snapshots
nishatoma 82b4fe2
Change test name to match codebase properly
nishatoma 4934bf1
Address comments
nishatoma 412e744
Address comments
nishatoma 8619344
Address comments
nishatoma f244315
only set system prop if tag is not null
nishatoma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
paparazzi-gradle-plugin/src/test/projects/locale-qualifier/src/gradle.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| android.useAndroidX=true | ||
| app.cash.paparazzi.localeDefault="" |
4 changes: 4 additions & 0 deletions
4
...i-gradle-plugin/src/test/projects/locale-qualifier/src/main/res/values-fr-rFR/strings.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <string name="color">Couleur</string> | ||
| </resources> |
40 changes: 40 additions & 0 deletions
40
...ocale-qualifier/src/test/java/app/cash/paparazzi/plugin/test/DefaultLocaleSnapshotTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package app.cash.paparazzi.plugin.test | ||
|
|
||
| import app.cash.paparazzi.Paparazzi | ||
| import com.google.testing.junit.testparameterinjector.TestParameter | ||
| import com.google.testing.junit.testparameterinjector.TestParameterInjector | ||
| import org.junit.After | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
|
|
||
| @RunWith(TestParameterInjector::class) | ||
| internal class DefaultLocaleSnapshotTest( | ||
nishatoma marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @TestParameter private val defaultLocale: SystemPropLocale | ||
| ) { | ||
|
|
||
| internal enum class SystemPropLocale(val tag: String?) { | ||
nishatoma marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Default(null), | ||
| EN_GB("en-rGB"), | ||
| FR_FR("fr-rFR") | ||
| } | ||
|
|
||
| init { | ||
| System.setProperty("app.cash.paparazzi.localeDefault", defaultLocale.tag.orEmpty()) | ||
nishatoma marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| @get:Rule | ||
| val paparazzi = Paparazzi() | ||
|
|
||
| @After | ||
| fun tearDown() { | ||
| System.clearProperty("app.cash.paparazzi.localeDefault") | ||
| } | ||
|
|
||
| @Test | ||
| fun `Verify system prop default locale`() { | ||
nishatoma marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| paparazzi.snapshot( | ||
| view = paparazzi.inflate(R.layout.title_color) | ||
| ) | ||
| } | ||
| } | ||
Binary file added
BIN
+5.07 KB
...n.test_DefaultLocaleSnapshotTest_Verify_system_prop_default_locale[Default].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.23 KB
...gin.test_DefaultLocaleSnapshotTest_Verify_system_prop_default_locale[EN_GB].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.33 KB
...gin.test_DefaultLocaleSnapshotTest_Verify_system_prop_default_locale[FR_FR].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14 Bytes
(100%)
...s/images/app.cash.paparazzi.plugin.test_LocaleQualifierTest_locale[Default].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-20 Bytes
(100%)
...pshots/images/app.cash.paparazzi.plugin.test_LocaleQualifierTest_locale[GB].png
nishatoma marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.