fix: align cmhub image timeout display

This commit is contained in:
chengma
2026-07-07 19:13:00 +08:00
parent 95b180e9cf
commit 2928624019
13 changed files with 67 additions and 29 deletions
+3 -1
View File
@@ -408,8 +408,9 @@ class AITests(TempDirMixin, unittest.TestCase):
self.assertEqual("1K", payload["resolution"])
self.assertEqual("1:1", payload["aspect_ratio"])
self.assertTrue(payload["image_base64"].startswith("data:image/jpeg;base64,"))
self.assertEqual((3, 650), calls[0][2]["timeout"])
self.assertEqual("https://cdn.example.com/generated.png", downloads[0][0])
self.assertEqual((3, 240), downloads[0][1]["timeout"])
self.assertEqual((3, 650), downloads[0][1]["timeout"])
self.assertEqual(91, events[0]["metadata"]["points_balance"])
with Image.open(output) as saved:
self.assertEqual((1024, 1024), saved.size)
@@ -487,6 +488,7 @@ class AITests(TempDirMixin, unittest.TestCase):
self.assertEqual("read_timeout", raised.exception.code)
self.assertEqual(1, len(calls))
self.assertEqual((3, 650), calls[0][2]["timeout"])
self.assert_removed(temp_dir)
+19 -1
View File
@@ -809,7 +809,7 @@ class GuiTests(TempDirMixin, unittest.TestCase):
tab.image_concurrency_spin.setValue(2)
tab.retry_spin.setValue(1)
tab.resolution_combo.setCurrentIndex(tab.resolution_combo.findData("2k"))
self.assertEqual("360 秒", tab.response_timeout_label.text())
self.assertEqual("标题 600 秒 / 图片 650 秒", tab.response_timeout_label.text())
tab.jpg_quality_spin.setValue(86)
tab.chrome_path_edit.setText("D:\\Chrome\\chrome.exe")
tab.default_debug_port_spin.setValue(9300)
@@ -866,6 +866,24 @@ class GuiTests(TempDirMixin, unittest.TestCase):
self.assert_removed(temp_dir)
def test_settings_tab_direct_timeout_label_uses_resolution_mapping(self):
with self.make_temp_dir() as temp_dir:
cfg = self.make_config(temp_dir)
cfg["ai"] = appconfig.default_config()["ai"]
cfg["ai"]["backend"] = "direct"
tab = SettingsTab(
config=cfg,
config_path=cfg["config_path"],
ai_models_path=cfg["ai_models_path"],
)
self.addCleanup(tab.close)
tab.resolution_combo.setCurrentIndex(tab.resolution_combo.findData("2k"))
self.assertEqual("360 秒", tab.response_timeout_label.text())
self.assert_removed(temp_dir)
def test_settings_save_updates_apply_tab_shared_safety_config(self):
with self.make_temp_dir() as temp_dir:
cfg = self.make_config(temp_dir)