File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,21 @@ describe('DevOverlay', () => {
188188 ) ;
189189 } ) ;
190190
191+ it ( '精度情報の小数点を切り捨てて表示する' , ( ) => {
192+ setupAtomValues ( {
193+ location : {
194+ coords : { speed : 10 , accuracy : 15.9 } ,
195+ } ,
196+ accuracyHistory : [ 10 , 15 , 20 ] ,
197+ backgroundLocationTracking : false ,
198+ } ) ;
199+
200+ const { getByTestId } = render ( < DevOverlay /> ) ;
201+ expect ( getByTestId ( 'dev-overlay-accuracy-value' ) ) . toHaveTextContent (
202+ '15m'
203+ ) ;
204+ } ) ;
205+
191206 it ( '速度情報をkm/hで表示する' , ( ) => {
192207 const { getByText, getByTestId } = render ( < DevOverlay /> ) ;
193208 expect ( getByText ( 'CURRENT SPEED' ) ) . toBeTruthy ( ) ;
Original file line number Diff line number Diff line change @@ -284,6 +284,8 @@ const DevOverlay: React.FC = () => {
284284 ) ;
285285
286286 const coordsSpeed = ( ( speed ?? 0 ) < 0 ? 0 : speed ) ?? 0 ;
287+ const accuracyMeters =
288+ accuracy != null ? Math . max ( 0 , Math . floor ( accuracy ) ) : null ;
287289
288290 const speedKMH = useMemo (
289291 ( ) =>
@@ -577,7 +579,7 @@ const DevOverlay: React.FC = () => {
577579 < View style = { styles . landscapeSubGrid } >
578580 < MetricCard
579581 label = "LOCATION ACCURACY"
580- value = { accuracy != null ? `${ accuracy } ` : '--' }
582+ value = { accuracyMeters != null ? `${ accuracyMeters } ` : '--' }
581583 suffix = "m"
582584 style = { [ { width : leftMetricWidth } , metricCardStyle ] }
583585 valueTestID = "dev-overlay-accuracy-value"
@@ -631,7 +633,7 @@ const DevOverlay: React.FC = () => {
631633 < View style = { [ styles . metricsGrid , { gap : metricsGap } ] } >
632634 < MetricCard
633635 label = "LOCATION ACCURACY"
634- value = { accuracy != null ? `${ accuracy } ` : '--' }
636+ value = { accuracyMeters != null ? `${ accuracyMeters } ` : '--' }
635637 suffix = "m"
636638 style = { [ { width : metricWidth } , metricCardStyle ] }
637639 valueTestID = "dev-overlay-accuracy-value"
You can’t perform that action at this time.
0 commit comments