Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

71
Vistas
Why are RectF objects empty in UnitTests

Project:
I'm developing an Android application that matches MotionEvents to Rectangles which I defined using the RectF class.

Issue:
In my UnitTests these RectF objects are empty. The debugger describes them as "null" and left,top,right,bottom are 0.0

My guess:
I guess AndroidStudio replaces the RectF with some empty mock (as it apparently does with other code as well). I can't verify it in another IDE currently.

UnitTest code:

import android.graphics.RectF
import junit.framework.TestCase
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.core.Is.`is`
import org.junit.Test

class RectTest: TestCase() {
    @Test
    fun test() {
        val rectF = RectF( -10.0F, -30F, 10F, 50F )
        assertThat( rectF.width(), `is`( 20F ) )
    }
}

Note that the test class is in src/test not in src/androidTest.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda