为什么在我调用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)
}
}