당직근무 0.10.0 소스와 위젯 꾸미기 및 제작 매뉴얼 공개
위젯별 투명도와 밝은·어두운 색상 및 글자 크기와 표시 항목을 추가했다. 모든 위젯에 함께 적용하는 기본값과 개별 설정을 구분하고 크기에 따라 배치를 바꾼다. 포럼에 APK와 전체 소스 및 사용법과 제작 매뉴얼을 함께 배포한다. 앱 단위 검사 34개와 서버 검사 63개 및 웹 날짜·업데이트 검사 통과. 공개 소스에서 APK 빌드와 정적 검사 오류 0개 확인. 경고는 69개다. Android 16 가상 기기에서 기존 앱 위에 설치하고 투명 위젯과 큰 글자 및 RemoteViews 검사를 확인했다. 실제 휴대폰과 다른 홈 화면 앱의 절전·크기 동작은 별도 확인이 필요하다. 회원 DB와 인증 정보 및 배포 서명 키와 내부 운영 기록은 공개 자료에 포함하지 않았다.
This commit is contained in:
commit
8112721fa8
96 files changed
+7495
No files matched your search
@@ -0,0 +1,114 @@
|
||||
package kr.co.itosm.dutycalendar
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import java.time.LocalDate
|
||||
import java.time.YearMonth
|
||||
|
||||
/**
|
||||
* 반복 근무 계산에서 틀리기 쉬운 기준일 이전과 연말 및 윤년 경계를 확인한다.
|
||||
* 안드로이드 화면 없이 순수 날짜 계산을 검사해 기기 시간이나 네트워크 상태의 영향을 받지 않게 한다.
|
||||
* 화면 배치와 위젯 추가 및 공휴일 통신은 가상 기기에서 별도로 확인한다.
|
||||
*/
|
||||
class ScheduleTest {
|
||||
private val anchor = LocalDate.of(2026, 11, 20)
|
||||
@Test fun twoDayCycle() {
|
||||
val schedule = Schedule(anchor, Schedule.preset(2))
|
||||
assertEquals(listOf(Shift.DUTY, Shift.OFF, Shift.DUTY, Shift.OFF), (0L..3L).map { schedule.shiftOn(anchor.plusDays(it)) })
|
||||
}
|
||||
@Test fun threeDayCycle() {
|
||||
val schedule = Schedule(anchor, Schedule.preset(3))
|
||||
assertEquals(Shift.REGULAR, schedule.shiftOn(anchor.plusDays(2)))
|
||||
assertEquals(Shift.DUTY, schedule.shiftOn(anchor.plusDays(3)))
|
||||
}
|
||||
@Test fun datesBeforeAnchorUseSameCycle() {
|
||||
val schedule = Schedule(anchor, Schedule.preset(3))
|
||||
assertEquals(Shift.REGULAR, schedule.shiftOn(anchor.minusDays(1)))
|
||||
assertEquals(Shift.OFF, schedule.shiftOn(anchor.minusDays(2)))
|
||||
assertEquals(Shift.DUTY, schedule.shiftOn(anchor.minusDays(3)))
|
||||
}
|
||||
@Test fun customPatternIsPreservedAcrossYearBoundary() {
|
||||
val schedule = Schedule(LocalDate.of(2026, 12, 30), listOf(Shift.OFF, Shift.REGULAR, Shift.DUTY, Shift.OFF))
|
||||
assertEquals(Shift.DUTY, schedule.shiftOn(LocalDate.of(2027, 1, 1)))
|
||||
}
|
||||
@Test fun leapDayAndMarchAreConsecutive() {
|
||||
val schedule = Schedule(LocalDate.of(2028, 2, 28), Schedule.preset(3))
|
||||
assertEquals(Shift.OFF, schedule.shiftOn(LocalDate.of(2028, 2, 29)))
|
||||
assertEquals(Shift.REGULAR, schedule.shiftOn(LocalDate.of(2028, 3, 1)))
|
||||
}
|
||||
@Test fun monthGridIncludesAllDaysAndStartsSunday() {
|
||||
val days = calendarDays(YearMonth.of(2026, 8))
|
||||
assertEquals(42, days.size)
|
||||
assertEquals(java.time.DayOfWeek.SUNDAY, days.first().dayOfWeek)
|
||||
assertTrue(days.contains(LocalDate.of(2026, 8, 31)))
|
||||
}
|
||||
@Test(expected = IllegalArgumentException::class) fun emptyCycleRejected() { Schedule(anchor, emptyList()) }
|
||||
@Test fun longestCycleWorks() {
|
||||
val schedule = Schedule(anchor, Schedule.preset(366))
|
||||
assertEquals(Shift.REGULAR, schedule.shiftOn(anchor.plusDays(365)))
|
||||
assertEquals(Shift.DUTY, schedule.shiftOn(anchor.plusDays(366)))
|
||||
}
|
||||
@Test fun dutyNumberKeepsDutyOffAndFillsRemainingDays() {
|
||||
val schedule = Schedule(anchor, Schedule.preset(5))
|
||||
assertEquals(listOf(Shift.DUTY, Shift.OFF, Shift.REGULAR, Shift.REGULAR, Shift.REGULAR, Shift.DUTY), (0L..5).map { schedule.shiftOn(anchor.plusDays(it)) })
|
||||
}
|
||||
@Test fun nightOffAndRestRemainDistinctAcrossMonthBoundary() {
|
||||
val schedule = Schedule(LocalDate.of(2026, 11, 29), listOf(Shift.DAY, Shift.NIGHT, Shift.OFF, Shift.REST))
|
||||
assertEquals(Shift.NIGHT, schedule.shiftOn(LocalDate.of(2026, 11, 30)))
|
||||
assertEquals(Shift.OFF, schedule.shiftOn(LocalDate.of(2026, 12, 1)))
|
||||
assertEquals(Shift.REST, schedule.shiftOn(LocalDate.of(2026, 12, 2)))
|
||||
assertEquals(Shift.DAY, schedule.shiftOn(LocalDate.of(2026, 12, 3)))
|
||||
assertFalse(Shift.REST.working)
|
||||
assertTrue(Shift.EVENING.working)
|
||||
}
|
||||
@Test(expected = IllegalArgumentException::class) fun oversizedCycleRejected() { Schedule(anchor, List(367) { Shift.DAY }) }
|
||||
@Test fun fiveDaySaturdayKeepsDutyAndRestsOtherShifts() {
|
||||
val saturday = LocalDate.of(2026, 11, 21)
|
||||
Shift.entries.forEach { shift ->
|
||||
assertEquals(if (shift == Shift.DUTY) Shift.DUTY else Shift.REST,
|
||||
Schedule(saturday, listOf(shift), 5).shiftOn(saturday))
|
||||
}
|
||||
}
|
||||
@Test fun saturdayRestDoesNotMoveFollowingRotation() {
|
||||
val schedule = Schedule(anchor, listOf(Shift.DUTY, Shift.REGULAR, Shift.NIGHT), 5)
|
||||
assertEquals(Shift.REST, schedule.shiftOn(anchor.plusDays(1)))
|
||||
assertEquals(Shift.NIGHT, schedule.shiftOn(anchor.plusDays(2)))
|
||||
assertEquals(Shift.DUTY, schedule.shiftOn(anchor.plusDays(3)))
|
||||
}
|
||||
@Test fun sixDayAndLegacySaturdayKeepOriginalDuty() {
|
||||
val saturday = LocalDate.of(2026, 11, 21)
|
||||
Shift.entries.forEach { shift ->
|
||||
assertEquals(shift, Schedule(saturday, listOf(shift)).shiftOn(saturday))
|
||||
assertEquals(shift, Schedule(saturday, listOf(shift), 6).shiftOn(saturday))
|
||||
}
|
||||
}
|
||||
@Test fun saturdayColorsFollowWorkWeekAndHolidayWins() {
|
||||
val saturday = LocalDate.of(2026, 11, 21)
|
||||
val five = Schedule(anchor, Schedule.preset(3), 5)
|
||||
val six = five.copy(workWeek = 6)
|
||||
assertEquals(0xFFBD5163.toInt(), five.dateColor(saturday))
|
||||
assertEquals(0xFF365FAD.toInt(), six.dateColor(saturday))
|
||||
assertEquals(0xFFBD5163.toInt(), six.dateColor(saturday, holiday = true))
|
||||
}
|
||||
@Test(expected = IllegalArgumentException::class) fun invalidWorkWeekRejected() { Schedule(anchor, Schedule.preset(3), 7) }
|
||||
@Test fun weekdayDutyChangesOnlyDateColor() {
|
||||
val duty = Schedule(anchor, listOf(Shift.DUTY), 5, true)
|
||||
listOf(LocalDate.of(2026, 11, 21), LocalDate.of(2026, 11, 22), LocalDate.of(2026, 12, 25)).forEach {
|
||||
assertEquals(0xFF1D2939.toInt(), duty.dateColor(it, true))
|
||||
assertEquals(Shift.DUTY, duty.shiftOn(it))
|
||||
assertEquals(0xFFBD5163.toInt(), duty.copy(dutyAsWeekday = false).dateColor(it, true))
|
||||
}
|
||||
val sunday = LocalDate.of(2026, 11, 22)
|
||||
assertEquals(0xFFBD5163.toInt(), duty.copy(pattern = listOf(Shift.OFF)).dateColor(sunday))
|
||||
}
|
||||
@Test fun offColorOptionDoesNotChangeRotationOrOtherShifts() {
|
||||
val monday = LocalDate.of(2026, 11, 23)
|
||||
val off = Schedule(monday, listOf(Shift.OFF), offAsHoliday = true)
|
||||
assertEquals(0xFFBD5163.toInt(), off.dateColor(monday))
|
||||
assertEquals(0xFFBD5163.toInt(), off.shiftColor(monday))
|
||||
assertEquals(Shift.OFF, off.shiftOn(monday))
|
||||
assertEquals(Shift.OFF.color, off.copy(offAsHoliday = false).shiftColor(monday))
|
||||
assertEquals(Shift.REGULAR.color, off.copy(pattern = listOf(Shift.REGULAR)).shiftColor(monday))
|
||||
assertEquals(0xFF1D2939.toInt(), off.copy(pattern = listOf(Shift.DUTY), dutyAsWeekday = true).dateColor(monday, true))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user