fix(settings): About tab crash + update-row UI (#889)
- AppUpdateViewModel has no (Application) ctor; the default viewModel()
factory's AndroidViewModelFactory does getConstructor(Application)
-> NoSuchMethodException -> crash on opening About. Build it with an
explicit viewModel { } initializer + APPLICATION_KEY instead.
- Add instrumented regression test that renders SettingsAboutPage with
the real default factory (the exact path that crashed).
- UpdateRow: status text and action button no longer fight for one line;
Update now / Open settings / Retry get a full-width button of their
own below the row, Downloading gets a full-width progress bar.
- Strip the leading 'v' from GitHub release tags before formatting
(templates already prepend 'v' -> was rendering 'vv1.21.1').
Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
683a24becf
commit
ff8370bb8d
3 files changed
+136
-53
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package com.m57.hermescontrol.ui.settings
|
||||
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.MediumTest
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Regression net for the About-tab crash (issue: opening About threw
|
||||
* NoSuchMethodException AppUpdateViewModel.<init>(Application) — the default
|
||||
* AndroidViewModelFactory resolves ctors via reflection, which cannot see the
|
||||
* Kotlin default-arg synthetic constructor). The test deliberately does NOT
|
||||
* inject a view model: the default `viewModel { ... }` factory lambda must
|
||||
* build the real [AppUpdateViewModel] without crashing.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@MediumTest
|
||||
class SettingsAboutPageTest {
|
||||
@get:Rule
|
||||
val composeTestRule = createComposeRule()
|
||||
|
||||
@Test
|
||||
fun aboutPage_opensWithoutCrashing() {
|
||||
composeTestRule.setContent {
|
||||
SettingsAboutPage(onBack = {})
|
||||
}
|
||||
|
||||
composeTestRule.onNodeWithText("About").assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user