调用android.os.CancellationSignal.cancel()后android.os.CancellationSignal.isCanceled()返回false

时间:2018-12-28 08:29:23

标签: android junit kotlin

为什么在我调用isCanceled()函数后cancel()返回false?在源代码中,我看到必须将mIsCanceled变量设置为true,然后调用cancel()函数。使用此测试重现该错误:

package some.package.com

import android.os.CancellationSignal
import junit.framework.TestCase.assertTrue
import org.junit.Test

class TestCancelationSignal {

    @Test
    fun SaveToFileEncryptData() {
        val cancelationSignal = CancellationSignal()
        cancelationSignal.cancel()
        assertTrue(cancelationSignal.isCanceled)
    }

}

0 个答案:

没有答案