Skip to content

Commit

Permalink
ANDROAPP-5450 Implement testing workflow (#38)
Browse files Browse the repository at this point in the history
* [ANDROAPP-5450] Update ktlint gradle to 11.5.1 and ktlint to 0.50.0

* [ANDROAPP-5450] Update compose multiplatform to 1.5.0

* [ANDROAPP-5450] Add Compose Multiplatform desktopTest

* [ANDROAPP-5450] add trailing comma to Button.kt

* [ANDROAPP-5450] Remove test tag from Legend
  • Loading branch information
andresmr authored Aug 30, 2023
1 parent 58f161a commit 7dc10b4
Show file tree
Hide file tree
Showing 41 changed files with 279 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

# Run Tests Build
- name: Run gradle tests
run: ./gradlew test
run: ./gradlew desktopTest

# Run Build Project
- name: Build gradle project
Expand Down
6 changes: 0 additions & 6 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id("org.jetbrains.compose")
id("com.android.application")
kotlin("multiplatform")
id("org.jlleitschuh.gradle.ktlint")
}

kotlin {
Expand Down Expand Up @@ -38,8 +37,3 @@ android {
jvmToolchain(17)
}
}

ktlint {
verbose.set(true)
outputToConsole.set(true)
}
11 changes: 10 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ plugins {
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
id("org.jlleitschuh.gradle.ktlint") version "11.5.0"
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
}

allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
ktlint {
version.set("0.50.0")
verbose.set(true)
outputToConsole.set(true)
}
}
6 changes: 0 additions & 6 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
id("com.android.library")
id("org.jlleitschuh.gradle.ktlint")
}

kotlin {
Expand Down Expand Up @@ -64,8 +63,3 @@ android {
jvmToolchain(17)
}
}

ktlint {
verbose.set(true)
outputToConsole.set(true)
}
12 changes: 5 additions & 7 deletions common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.hisp.dhis.common.screens.InputScreen
import org.hisp.dhis.common.screens.InputTextScreen
import org.hisp.dhis.common.screens.LegendDescriptionScreen
import org.hisp.dhis.common.screens.LegendScreen
import org.hisp.dhis.common.screens.NotImplementedScreen
import org.hisp.dhis.common.screens.ProgressScreen
import org.hisp.dhis.common.screens.SupportingTextScreen
import org.hisp.dhis.common.screens.radio.RadioButtonScreen
Expand All @@ -52,7 +51,7 @@ fun Main() {
Column(modifier = Modifier.padding(Spacing.Spacing16)) {
Box(
modifier = Modifier
.fillMaxWidth()
.fillMaxWidth(),

) {
TextField(
Expand All @@ -69,21 +68,21 @@ fun Main() {
Icon(
icon,
"contentDescription",
Modifier.clickable { expanded = !expanded }
Modifier.clickable { expanded = !expanded },
)
}
},
)
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false }
onDismissRequest = { expanded = false },
) {
Components.values().forEach {
DropdownMenuItem(
text = { Text(it.label) },
onClick = {
currentScreen.value = it
expanded = false
}
},
)
}
}
Expand All @@ -101,7 +100,6 @@ fun Main() {
Components.SUPPORTING_TEXT -> SupportingTextScreen()
Components.INPUT_TEXT -> InputTextScreen()
Components.LEGEND_DESCRIPTION -> LegendDescriptionScreen()
else -> NotImplementedScreen()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ fun CheckboxScreen() {
ColumnComponentContainer(
content = {
Text(
text = "Text Check Box"
text = "Text Check Box",
)
TextCheckboxPreview(state1, true, option1)
TextCheckboxPreview(state2, true, option2)
TextCheckboxPreview(state3, false, option3)
TextCheckboxPreview(state4, enabled = false, text = option4)
Text(
text = "Check Box"
text = "Check Box",
)
Row {
CheckboxPreview(mutableStateOf(true), enabled = true)
Expand All @@ -40,6 +40,6 @@ fun CheckboxScreen() {
CheckboxPreview(mutableStateOf(false), enabled = true)
CheckboxPreview(mutableStateOf(false), enabled = false)
}
}
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ enum class Components(val label: String) {
LEGEND("Legend"),
INPUT("Input"),
LEGEND_DESCRIPTION("Legend description"),
INPUT_TEXT("Input Text")
INPUT_TEXT("Input Text"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fun IconButtonScreen() {
content = {
SquareIconButtonPreview()
SquareIconButtonPreview(false)
}
},
)

// IconButton
Expand All @@ -31,42 +31,42 @@ fun IconButtonScreen() {
content = {
IconButtonPreview()
IconButtonPreview(false)
}
},
)

RowComponentContainer(
title = "Filled",
content = {
Row(
horizontalArrangement = Arrangement.spacedBy(10.dp)
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
IconButtonPreview(true, IconButtonStyle.FILLED)
IconButtonPreview(false, IconButtonStyle.FILLED)
}
}
},
)
RowComponentContainer(
title = "Tonal",
content = {
Row(
horizontalArrangement = Arrangement.spacedBy(10.dp)
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
IconButtonPreview(true, IconButtonStyle.TONAL)
IconButtonPreview(false, IconButtonStyle.TONAL)
}
}
},
)
RowComponentContainer(
title = "Outlined",
content = {
Row(
horizontalArrangement = Arrangement.spacedBy(10.dp)
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
IconButtonPreview(true, IconButtonStyle.OUTLINED)
IconButtonPreview(false, IconButtonStyle.OUTLINED)
}
}
},
)
}
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ fun InputScreen() {
BasicInput(inputText = "Input") {}
Text("Disabled")
BasicInput(enabled = false, inputText = "Input") {}
}
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ fun InputTextScreen() {
supportingText = listOf(
SupportingTextData("Supporting text", SupportingTextState.DEFAULT),
SupportingTextData("Supporting text", SupportingTextState.WARNING),
SupportingTextData("Supporting text", SupportingTextState.ERROR)
SupportingTextData("Supporting text", SupportingTextState.ERROR),

),
legendText = "Legend",
state = InputShellState.ERROR
state = InputShellState.ERROR,
)

SubTitle("Disabled Input text ", textColor = TextColor.OnSurfaceVariant)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fun LegendDescriptionScreen() {
LegendDescriptionData(
SurfaceColor.CustomGreen,
"Legend",
IntRange(0, 30)
IntRange(0, 30),
),
LegendDescriptionData(
SurfaceColor.CustomGreen,
Expand All @@ -26,9 +26,9 @@ fun LegendDescriptionScreen() {
"aliquam. Lorem ipsum dolor sit amet, " +
"consectetur adipiscing elit. Maecenas dolor lacus, " +
"aliquam.Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
IntRange(0, 30)
)
)
IntRange(0, 30),
),
),
)

Text("Legend Block")
Expand All @@ -37,7 +37,7 @@ fun LegendDescriptionScreen() {
LegendDescriptionData(
SurfaceColor.CustomGreen,
"Low",
IntRange(0, 5)
IntRange(0, 5),
),
LegendDescriptionData(SurfaceColor.CustomYellow, "Medium", IntRange(5, 10)),
LegendDescriptionData(TextColor.OnWarning, "High", IntRange(10, 20)),
Expand All @@ -47,9 +47,9 @@ fun LegendDescriptionScreen() {
SurfaceColor.CustomGray,
"Lorem ipsum dolor sit amet, " +
"consectetur adipiscing elit. Fusce convallis",
IntRange(120, 1000)
)
)
IntRange(120, 1000),
),
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun LegendScreen() {
Column(
verticalArrangement = Arrangement.spacedBy(Spacing.Spacing16),
modifier = Modifier.padding(Spacing.Spacing10)
.verticalScroll(rememberScrollState())
.verticalScroll(rememberScrollState()),
) {
Text("Green Legend")
Legend(SurfaceColor.CustomGreen, "Legend") {}
Expand All @@ -32,7 +32,7 @@ fun LegendScreen() {
"Lorem ipsum dolor sit amet," +
" consectetur adipiscing elit. Maecenas dolor lacus," +
" aliquam. Lorem ipsum dolor sit amet," +
" consectetur adipiscing elit. Maecenas dolor lacus,"
" consectetur adipiscing elit. Maecenas dolor lacus,",
) {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,79 +14,79 @@ internal fun ProgressScreen() {
ProgressIndicator(
progress = 0.25f,
type = ProgressIndicatorType.LINEAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 0.50f,
type = ProgressIndicatorType.LINEAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 0.75f,
type = ProgressIndicatorType.LINEAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 0.45f,
type = ProgressIndicatorType.LINEAR,
hasError = false
hasError = false,
)
ProgressIndicator(
type = ProgressIndicatorType.LINEAR,
hasError = false
hasError = false,
)
Text("Linear indicator - Error")
ProgressIndicator(
progress = 0.70f,
type = ProgressIndicatorType.LINEAR,
hasError = true
hasError = true,
)
ProgressIndicator(
type = ProgressIndicatorType.LINEAR,
hasError = true
hasError = true,
)
Text("Circular indicator")
RowComponentContainer {
ProgressIndicator(
progress = 0.25f,
type = ProgressIndicatorType.CIRCULAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 0.50f,
type = ProgressIndicatorType.CIRCULAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 0.75f,
type = ProgressIndicatorType.CIRCULAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 1f,
type = ProgressIndicatorType.CIRCULAR,
hasError = false
hasError = false,
)
ProgressIndicator(
progress = 0.6f,
type = ProgressIndicatorType.CIRCULAR,
hasError = false
hasError = false,
)
}
ProgressIndicator(
type = ProgressIndicatorType.CIRCULAR,
hasError = false
hasError = false,
)
Text("Circular indicator - Error")
RowComponentContainer {
ProgressIndicator(
progress = 0.70f,
type = ProgressIndicatorType.CIRCULAR,
hasError = true
hasError = true,
)
ProgressIndicator(
type = ProgressIndicatorType.CIRCULAR,
hasError = true
hasError = true,
)
}
}
Expand Down
Loading

0 comments on commit 7dc10b4

Please sign in to comment.