android / android/android-test

isDisplayingAtLeast does not check whether a parent obscures the view

Aperta
#463 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1.2k
Fork
342
Merge medio
11h 29m
PR unite (30g)
2

Descrizione

### Description

According to the [documentation](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.html#isdisplayingatleast) isDisplayingAtLeast:

> Returns a matcher which accepts a view so long as a given percentage of that view's area **is not obscured by any parent view** and is thus visible to the user.

That's not what happens. It actuality the matcher only checks whether a sufficient portion of the view area is within the boundaries of the screen. It's evident from examining the code of `IsDisplayingAtLeastMatcher#matchesSafely`.

### Steps to Reproduce

Make the parent view clip a portion of the child view, e.g.:

```jsx

```

only 74% of the child view will be visible to the user, the bottom 26% will be clipped by the parent. Both views will render within the boundaries of the screen.

### Expected Results

`isDisplayingAtLeast(75)` should fail.

### Actual Results

`isDisplayingAtLeast(75)` passes even though only 74% is displayed.

### AndroidX Test and Android OS Versions

Android 9, espresso-core 3.1.1

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Parti da IsDisplayingAtLeastMatcher#matchesSafely e riproduci il caso fornito di clipping parent/child. Traccia come viene calcolata l'area visualizzata, quindi verifica che isDisplayingAtLeast(75) fallisca quando il parent ritaglia il 26% del child, mentre un caso non oscurato continua a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
mobile-dev, testing
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.