Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compose/ui/ui-test/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,11 @@ package androidx.compose.ui.test {
method @BytecodeOnly public static void advanceTimeUntil$default(androidx.compose.ui.test.MainTestClock!, long, kotlin.jvm.functions.Function0!, int, Object!);
method @InaccessibleFromKotlin public boolean getAutoAdvance();
method @InaccessibleFromKotlin public long getCurrentTime();
method @InaccessibleFromKotlin public default kotlinx.coroutines.test.TestCoroutineScheduler getScheduler();
method @InaccessibleFromKotlin public void setAutoAdvance(boolean);
property public abstract boolean autoAdvance;
property public abstract long currentTime;
property public default kotlinx.coroutines.test.TestCoroutineScheduler scheduler;
}

@kotlin.jvm.JvmInline public final value class MouseButton {
Expand Down
2 changes: 2 additions & 0 deletions compose/ui/ui-test/api/restricted_current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,11 @@ package androidx.compose.ui.test {
method @BytecodeOnly public static void advanceTimeUntil$default(androidx.compose.ui.test.MainTestClock!, long, kotlin.jvm.functions.Function0!, int, Object!);
method @InaccessibleFromKotlin public boolean getAutoAdvance();
method @InaccessibleFromKotlin public long getCurrentTime();
method @InaccessibleFromKotlin public default kotlinx.coroutines.test.TestCoroutineScheduler getScheduler();
method @InaccessibleFromKotlin public void setAutoAdvance(boolean);
property public abstract boolean autoAdvance;
property public abstract long currentTime;
property public default kotlinx.coroutines.test.TestCoroutineScheduler scheduler;
}

@kotlin.jvm.JvmInline public final value class MouseButton {
Expand Down
2 changes: 2 additions & 0 deletions compose/ui/ui-test/bcv/native/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ abstract interface androidx.compose.ui.test/KeyInjectionScope : androidx.compose
abstract interface androidx.compose.ui.test/MainTestClock { // androidx.compose.ui.test/MainTestClock|null[0]
abstract val currentTime // androidx.compose.ui.test/MainTestClock.currentTime|{}currentTime[0]
abstract fun <get-currentTime>(): kotlin/Long // androidx.compose.ui.test/MainTestClock.currentTime.<get-currentTime>|<get-currentTime>(){}[0]
open val scheduler // androidx.compose.ui.test/MainTestClock.scheduler|{}scheduler[0]
open fun <get-scheduler>(): kotlinx.coroutines.test/TestCoroutineScheduler // androidx.compose.ui.test/MainTestClock.scheduler.<get-scheduler>|<get-scheduler>(){}[0]

abstract var autoAdvance // androidx.compose.ui.test/MainTestClock.autoAdvance|{}autoAdvance[0]
abstract fun <get-autoAdvance>(): kotlin/Boolean // androidx.compose.ui.test/MainTestClock.autoAdvance.<get-autoAdvance>|<get-autoAdvance>(){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MonotonicFrameClock
import androidx.compose.runtime.Recomposer
import androidx.compose.ui.test.internal.JvmDefaultWithCompatibility
import kotlinx.coroutines.test.TestCoroutineScheduler

/**
* The clock that drives [frames][MonotonicFrameClock.withFrameNanos], [recompositions][Recomposer]
Expand Down Expand Up @@ -81,6 +82,22 @@ interface MainTestClock {
/** The current time of this clock in milliseconds. */
val currentTime: Long

/**
* The [TestCoroutineScheduler] on which this clock is built. It drives the execution of
* coroutines within the composition and is used to dispatch coroutines inside the [Recomposer]
* and for [LaunchedEffect]s.
*
* If the test was started with a custom `effectContext` containing a
* [kotlinx.coroutines.test.TestDispatcher], this returns the scheduler from that dispatcher.
* Otherwise, an internally managed [TestCoroutineScheduler] is created.
*/
val scheduler: TestCoroutineScheduler
get() =
throw NotImplementedError(
"Implement by returning the TestCoroutineScheduler on which the Recomposer is " +
"scheduled"
)

/**
* Whether the clock should be advanced by the testing framework while awaiting idleness in
* order to process any pending work that is driven by this clock. This ensures that when the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal abstract class AbstractMainTestClock(
* The underlying scheduler which this clock controls. Only advance the time or run current
* tasks from the scheduler on the UI thread, as any task could be a UI thread only task.
*/
private val scheduler: TestCoroutineScheduler,
override val scheduler: TestCoroutineScheduler,
private val frameDelayMillis: Long,
private val isStandardTestDispatcherSupportEnabled: Boolean,
private val runOnUiThread: (action: () -> Unit) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;

import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.KeyEvent;
Expand All @@ -50,6 +48,7 @@
import androidx.recyclerview.widget.RecyclerView;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;

Expand Down Expand Up @@ -123,9 +122,9 @@ public boolean canProceed() {
});
}

@SdkSuppress(maxSdkVersion = 35) // b/460508283
@Test
public void testTouchMode() throws Throwable {
assumeFalse("Test fails on cuttlefish b/460508283", Build.MODEL.contains("Cuttlefish"));
Intent intent = new Intent();
intent.putExtra(BrowseFragmentTestActivity.EXTRA_ADD_TO_BACKSTACK , true);
intent.putExtra(BrowseFragmentTestActivity.EXTRA_LOAD_DATA_DELAY , 0L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ import androidx.pdf.PdfWriteHandle
import androidx.pdf.annotation.AnnotationsView
import androidx.pdf.annotation.AnnotationsView.PageAnnotationsData
import androidx.pdf.annotation.KeyedPdfAnnotation
import androidx.pdf.annotation.OnAnnotationSelectedListener
import androidx.pdf.annotation.LocatedAnnotations
import androidx.pdf.annotation.OnAnnotationLocatedListener
import androidx.pdf.annotation.highlights.InProgressTextHighlightsListener
import androidx.pdf.annotation.highlights.models.InProgressHighlightId
import androidx.pdf.annotation.models.AnnotationsDisplayState
Expand Down Expand Up @@ -257,11 +258,12 @@ public open class EditablePdfViewerFragment : PdfViewerFragment {
}
}

private val onAnnotationSelectedListener =
object : OnAnnotationSelectedListener {
override fun onAnnotationSelected(keyedPdfAnnotation: KeyedPdfAnnotation) {
private val onAnnotationLocatedListener =
object : OnAnnotationLocatedListener {
override fun onAnnotationsLocated(locatedAnnotations: LocatedAnnotations) {
if (documentViewModel.drawingMode.value == AnnotationDrawingMode.EraserMode) {
documentViewModel.removeAnnotation(keyedPdfAnnotation.key)
val topAnnotation = locatedAnnotations.annotations.first()
documentViewModel.removeAnnotation(topAnnotation.key)
}
}
}
Expand Down Expand Up @@ -350,7 +352,7 @@ public open class EditablePdfViewerFragment : PdfViewerFragment {

private fun setupAnnotationViewListeners() {
annotationView.pageInfoProvider = pageInfoProvider
annotationView.addOnAnnotationSelectedListener(onAnnotationSelectedListener)
annotationView.addOnAnnotationLocatedListener(onAnnotationLocatedListener)
annotationView.addInProgressTextHighlightsListener(inProgressTextHighlightsListener)
}

Expand Down

This file was deleted.

Loading
Loading