diff --git a/app/src/androidTest/java/com/m57/hermescontrol/ui/cron/SchedulePickerTest.kt b/app/src/androidTest/java/com/m57/hermescontrol/ui/cron/SchedulePickerTest.kt index 0607e43b..c84cc420 100644 --- a/app/src/androidTest/java/com/m57/hermescontrol/ui/cron/SchedulePickerTest.kt +++ b/app/src/androidTest/java/com/m57/hermescontrol/ui/cron/SchedulePickerTest.kt @@ -13,6 +13,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.test.hasContentDescription +import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onAllNodesWithText import androidx.compose.ui.test.onNodeWithText @@ -22,12 +23,44 @@ import androidx.test.platform.app.InstrumentationRegistry import com.m57.hermescontrol.R import java.io.File import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue import org.junit.Rule import org.junit.Test class SchedulePickerTest { @get:Rule val compose = createComposeRule() + @Test + fun fullEditorHasReachableSaveAction() { + var saved = false + val context = InstrumentationRegistry.getInstrumentation().targetContext + compose.setContent { + MaterialTheme { + CronJobEditorDialog( + state = CronJobEditorState(isOpen = true, isNew = true, schedule = "59 23 * * *"), + onFieldChange = { _, _ -> }, + onToggleNoAgent = {}, + onToggleRunContinuity = {}, + onSetMonitorMode = {}, + onSelectBlueprint = {}, + onBlueprintFieldChange = { _, _ -> }, + onSave = { saved = true }, + onDismiss = {}, + onClearToast = {}, + ) + } + } + compose.waitForIdle() + android.os.SystemClock.sleep(500) + val bitmap = InstrumentationRegistry.getInstrumentation().uiAutomation.takeScreenshot() + File(context.getExternalFilesDir(null), "scheduler-editor-360.png").outputStream().use { + bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) + } + compose.onNodeWithText(context.getString(R.string.cron_edit_action_save)) + .assertIsDisplayed().performClick() + compose.runOnIdle { assertTrue(saved) } + } + @Test fun repeatDropdownAndClockPreserveSchedule() { var schedule by mutableStateOf("59 23 * * *") diff --git a/app/src/main/java/com/m57/hermescontrol/ui/cron/CronJobsScreen.kt b/app/src/main/java/com/m57/hermescontrol/ui/cron/CronJobsScreen.kt index cee8840d..e453859c 100644 --- a/app/src/main/java/com/m57/hermescontrol/ui/cron/CronJobsScreen.kt +++ b/app/src/main/java/com/m57/hermescontrol/ui/cron/CronJobsScreen.kt @@ -57,6 +57,7 @@ import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties @@ -430,6 +431,8 @@ fun CronJobEditorDialog( } else { stringResource(R.string.cron_edit_title) }, + maxLines = 1, + overflow = TextOverflow.Ellipsis, ) }, navigationIcon = @@ -444,13 +447,13 @@ fun CronJobEditorDialog( ), actions = { if (!state.isLoading) { - IconButton( + TextButton( onClick = onSave, enabled = !state.isSaving, ) { if (state.isSaving) { CircularProgressIndicator( - modifier = Modifier.fillMaxSize(0.6f), + modifier = Modifier.size(24.dp), strokeWidth = 2.dp, color = MaterialTheme.colorScheme.onSurface, ) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 075d4bf3..a6b68ea7 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1253,8 +1253,8 @@ Çalıştır Düzenle Zamanlanmış görev ekle - Zamanlanmış görevi düzenle - Yeni zamanlanmış görev + Görevi düzenle + Yeni görev Başlangıç şablonu Boş görev Ad