BUG: Fix ctkLanguageComboBox locale normalization and selection - #1400
BUG: Fix ctkLanguageComboBox locale normalization and selection#1400hjmjohnson wants to merge 1 commit into
Conversation
|
@lassoan, I am NOT very familiar with locales. This looks reasonable to me, but I am not knowledgeable about the nuances. I do know that tests were failing, and now they pass. It would be great if you, or someone you know, could review the proposed change here. |
c87ab0a to
7c141e9
Compare
7c141e9 to
b6735e0
Compare
|
Thanks for the fix. I'll test this. The topic of language codes is surprisingly complex. |
b6735e0 to
a708f38
Compare
|
|
CTK Validation Report for PR #1400Date: 2026-04-03T16:58:30Z
Validation Actions Performed
|
| Count | Category |
|---|---|
| 27 | [-Wold-style-cast |
| 26 | [-Wunused-variable |
By source:
| Count | Source | Origin |
|---|---|---|
| 15 | /usr/include/python3.14/pyport.h |
Python headers (external) |
| 6 | /usr/include/python3.14/object.h |
Python headers (external) |
| 6 | /home/johnsonhj/src/CTK/cmake-build-clazy-qt5/CMakeExternals/Install/include/PythonQt/PythonQtInstanceWrapper.h |
PythonQt (external) |
| 1 | Libs/Widgets/ctkThumbnailLabel.cpp |
CTK source |
| 1 | Libs/Widgets/ctkSettingsDialog.cpp |
CTK source |
| 1 | Libs/Widgets/ctkModalityWidget.cpp |
CTK source |
| 1 | Libs/Widgets/ctkMaterialPropertyWidget.cpp |
CTK source |
| 1 | Libs/Widgets/ctkFlowLayout.cpp |
CTK source |
| 1 | Libs/Widgets/ctkCrosshairLabel.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKThresholdWidget.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Core/ctkVTKScalarsToColorsUtils.cpp |
CTK source |
| 1 | Libs/DICOM/Widgets/ctkDICOMQueryWidget.cpp |
CTK source |
| 1 | Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp |
CTK source |
| 1 | Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMThumbnailGeneratorJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMTester.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMStorageListenerJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMServer.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMRetrieveJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMQueryJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMJobResponseSet.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMInserterJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMFilterProxyModel.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMEchoJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMAbstractThumbnailGenerator.cpp |
CTK source |
⚠️ CTK standalone Qt6: 54 new warnings (3 → 57)
By category:
| Count | Category |
|---|---|
| 30 | [-Wunused-variable |
| 27 | [-Wold-style-cast |
By source:
| Count | Source | Origin |
|---|---|---|
| 15 | /usr/include/python3.14/pyport.h |
Python headers (external) |
| 6 | /usr/include/python3.14/object.h |
Python headers (external) |
| 6 | /home/johnsonhj/src/CTK/cmake-build-clazy-qt6/CMakeExternals/Install/include/PythonQt/PythonQtInstanceWrapper.h |
PythonQt (external) |
| 1 | Libs/Widgets/ctkThumbnailLabel.cpp |
CTK source |
| 1 | Libs/Widgets/ctkSettingsDialog.cpp |
CTK source |
| 1 | Libs/Widgets/ctkModalityWidget.cpp |
CTK source |
| 1 | Libs/Widgets/ctkMaterialPropertyWidget.cpp |
CTK source |
| 1 | Libs/Widgets/ctkFlowLayout.cpp |
CTK source |
| 1 | Libs/Widgets/ctkCrosshairLabel.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKVolumePropertyWidget.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKThresholdWidget.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsWidget.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsView.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp |
CTK source |
| 1 | Libs/Visualization/VTK/Core/ctkVTKScalarsToColorsUtils.cpp |
CTK source |
| 1 | Libs/DICOM/Widgets/ctkDICOMQueryWidget.cpp |
CTK source |
| 1 | Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp |
CTK source |
| 1 | Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMThumbnailGeneratorJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMTester.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMStorageListenerJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMServer.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMRetrieveJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMQueryJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMJobResponseSet.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMInserterJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMFilterProxyModel.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMEchoJob.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp |
CTK source |
| 1 | Libs/DICOM/Core/ctkDICOMAbstractThumbnailGenerator.cpp |
CTK source |
CTK-in-Slicer Build Detail (classified warnings)
| Source | Proposed errors | Proposed warnings | Reference errors | Reference warnings |
|---|---|---|---|---|
| CTK source code | 0 ✅ | 1 | 0 | 1 |
| CTK dependencies | 0 ✅ | 186 | 0 | 186 |
| Slicer (CTK-related) | 0 ✅ | 0 ✅ | 0 | 0 |
| Slicer (own code) | 0 ✅ | 0 ✅ | 0 | 0 |
Slicer Test Detail (classified failures)
| Category | Proposed (a708f388) |
Reference (935c4e04) |
|---|---|---|
| CTK-related failures | 0 ✅ | 0 |
| Slicer-own failures | 0 ✅ | 0 |
| Total failed | 9 | 9 |
CTK Test Failures (proposed a708f388)
Qt5 (13 failures):
| Test | Status | Related PR/Issue |
|---|---|---|
ctkFontButtonTest |
🔄 Timeout | #1395 — WIP: Fix ctkFontButtonTest hang and disable stale modal dialog tests |
ctkLanguageComboBoxTest |
🔄 Failed | #1400 — BUG: Fix ctkLanguageComboBox locale normalization and selection |
ctkWidgetsUtilsTestGrabWidget |
🖥️ Failed | — — Requires OpenGL display — fails in headless environments |
ctkColorPickerButtonEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
ctkDirectoryButtonEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
ctkFileDialogEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
ctkMenuComboBoxEventTranslatorPlayerTest1 |
🔄 Failed | #1395 — Modal dialog event translator failure |
vtkLightBoxRendererManagerTest1 |
🖥️ SEGFAULT | — — GPU/GLSL infrastructure — SEGFAULT in headless environments |
ctkVTKMagnifyViewTest2OddOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2OddEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
Qt6 (10 failures):
| Test | Status | Related PR/Issue |
|---|---|---|
CTKPluginFrameworkAppTests |
🐛 Subprocess aborted | — — Qt6 subprocess abort — pre-existing |
ctkLanguageComboBoxTest |
🔄 Failed | #1400 — BUG: Fix ctkLanguageComboBox locale normalization and selection |
ctkWidgetsUtilsTestGrabWidget |
🖥️ Failed | — — Requires OpenGL display — fails in headless environments |
ctkWorkflowWidgetTest1 |
🐛 Failed | — — Qt6 QStateMachine async transitions — widgets not visible in time |
ctkWorkflowWidgetTest2 |
🐛 Failed | — — Qt6 QStateMachine async transitions — widgets not visible in time |
vtkLightBoxRendererManagerTest1 |
🖥️ SEGFAULT | — — GPU/GLSL infrastructure — SEGFAULT in headless environments |
ctkVTKMagnifyViewTest2OddOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2OddEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
CTK Test Failures (reference 935c4e04)
Qt5 (25 failures):
| Test | Status | Related PR/Issue |
|---|---|---|
ctkBackTraceTest |
🐛 Failed | — — Fixed on master — symbol resolution on Linux with hidden visibility |
ctkLoggerTest1 |
🐛 Failed | — — Fixed on master — default log level expectation |
ctkFontButtonTest |
🔄 Timeout | #1395 — WIP: Fix ctkFontButtonTest hang and disable stale modal dialog tests |
ctkLanguageComboBoxTest |
🔄 Failed | #1400 — BUG: Fix ctkLanguageComboBox locale normalization and selection |
ctkMessageBoxDontShowAgainTest |
🐛 Failed | — — Fixed on master — ButtonRole vs StandardButton |
ctkWidgetsUtilsTestGrabWidget |
🖥️ Failed | — — Requires OpenGL display — fails in headless environments |
ctkColorPickerButtonEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
ctkDirectoryButtonEventTranslatorPlayerTest1 |
🔄 Failed | #1395 — Modal dialog timeout — addressed in test fix PR |
ctkFileDialogEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
ctkMenuComboBoxEventTranslatorPlayerTest1 |
🔄 Failed | #1395 — Modal dialog event translator failure |
ctkPathLineEditEventTranslatorPlayerTest1 |
🐛 Failed | — — Fixed on master — XML widget name update |
ctkDICOMPatientDelegateTest1 |
🐛 Failed | — — Fixed on master — default header height |
vtkLightBoxRendererManagerTest1 |
🖥️ SEGFAULT | — — GPU/GLSL infrastructure — SEGFAULT in headless environments |
ctkVTKErrorLogModelFileLoggingTest1 |
🐛 Failed | — — Fixed on master — Qt6 + line stability |
ctkVTKHistogramTest3 |
🐛 Failed | — — Fixed on master — out-of-bounds read with signed VTK_CHAR |
ctkVTKPropertyWidgetTest |
🐛 Failed | — — Fixed on master — float precision comparison |
ctkVTKThresholdWidgetTest1 |
🐛 Failed | — — Fixed on master — threshold lost after setRange |
ctkVTKSurfaceMaterialPropertyWidgetTest1 |
🐛 Failed | — — Fixed on master — opacity comparison |
ctkVTKMagnifyViewTest2OddOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2OddEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKRenderViewEventTranslatorPlayerTest1 |
🐛 Failed | — — Fixed on master — Qt6 protected operator= |
ctkVTKScalarBarWidgetEventTranslatorPlayerTest1 |
🐛 Failed | — — Fixed on master — missing XML events |
ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1 |
🔄 Timeout | #1395 — Modal dialog timeout — addressed in test fix PR |
Qt6 (10 failures):
| Test | Status | Related PR/Issue |
|---|---|---|
CTKPluginFrameworkAppTests |
🐛 Subprocess aborted | — — Qt6 subprocess abort — pre-existing |
ctkLanguageComboBoxTest |
🔄 Failed | #1400 — BUG: Fix ctkLanguageComboBox locale normalization and selection |
ctkWidgetsUtilsTestGrabWidget |
🖥️ Failed | — — Requires OpenGL display — fails in headless environments |
ctkWorkflowWidgetTest1 |
🐛 Failed | — — Qt6 QStateMachine async transitions — widgets not visible in time |
ctkWorkflowWidgetTest2 |
🐛 Failed | — — Qt6 QStateMachine async transitions — widgets not visible in time |
vtkLightBoxRendererManagerTest1 |
🖥️ SEGFAULT | — — GPU/GLSL infrastructure — SEGFAULT in headless environments |
ctkVTKMagnifyViewTest2OddOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2OddEven |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
ctkVTKMagnifyViewTest2EvenOdd |
🖥️ Failed | — — VTK OpenGL render — fails without GPU |
🔄 = addressed in open PR | 🖥️ = infrastructure/display dependent | 🐛 = known bug | ➖ = wontfix
Generated by /validate-ctk-pr skill | cache: /home/johnsonhj/src/CTK/.claude/validate-cache
|
@lassoan FYI: #1400 (comment) is a report that demostrates that building against Qt5, and Qt6 in stand-alone CTK builds, and building inside of Slicer introduce no new errors. No new warnings from CTK source code itself. The 26 unused-variable warnings are addressed by the fix already prepared on PR #1409's branch. The old-style-cast warnings are from PythonQt/Python headers (external, not actionable). |
56c899c to
acf0e1b
Compare
acf0e1b to
b1b175a
Compare
b1b175a to
fd56552
Compare
setDefaultLanguage() stored the raw input string without validation or normalization. This caused two issues: 1. Bare language codes like "en" were not expanded to full locale codes (e.g. "en_US"), so defaultLanguage() returned "en" instead of the expected "en_US". 2. Invalid locale codes like "xx", "_en" were accepted instead of being rejected. Fix by normalizing the locale code through QLocale in setDefaultLanguage(). Codes that QLocale maps to "C" (unrecognized) are rejected and stored as empty. Also fix updateLanguageItems() to fall back to selecting the default language item when no prior selection exists, so currentLanguage() returns the correct value after the first setDefaultLanguage() call. Fixes ctkLanguageComboBoxTest on both Qt5 and Qt6.
fd56552 to
2bf339d
Compare
Summary
setDefaultLanguage()stored the raw input string without validation or normalization, causing bare language codes like"en"to not be expanded to"en_US", and invalid codes like"xx"to be acceptedQLocale— codes that map to"C"(unrecognized) are rejectedupdateLanguageItems()to fall back to selecting the default language item when no prior selection exists, socurrentLanguage()returns the correct value after the firstsetDefaultLanguage()callTest plan
🤖 Generated with Claude Code