fix: fix UI bug and agent roles
This commit is contained in:
@@ -55,12 +55,39 @@ def test_the_co_tieu_de_va_mo_ta(welcome):
|
||||
assert card.text() == ""
|
||||
|
||||
|
||||
def test_the_khong_bi_bop_thanh_khung_rong(qapp, welcome):
|
||||
"""Regression: bốn thẻ hiện ra nhưng RỖNG — không chữ, không icon.
|
||||
|
||||
``QPushButton`` tự tính ``sizeHint``/``minimumSizeHint`` từ text và icon
|
||||
CỦA CHÍNH NÓ và bỏ qua layout con. Thẻ để cả hai thứ đó rỗng có chủ ý (chữ
|
||||
do hai QLabel bên trong vẽ), nên nút báo 54x15 trong khi layout con đòi
|
||||
258x48 — hai QLabel và ô icon được chia 0px chiều cao và không có gì được
|
||||
vẽ ra. Đặt ``text()`` không rỗng thì chữ in đè, nên hai override là đường
|
||||
duy nhất.
|
||||
"""
|
||||
welcome.resize(900, 700)
|
||||
welcome.show()
|
||||
qapp.processEvents()
|
||||
try:
|
||||
for card in welcome.cards:
|
||||
can = card.layout().minimumSize()
|
||||
assert card.width() >= can.width(), (
|
||||
f"thẻ rộng {card.width()}px, layout con cần {can.width()}px")
|
||||
assert card.height() >= can.height(), (
|
||||
f"thẻ cao {card.height()}px, layout con cần {can.height()}px")
|
||||
assert card.title_label.height() > 0, "tiêu đề bị chia 0px chiều cao"
|
||||
assert card.sub_label.height() > 0, "dòng mô tả bị chia 0px chiều cao"
|
||||
assert card._icon.height() > 0, "ô icon bị chia 0px chiều cao"
|
||||
finally:
|
||||
welcome.hide()
|
||||
|
||||
|
||||
# ---- dòng bối cảnh: KHÔNG BIẾT khác 0 ------------------------------------
|
||||
|
||||
def test_khong_biet_so_tep_thi_bo_manh_do(welcome):
|
||||
"""Hiện "0 tệp" khi người dùng vừa thấy có tệp trong thư mục còn tệ hơn là
|
||||
bỏ mảnh đó khỏi dòng meta."""
|
||||
welcome.refresh(user_name="local", project="p", files=-1, skills=-1)
|
||||
welcome.refresh(user_name="local", project="p", files=-1)
|
||||
|
||||
meta = welcome.meta_label.text()
|
||||
assert "p" in meta
|
||||
@@ -69,7 +96,7 @@ def test_khong_biet_so_tep_thi_bo_manh_do(welcome):
|
||||
|
||||
def test_khong_co_tep_that_thi_van_hien_so_0(welcome):
|
||||
"""Khác với KHÔNG BIẾT: thư mục rỗng thật thì nói rõ là rỗng."""
|
||||
welcome.refresh(user_name="local", project="p", files=0, skills=0)
|
||||
welcome.refresh(user_name="local", project="p", files=0)
|
||||
|
||||
assert "0" in welcome.meta_label.text()
|
||||
|
||||
@@ -99,7 +126,7 @@ def test_khong_co_ten_thi_khong_chao_rong(welcome):
|
||||
|
||||
@pytest.mark.parametrize("key", [
|
||||
"welcome.greeting", "welcome.greeting_anon", "welcome.meta_project",
|
||||
"welcome.meta_files", "welcome.meta_skills",
|
||||
"welcome.meta_files",
|
||||
"welcome.card_docs", "welcome.card_docs_sub", "welcome.prompt_docs",
|
||||
"welcome.card_data", "welcome.card_data_sub", "welcome.prompt_data",
|
||||
"welcome.card_schedule", "welcome.card_schedule_sub", "welcome.prompt_schedule",
|
||||
|
||||
Reference in New Issue
Block a user