Jelle Fresen | ef97831 | 2020-05-05 19:08:28 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package androidx.ui.test |
| 18 | |
| 19 | import android.os.Bundle |
| 20 | import android.os.Handler |
| 21 | import android.os.Looper |
| 22 | import androidx.activity.ComponentActivity |
| 23 | import androidx.test.filters.LargeTest |
| 24 | import androidx.ui.core.setContent |
Filip Pavlis | b3943e1 | 2020-07-22 14:39:42 +0100 | [diff] [blame] | 25 | import androidx.ui.test.android.createAndroidComposeRule |
Jelle Fresen | ef97831 | 2020-05-05 19:08:28 +0100 | [diff] [blame] | 26 | import androidx.ui.test.util.BoundaryNode |
| 27 | import org.junit.Rule |
| 28 | import org.junit.Test |
| 29 | |
| 30 | @LargeTest |
| 31 | class LateSetContentTest { |
| 32 | @get:Rule |
Filip Pavlis | b3943e1 | 2020-07-22 14:39:42 +0100 | [diff] [blame] | 33 | val composeTestRule = createAndroidComposeRule<Activity>() |
Jelle Fresen | ef97831 | 2020-05-05 19:08:28 +0100 | [diff] [blame] | 34 | |
| 35 | @Test |
| 36 | fun test() { |
Filip Pavlis | 659ea72 | 2020-07-13 14:14:32 +0100 | [diff] [blame] | 37 | onNodeWithTag("Node").assertExists() |
Jelle Fresen | ef97831 | 2020-05-05 19:08:28 +0100 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | class Activity : ComponentActivity() { |
| 41 | private val handler = Handler(Looper.getMainLooper()) |
| 42 | override fun onCreate(savedInstanceState: Bundle?) { |
| 43 | super.onCreate(savedInstanceState) |
| 44 | handler.postDelayed({ |
| 45 | setContent { BoundaryNode("Node") } |
| 46 | }, 500) |
| 47 | } |
| 48 | } |
| 49 | } |