测试实验室的仪器测试失败,错误的货币符号

Instrumentation test failed on Test Lab, bad currency symbol

我正在尝试使用 Firebase 测试实验室 运行 对我的 Android 应用进行仪器测试,但一些测试失败了,因为货币符号不是欧元 (),而是标准货币符号 (¤)。

语言环境定义明确(法语),在我的本地机器上运行没有问题。

我是否应该不在测试 class 中硬写 符号并使用 Currency class 动态获取它?但好的做法是始终硬写期望值...

Expected: with text: is "0,00 €"
Got: "AppCompatTextView{id=2131296465, res-name=total, visibility=VISIBLE, width=1071, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@120f8796, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=0,00 ¤, input-type=0, ime-target=false, has-links=false}"

可以使用 --device 参数将所需的语言环境传递给测试实验室。

gcloud firebase test android run 的文档所示:

--device is now the preferred way to specify test devices and may not be used in conjunction with --devices-ids, --os-version-ids, --locales, or --orientations. Omitting all of the preceding dimension-related flags will run tests against a single device using defaults for all four device dimensions.

--device model=shamu,version=23,locale=fr_FR,orientation=default

否则它将只使用默认语言环境 en - 这会导致 ¤ 未指定的货币符号。

假设法语语言环境意味着 作为货币符号可能是错误的;因为当运行gcloud firebase test android locales list时,它输出了相当多的菌落:

│ fr     │ French                      │                                          
│ fr_BE  │ French                      │ Belgium                           
│ fr_BF  │ French                      │ Burkina Faso                      
│ fr_BI  │ French                      │ Burundi                           
│ fr_BJ  │ French                      │ Benin                             
│ fr_BL  │ French                      │ Saint Barthélemy                  
│ fr_CA  │ French                      │ Canada                            
│ fr_CD  │ French                      │ Congo (DRC)                       
│ fr_CF  │ French                      │ Central African Republic          
│ fr_CG  │ French                      │ Congo (Republic)                  
│ fr_CH  │ French                      │ Switzerland                       
│ fr_CI  │ French                      │ Côte d’Ivoire                     
│ fr_CM  │ French                      │ Cameroon                          
│ fr_DJ  │ French                      │ Djibouti                          
│ fr_DZ  │ French                      │ Algeria                           
│ fr_FR  │ French                      │ France                            
│ fr_GA  │ French                      │ Gabon                             
│ fr_GF  │ French                      │ French Guiana                     
│ fr_GN  │ French                      │ Guinea                            
│ fr_GP  │ French                      │ Guadeloupe                        
│ fr_GQ  │ French                      │ Equatorial Guinea                 
│ fr_HT  │ French                      │ Haiti                             
│ fr_KM  │ French                      │ Comoros                           
│ fr_LU  │ French                      │ Luxembourg                        
│ fr_MA  │ French                      │ Morocco                           
│ fr_MC  │ French                      │ Monaco                            
│ fr_MF  │ French                      │ Saint Martin                      
│ fr_MG  │ French                      │ Madagascar                        
│ fr_ML  │ French                      │ Mali                              
│ fr_MQ  │ French                      │ Martinique                        
│ fr_MR  │ French                      │ Mauritania                        
│ fr_MU  │ French                      │ Mauritius                         
│ fr_NC  │ French                      │ New Caledonia                     
│ fr_NE  │ French                      │ Niger                             
│ fr_PF  │ French                      │ French Polynesia                  
│ fr_PM  │ French                      │ Saint Pierre and Miquelon         
│ fr_RE  │ French                      │ Réunion                           
│ fr_RW  │ French                      │ Rwanda                            
│ fr_SC  │ French                      │ Seychelles                        
│ fr_SN  │ French                      │ Senegal                           
│ fr_SY  │ French                      │ Syria                             
│ fr_TD  │ French                      │ Chad                              
│ fr_TG  │ French                      │ Togo                              
│ fr_TN  │ French                      │ Tunisia                           
│ fr_VU  │ French                      │ Vanuatu                           
│ fr_WF  │ French                      │ Wallis and Futuna                 
│ fr_YT  │ French                      │ Mayotte