일반근무 숨기기, 달력 연동 안내, 게시판, 관리자 세부 설정 (웹 2026-11-25.2)

- 달력 표시에 일반근무 글자 숨기기(hideRegular). 앱·웹 달력 칸과 위젯 및 근무표 그림에서만 빼고 오늘 카드·날짜 상세·기본 달력 반영·구독은 그대로
- 달력 연동 안내 페이지(/calendar/guide): 구독 주소 · 안드로이드 앱 기본 달력 반영 · 구글 · 삼성 · 아이폰 · 아웃룩 · 파일 · 문제 해결. 글은 관리자에서 고침(guide_text.py 기본값)
- 게시판(/calendar/board, board.py): 게시판 종류와 읽기·쓰기·댓글 권한을 관리자에서 만들고 고침, 글·댓글 쓰기·고치기·지우기, 운영진 숨김·고정·되살리기, 하루 한도
- 관리자: 설정 칸에 화면 구분(page)과 숫자·색·긴 글 종류. 색·메뉴·탭 제목·처음 기본값(웹)·게시판 한도
- 홈페이지 위쪽 메뉴 줄, 달력 연동·공유 창과 앱 메뉴에서 안내 페이지로 가는 링크
- 검사: 서버 103개(게시판 9개 새로), 앱 단위 54개, 위젯 기기 검사에 숨기기 확인. 로고 가져오기 시험의 같은 초 기록 순서 흔들림 고침
This commit is contained in:
블리어 committed 2026-11-25 00:27:26 +00:00
1 parent b28f1f6096
commit 9c6a1841e3
39 files changed
+1628 -79

No files matched your search

@@ -23,6 +23,7 @@ object WidgetAppearanceCheck {
val schedulePrefs=app.getSharedPreferences("schedule",0)
val originalWeekStart=schedulePrefs.all["weekStart"]
val originalRegularName=schedulePrefs.all["regularName"]
val originalHideRegular=schedulePrefs.all["hideRegular"]
var success=false
var message=""
try {
@@ -78,9 +79,9 @@ object WidgetAppearanceCheck {
check(sunHeader.currentTextColor==WidgetStyle().color(0xFFBD5163.toInt()))
}
// 일반근무 이름을 바꾸면 위젯 칸에도 같은 이름이 보이고 다른 근무와 날짜 계산은 그대로다.
if(ScheduleStore.isConfigured(app)) for(name in listOf("사무실","")) {
if(ScheduleStore.isConfigured(app)) for((name,hide) in listOf("사무실" to false,"사무실" to true,"" to false)) {
val current=ScheduleStore.load(app)
ScheduleStore.saveDisplay(app,current.dutyAsWeekday,current.showLunar,current.offAsHoliday,current.weekStart,fromSync=true,regularName=name)
ScheduleStore.saveDisplay(app,current.dutyAsWeekday,current.showLunar,current.offAsHoliday,current.weekStart,fromSync=true,regularName=name,hideRegular=hide)
val schedule=ScheduleStore.load(app)
val month=render(99001,500)
val dates=calendarDays(java.time.YearMonth.now(),schedule.weekStart)
@@ -88,6 +89,11 @@ object WidgetAppearanceCheck {
DutyWidget.DAY_IDS.forEachIndexed { index,cellId ->
val shift=schedule.shiftOn(dates[index])
val lines=month.findViewById<TextView>(cellId).text.toString().lines()
if(hide&&shift==Shift.REGULAR) {
// 숨기기를 켜면 근무 글자 없이 빈 줄만 남아 날짜 칸 높이가 그대로다.
check(expected !in lines && " " in lines){"위젯 일반근무 숨기기: $lines"}
continue
}
check(shift.shortTitle in lines){"위젯 날짜 $index 근무 이름: $lines (기대 ${shift.shortTitle})"}
if(shift==Shift.REGULAR)check(expected in lines){"위젯 일반근무 이름: $lines (기대 $expected)"}
}
@@ -171,12 +177,13 @@ object WidgetAppearanceCheck {
}
failure?.let{throw it}
success=true
message="일반근무 이름 바꾸기와 기본 이름 복귀 확인. 네 종류의 기본 배치와 한 달 전체 선택 확인. 월·일 시작과 80·100·120% 및 최소·확장 크기에서 42칸과 모든 날짜 및 마지막 주의 글자 높이와 생략 없음 확인. 월 이동과 연말 넘김 및 오늘 복귀와 개별 저장 및 구버전 설정 보존 확인."
message="일반근무 이름 바꾸기와 숨기기 및 기본 이름 복귀 확인. 네 종류의 기본 배치와 한 달 전체 선택 확인. 월·일 시작과 80·100·120% 및 최소·확장 크기에서 42칸과 모든 날짜 및 마지막 주의 글자 높이와 생략 없음 확인. 월 이동과 연말 넘김 및 오늘 복귀와 개별 저장 및 구버전 설정 보존 확인."
} catch(error:Throwable) {message=error.stackTraceToString()}
finally {
val scheduleRestore=schedulePrefs.edit()
if(originalWeekStart is Int)scheduleRestore.putInt("weekStart",originalWeekStart) else scheduleRestore.remove("weekStart")
if(originalRegularName is String)scheduleRestore.putString("regularName",originalRegularName) else scheduleRestore.remove("regularName")
if(originalHideRegular is Boolean)scheduleRestore.putBoolean("hideRegular",originalHideRegular) else scheduleRestore.remove("hideRegular")
check(scheduleRestore.commit());ScheduleStore.load(app)
val editor=prefs.edit().clear()
original.forEach{(key,value)->editor.putString(key,value as String)}
@@ -84,7 +84,7 @@ object CompactWidgetViews {
val anniversaries=snapshot.anniversariesOn(date)
val plus=if(style.eventMark&&(events.isNotEmpty()||anniversaries.isNotEmpty()))"+" else ""
val dateLabel=if(kind==WidgetKind.WIDE)date.dayOfMonth.toString()+plus else date.format(DateTimeFormatter.ofPattern("M.d E",Locale.KOREAN))+plus
val shiftLabel=if(kind==WidgetKind.WIDE)shift.shortTitle else shift.title
val shiftLabel=if(ShiftNames.cellLabel(shift).isEmpty())" " else if(kind==WidgetKind.WIDE)shift.shortTitle else shift.title
val extra=if(kind==WidgetKind.TALL&&height>=380&&style.detail!="COMPACT")detail(context,date,schedule,style,snapshot) else ""
val separator=if(kind==WidgetKind.WIDE)"\n" else " "
val text=dateLabel+separator+shiftLabel+(if(extra.isNotBlank())"\n$extra" else "")
@@ -46,10 +46,12 @@ class DeviceCalendar(private val activity: Activity, private val changed: () ->
}
fun open() {
AlertDialog.Builder(activity).setTitle("달력 연동·공유")
.setItems(arrayOf("기본 달력에 자동 반영","휴대폰 일정 선택해서 가져오기","다른 달력 구독 주소·파일 내보내기")){_,index->
.setItems(arrayOf("기본 달력에 자동 반영","휴대폰 일정 선택해서 가져오기","다른 달력 구독 주소·파일 내보내기","구글·삼성·아이폰 연동 방법 보기")){_,index->
when(index){
0->CalendarMirrorDialogs(activity).open()
1->{if(activity.checkSelfPermission(Manifest.permission.READ_CALENDAR)==PackageManager.PERMISSION_GRANTED)pickCalendar() else activity.requestPermissions(arrayOf(Manifest.permission.READ_CALENDAR),REQUEST_READ)}
// 홈페이지의 달력 연동 안내(관리자 페이지에서 글을 고친다)를 브라우저로 연다.
3->activity.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW,android.net.Uri.parse(SyncClient.WEB_URL.substringBefore("#").trimEnd('/')+"/guide")))
else->CalendarMirrorDialogs(activity).website()
}
}.setNegativeButton("닫기",null).show()
@@ -159,7 +159,9 @@ open class DutyWidget : AppWidgetProvider() {
val shiftStart = heading.length + 1
val workNames = if (style.people && !compact) snapshot.workNames(date, schedule) else emptyList()
val workLabel = workNames.take(2).joinToString("\n") { it.name.take(5) }
val baseText = "$heading\n${shift.shortTitle}" + (if (workLabel.isNotBlank()) "\n$workLabel" else "") + (holidayShort?.let { "\n$it" } ?: "")
// 일반근무 숨기기를 켜도 빈칸 한 글자로 줄을 남겨 날짜 칸의 높이와 정렬을 지킨다.
val shiftText = ShiftNames.cellLabel(shift).ifEmpty { " " }
val baseText = "$heading\n$shiftText" + (if (workLabel.isNotBlank()) "\n$workLabel" else "") + (holidayShort?.let { "\n$it" } ?: "")
val colleagues = People.onDuty(people, date)
// 작은 위젯에는 두 줄까지만 표시한다. 사람이 많아도 날짜의 높이와 정렬을 유지하고 전체 이름은 눌러서 확인한다.
val names = if (colleagues.size > 2) listOf(colleagues.first().name.take(3), "외${colleagues.size - 1}명") else colleagues.map { it.name.take(3) }
@@ -169,11 +171,11 @@ open class DutyWidget : AppWidgetProvider() {
val styled = SpannableString(cellText)
val dateColor = style.color(schedule.dateColor(date, holiday != null))
styled.setSpan(StyleSpan(Typeface.BOLD), 0, number.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(StyleSpan(Typeface.BOLD), shiftStart, shiftStart + shift.shortTitle.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(StyleSpan(Typeface.BOLD), shiftStart, shiftStart + shiftText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(ForegroundColorSpan(dateColor), 0, number.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(ForegroundColorSpan(style.color(schedule.shiftColor(date))), shiftStart, shiftStart + shift.shortTitle.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(ForegroundColorSpan(style.color(schedule.shiftColor(date))), shiftStart, shiftStart + shiftText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(RelativeSizeSpan(0.85f), number.length + 1, cellText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
if (holidayShort != null) styled.setSpan(ForegroundColorSpan(style.color(0xFFBD5163.toInt())), shiftStart + 1 + shift.shortTitle.length, baseText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
if (holidayShort != null) styled.setSpan(ForegroundColorSpan(style.color(0xFFBD5163.toInt())), shiftStart + 1 + shiftText.length, baseText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
if (lunar != null) {
styled.setSpan(RelativeSizeSpan(0.75f), number.length + 1, heading.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
styled.setSpan(ForegroundColorSpan(style.muted), number.length + 1, heading.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@@ -183,7 +185,7 @@ open class DutyWidget : AppWidgetProvider() {
styled.setSpan(ForegroundColorSpan(if (colleagues.size > 2 && i == 1) style.muted else style.color(colleagues[i].color)), nameStart, nameStart + name.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
nameStart += name.length + 1
}
var workStart = shiftStart + shift.shortTitle.length + 1
var workStart = shiftStart + shiftText.length + 1
workNames.take(2).forEach { name ->
val end = workStart + name.name.take(5).length
styled.setSpan(RelativeSizeSpan(0.8f), workStart, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@@ -188,10 +188,12 @@ class MainActivity : Activity() {
val dateColor = schedule.dateColor(date, holiday != null)
addView(label(date.dayOfMonth.toString(), 18f, dateColor, true).apply { gravity = Gravity.CENTER })
if (lunar != null) addView(label(lunar, 9f, muted).apply { gravity = Gravity.CENTER; maxLines = 1 })
addView(label(shift.shortTitle, 12f, schedule.shiftColor(date), true).apply {
// 일반근무 숨기기를 켜면 글자만 비우고 자리는 남겨 날짜 줄이 흔들리지 않게 한다.
val shiftText = ShiftNames.cellLabel(shift)
addView(label(shiftText, 12f, schedule.shiftColor(date), true).apply {
gravity = Gravity.CENTER
setPadding(dp(4), dp(2), dp(4), dp(2))
background = background(schedule.shiftPale(date), 3)
if (shiftText.isNotEmpty()) background = background(schedule.shiftPale(date), 3)
}, LinearLayout.LayoutParams(-2, -2).apply { topMargin = dp(3) })
workNames.take(2).forEach { name -> addView(label(name.name, 10f, name.color).apply { gravity=Gravity.CENTER; maxLines=1; ellipsize=android.text.TextUtils.TruncateAt.END }) }
if (workNames.size > 2) addView(label("외 ${workNames.size - 2}명", 9f, muted).apply { gravity=Gravity.CENTER })
@@ -422,7 +424,7 @@ class MainActivity : Activity() {
form.addView(label(description,12f,muted))
}
group("당직 기초 설정","근무 유형 · 반복 순서 · 기준일 · 주5일·주6일제",::showSettings)
group("달력 표시","주 시작 · 날짜 색상 · 음력 · 일반근무 이름",::showDisplayOptions)
group("달력 표시","주 시작 · 날짜 색상 · 음력 · 일반근무 이름과 숨기기",::showDisplayOptions)
group("이름 표시","${Shift.REGULAR.title} 아래 이름 · 다른 사람 주기 · 요일과 간격") { WorkNameDialogs(this){render()}.open() }
group("일정·알림","일정과 알바 · 기념일 · 휴대폰 알림") {
AlertDialog.Builder(this).setTitle("일정·알림").setItems(arrayOf("일정 찾기 · 다가오는 일정","일정 추가","알바·시간근무 추가","내 생일·기념일","휴대폰 알림 허용")){_,index->
@@ -465,11 +467,12 @@ class MainActivity : Activity() {
}
form.addView(regularName, LinearLayout.LayoutParams(-1, -2))
form.addView(label("주간·일근처럼 직장에서 부르는 이름으로 바꿀 수 있습니다. ${ShiftNames.MAX_LENGTH}자까지 쓰고 비우면 일반근무로 돌아갑니다. 달력 칸에는 세 글자까지 그대로 보이고 더 길면 앞 두 글자만 보입니다. 근무 순서는 바뀌지 않습니다.", 12f, muted))
val hideRegular = choice("달력 칸에서 일반근무 글자 숨기기", "앱 달력과 위젯 및 근무표 그림의 일반근무 날에 근무 글자를 넣지 않습니다. 오늘 카드와 날짜 상세에는 그대로 보이고 기본 달력 반영과 구독에는 그대로 보냅니다.", ScheduleStore.hideRegular(this))
val dialog = AlertDialog.Builder(this).setTitle("달력 표시").setView(ScrollView(this).apply { addView(form) })
.setNegativeButton("취소", null).setPositiveButton("저장", null).create()
dialog.setOnShowListener {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
runCatching { ScheduleStore.saveDisplay(this, weekday.isChecked, lunar.isChecked, off.isChecked, if (weekStart.selectedItemPosition == 0) 1 else 0, regularName = regularName.text.toString()) }
runCatching { ScheduleStore.saveDisplay(this, weekday.isChecked, lunar.isChecked, off.isChecked, if (weekStart.selectedItemPosition == 0) 1 else 0, regularName = regularName.text.toString(), hideRegular = hideRegular.isChecked) }
.onSuccess { render(); dialog.dismiss(); Toast.makeText(this, "표시 옵션을 저장했습니다.", Toast.LENGTH_SHORT).show() }
.onFailure { Toast.makeText(this, it.message ?: "저장 공간을 확인해 주세요.", Toast.LENGTH_LONG).show() }
}
@@ -90,7 +90,7 @@ object MonthWidgetViews {
?:colleagues.firstOrNull()?.name
val mark=style.eventMark&&(events.isNotEmpty()||anniversaries.isNotEmpty())
val number=date.dayOfMonth.toString()+if(mark&&cellWidth>=24)"+" else ""
val shiftLabel=if(cellWidth>=24)shift.shortTitle else when{shift==Shift.REGULAR&&ShiftNames.regular.isBlank()->"근";else->shift.shortTitle.take(1)}
val shiftLabel=if(ShiftNames.cellLabel(shift).isEmpty())" " else if(cellWidth>=24)shift.shortTitle else when{shift==Shift.REGULAR&&ShiftNames.regular.isBlank()->"근";else->shift.shortTitle.take(1)}
// 음력의 마지막 숫자를 자르면 16일이 1일처럼 보인다. 이름은 줄일 수 있지만
// 날짜 정보는 전체를 유지한다. 숫자 폭이 좁아 여섯 글자 음력도 같은 칸에 들어간다.
val extraLabel=if(extra==lunar)extra else extra?.take(4)
@@ -61,7 +61,7 @@ class PlanExportActivity:Activity() {
pen.color=0xFFE1E5EB.toInt();pen.style=Paint.Style.STROKE;canvas.drawRect(x,y,x+190,y+145,pen);pen.style=Paint.Style.FILL
if(YearMonth.from(date)==month){
val holiday=holidays.containsKey(date);pen.color=schedule.dateColor(date,holiday);pen.textSize=30f;canvas.drawText(date.dayOfMonth.toString(),x+12,y+36,pen)
pen.color=schedule.shiftColor(date);pen.textSize=25f;canvas.drawText(schedule.shiftOn(date).shortTitle,x+12,y+70,pen)
pen.color=schedule.shiftColor(date);pen.textSize=25f;canvas.drawText(ShiftNames.cellLabel(schedule.shiftOn(date)),x+12,y+70,pen)
if(includeEvents){pen.color=0xFF39485B.toInt();pen.textSize=20f;snapshot.eventsOn(date).take(2).forEachIndexed{line,item->val title=item.getJSONObject("data").getString("title");val count=pen.breakText(title,true,164f,null);canvas.drawText(title.take(count),x+12,y+101+line*25,pen)}}
}
}
@@ -143,7 +143,7 @@ object PlannerStore {
fun queuePreferences(context: Context, schedule: Schedule) {
put(context, "preferences", "preferences", JSONObject().put("dutyAsWeekday", schedule.dutyAsWeekday)
.put("showLunar", schedule.showLunar).put("offAsHoliday", schedule.offAsHoliday).put("weekStart", schedule.weekStart)
.put("regularName", ScheduleStore.regularName(context)))
.put("regularName", ScheduleStore.regularName(context)).put("hideRegular", ScheduleStore.hideRegular(context)))
}
private fun applyRotation(context: Context) {
val items = items(context)
@@ -155,7 +155,8 @@ object PlannerStore {
if (options != null) {
// 예전 자료에 이름이 없으면 이 기기의 이름을 유지한다. 서버가 거르지 못한 이상한 값도 동기화를 멈추지 않게 무시한다.
val name = if (options.has("regularName")) runCatching { ShiftNames.clean(options.getString("regularName")) }.getOrDefault(ScheduleStore.regularName(context)) else ScheduleStore.regularName(context)
ScheduleStore.saveDisplay(context, options.getBoolean("dutyAsWeekday"), options.getBoolean("showLunar"), options.getBoolean("offAsHoliday"), options.optInt("weekStart", ScheduleStore.load(context).weekStart), fromSync = true, regularName = name)
ScheduleStore.saveDisplay(context, options.getBoolean("dutyAsWeekday"), options.getBoolean("showLunar"), options.getBoolean("offAsHoliday"), options.optInt("weekStart", ScheduleStore.load(context).weekStart), fromSync = true, regularName = name,
hideRegular = if (options.opt("hideRegular") is Boolean) options.getBoolean("hideRegular") else ScheduleStore.hideRegular(context))
}
}
@Synchronized fun conflict(context: Context): Pair<JSONObject, JSONObject?>? {
@@ -14,10 +14,12 @@ object ScheduleStore {
fun isConfigured(context: Context): Boolean = preferences(context).contains("anchor")
/** 일반근무를 부르는 이름. 근무표와 따로 저장하며 빈 값은 기본 이름이다. */
fun regularName(context: Context): String = preferences(context).getString("regularName", "").orEmpty()
fun hideRegular(context: Context): Boolean = preferences(context).getBoolean("hideRegular", false)
fun load(context: Context): Schedule {
val prefs = preferences(context)
// 앱 화면과 위젯 및 기본 달력 반영이 근무표를 읽는 순간 같은 이름을 쓰도록 여기서 맞춘다.
ShiftNames.regular = prefs.getString("regularName", "").orEmpty()
ShiftNames.hideRegular = prefs.getBoolean("hideRegular", false)
// 손상된 날짜나 알 수 없는 근무 값 때문에 달력 전체가 종료되지 않도록 기본값으로 복구한다.
// 이 과정에서는 원래 저장 내용을 덮어쓰지 않는다. 새로 저장할 때만 설정을 변경한다.
return runCatching {
@@ -37,12 +39,13 @@ object ScheduleStore {
* 기초 설정이 있으면 최신 기준일과 순서를 그대로 복사해 표시 옵션만 갱신한다.
* 따라서 옵션 창을 연 사이에 다른 기기에서 받은 근무표를 이전 값으로 되돌리지 않는다.
*/
fun saveDisplay(context: Context, dutyAsWeekday: Boolean, showLunar: Boolean, offAsHoliday: Boolean, weekStart: Int = load(context).weekStart, fromSync: Boolean = false, regularName: String = regularName(context)) {
fun saveDisplay(context: Context, dutyAsWeekday: Boolean, showLunar: Boolean, offAsHoliday: Boolean, weekStart: Int = load(context).weekStart, fromSync: Boolean = false, regularName: String = regularName(context), hideRegular: Boolean = hideRegular(context)) {
require(weekStart in 0..1) { "주 시작 요일을 확인해 주세요." }
val name = ShiftNames.clean(regularName)
check(preferences(context).edit().putBoolean("dutyAsWeekday", dutyAsWeekday)
.putBoolean("showLunar", showLunar).putBoolean("offAsHoliday", offAsHoliday).putInt("weekStart", weekStart).putString("regularName", name).commit()) { "저장 공간을 확인해 주세요." }
.putBoolean("showLunar", showLunar).putBoolean("offAsHoliday", offAsHoliday).putInt("weekStart", weekStart).putString("regularName", name).putBoolean("hideRegular", hideRegular).commit()) { "저장 공간을 확인해 주세요." }
ShiftNames.regular = name
ShiftNames.hideRegular = hideRegular
// 개인 표시 선택은 근무표와 별도 항목으로 저장한다. 회원은 근무표를 아직 만들지 않아도 복원할 수 있다.
if (!fromSync && (isConfigured(context) || PlannerStore.calendarId(context).isNotBlank())) {
PlannerStore.queuePreferences(context, load(context))
@@ -10,6 +10,8 @@ package kr.co.itosm.dutycalendar
object ShiftNames {
const val MAX_LENGTH = 8
@Volatile var regular: String = ""
/** 달력 칸에서 일반근무 글자를 숨길지. 오늘 카드와 날짜 상세 및 고르는 목록에는 그대로 보인다. */
@Volatile var hideRegular: Boolean = false
private val blocked = setOf(Character.CONTROL, Character.FORMAT, Character.PRIVATE_USE, Character.SURROGATE, Character.UNASSIGNED).map { it.toInt() }
@@ -26,6 +28,9 @@ object ShiftNames {
return value
}
/** 달력 칸과 위젯 칸에 쓸 글자. 숨기기를 켜면 일반근무 날은 빈 글자다. */
fun cellLabel(shift: Shift): String = if (hideRegular && shift == Shift.REGULAR) "" else shift.shortTitle
fun short(name: String): String {
val count = name.codePointCount(0, name.length)
return if (count <= 3) name else name.substring(0, name.offsetByCodePoints(0, 2))
@@ -7,7 +7,7 @@ import java.time.LocalDate
/** 일반근무 이름을 바꿔도 근무 계산과 저장 식별자는 그대로이고 보이는 이름만 바뀌는지 확인한다. */
class ShiftNamesTest {
@After fun reset() { ShiftNames.regular = "" }
@After fun reset() { ShiftNames.regular = ""; ShiftNames.hideRegular = false }
@Test fun defaultNamesStay() {
assertEquals("일반근무", Shift.REGULAR.title)
@@ -41,12 +41,21 @@ class ShiftNamesTest {
assertEquals("일근", Shift.REGULAR.choiceTitle)
}
@Test fun hideRegularOnlyEmptiesCells() {
ShiftNames.hideRegular = true
assertEquals("", ShiftNames.cellLabel(Shift.REGULAR))
assertEquals("당직", ShiftNames.cellLabel(Shift.DUTY))
assertEquals("일반근무", Shift.REGULAR.title)
ShiftNames.hideRegular = false
assertEquals("일반", ShiftNames.cellLabel(Shift.REGULAR))
}
@Test fun cleanRules() {
assertEquals("주간 근무", ShiftNames.clean(" 주간 \n 근무 "))
assertEquals("", ShiftNames.clean(" "))
assertEquals("가".repeat(8), ShiftNames.clean("가".repeat(8)))
assertThrows(IllegalArgumentException::class.java) { ShiftNames.clean("가".repeat(9)) }
assertThrows(IllegalArgumentException::class.java) { ShiftNames.clean("주간\u0007") }
assertThrows(IllegalArgumentException::class.java) { ShiftNames.clean("주간​") }
assertThrows(IllegalArgumentException::class.java) { ShiftNames.clean("주간\u200b") }
}
}