| package com.airbnb.lottie.baselineprofile |
| |
| import androidx.benchmark.macro.junit4.BaselineProfileRule |
| import androidx.test.ext.junit.runners.AndroidJUnit4 |
| import androidx.test.filters.LargeTest |
| import org.junit.Rule |
| import org.junit.Test |
| import org.junit.runner.RunWith |
| |
| /** |
| * You can run the generator with the Generate Baseline Profile gradle task. |
| * ``` |
| * ./gradlew :lottie(-compose):generateReleaseBaselineProfile -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile |
| * ``` |
| * |
| * After you run the generator, you can verify the improvements running the [StartupBenchmarks] benchmark. |
| **/ |
| @RunWith(AndroidJUnit4::class) |
| @LargeTest |
| class BaselineProfileGenerator { |
| |
| @get:Rule |
| val rule = BaselineProfileRule() |
| |
| @Test |
| fun generate() { |
| rule.collect("com.airbnb.lottie.benchmark.app") { |
| pressHome() |
| startActivityAndWait() |
| } |
| } |
| } |