gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 18:36:14 24 4
gpt4 key购买 nike

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

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

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

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

关于android - 测试实验室的仪器测试失败,错误的货币符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54216118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com