fixed label under 3d view

This commit is contained in:
ykcheungab
2026-09-15 21:50:37 +08:00
parent c2293d4d41
commit c538dbf074
7 changed files with 269 additions and 212 deletions
+32 -15
View File
@@ -40,12 +40,14 @@ def panel(qt_app):
# --------------------------------------------------------------------- the pane
def test_the_pane_holds_a_legend_and_no_settings(qt_app, panel):
def test_the_pane_holds_a_legend_and_no_settings(panel):
"""What is on the pane has to be readable, not adjustable."""
# The readouts are part of the pane itself...
assert panel.legend_label.parent() is panel
assert panel.source_label.parent() is panel
assert panel.scale_bar.parent() is panel
assert panel.scale_lower_label.parent() is panel
assert panel.scale_upper_label.parent() is panel
# ...and every setting is in one block that the pane never shows.
assert panel.controls_widget.parent() is panel
assert not panel.controls_widget.isVisible()
@@ -64,7 +66,7 @@ def test_the_pane_holds_a_legend_and_no_settings(qt_app, panel):
assert panel.stats_label.parent() is panel.controls_widget
def test_the_settings_dialog_hosts_the_panes_own_controls(qt_app, panel):
def test_the_settings_dialog_hosts_the_panes_own_controls(panel):
"""One set of widgets either way: the dialog moves them, it does not copy them."""
from orisys_studio.scene3d.settings_dialog import Scene3dSettingsDialog
@@ -96,6 +98,10 @@ def test_the_pane_header_offers_the_two_actions(qt_app):
"""A gear and a view reset: the two things that belong to *looking*."""
from orisys_studio.ui.mesh3d_panel import Mesh3dPanel
assert "reset_view" in icons.NAMES
for theme in ("dark", "light"):
assert not icons.icon("reset_view", theme).isNull()
pane = Mesh3dPanel(theme="dark")
try:
assert pane.btn_settings.toolTip() == t("panels.mesh3d_settings_tip")
@@ -138,17 +144,10 @@ def test_the_pane_header_offers_the_two_actions(qt_app):
finally:
pane.deleteLater()
def test_the_reset_view_icon_is_painted_from_the_theme():
assert "reset_view" in icons.NAMES
for theme in ("dark", "light"):
assert not icons.icon("reset_view", theme).isNull()
# --------------------------------------------------------------- which quantity
def test_the_pane_offers_the_two_quantities_and_says_which_one_it_drew(qt_app, panel):
def test_the_pane_offers_the_two_quantities_and_says_which_one_it_drew(panel):
"""The choice is the operator's; a frame that cannot honour it says so."""
from orisys_app_shared.scene3d.contracts import FieldDescriptor
@@ -165,6 +164,7 @@ def test_the_pane_offers_the_two_quantities_and_says_which_one_it_drew(qt_app, p
# The other one is drawn instead: the note names both, and the legend still shows
# what is really on screen (the range is for the field that was drawn).
panel.set_diagnostics_visible(True)
panel.set_descriptor(FieldDescriptor("flow_magnitude", "px", "approximate", False))
note = panel.field_note.text()
assert t("scene3d.field_depth") in note and t("scene3d.field_flow") in note, note
@@ -184,12 +184,25 @@ def test_the_pane_offers_the_two_quantities_and_says_which_one_it_drew(qt_app, p
assert panel.field() == "depth"
def test_the_diagnostics_switch_governs_what_the_pane_explains(qt_app, panel):
def test_the_diagnostics_switch_governs_what_the_pane_explains(panel):
"""Warnings are claims about the measurement and always show; info is explanation."""
from orisys_app_shared.scene3d.contracts import diagnostic
from orisys_app_shared.scene3d.contracts import FieldDescriptor, RenderStats, diagnostic
panel.set_descriptor(None)
panel.set_descriptor(FieldDescriptor("flow_magnitude", "px", "approximate", False))
panel.set_render_stats(
RenderStats(scale_lower=0.25, scale_upper=2.5, scale_mode="automatic")
)
panel.set_diagnostics_visible(False)
assert not panel.scale_bar.isHidden()
assert panel.scale_lower_label.text() == "0.25"
assert panel.scale_upper_label.text() == "2.5"
assert not panel.scale_lower_label.isHidden()
assert not panel.scale_upper_label.isHidden()
assert panel.legend_label.isHidden()
assert panel.source_label.isHidden()
assert panel.state_label.isHidden()
assert panel.field_note.isHidden()
panel.set_diagnostic(diagnostic("field_stale", "the array is from another frame"))
assert "another frame" in panel.legend_label.text(), (
"a warning about the measurement was hidden"
@@ -204,13 +217,17 @@ def test_the_diagnostics_switch_governs_what_the_pane_explains(qt_app, panel):
assert "not current" not in panel.legend_label.text(), (
"an informational line survived diagnostics being off"
)
assert panel.legend_label.isHidden()
panel.set_diagnostics_visible(True)
assert not panel.legend_label.isHidden()
assert not panel.source_label.isHidden()
assert not panel.state_label.isHidden()
panel.set_diagnostic(diagnostic("stale_frame", "the picture is not current"))
assert "not current" in panel.legend_label.text()
def test_the_2d_footer_shows_the_picture_and_hides_the_pipeline(qt_app, make_window):
def test_the_2d_footer_shows_the_picture_and_hides_the_pipeline(make_window):
"""One line under the canvas: what the picture is, not how it was made."""
from PyQt5.QtWidgets import QApplication
@@ -243,7 +260,7 @@ def test_the_2d_footer_shows_the_picture_and_hides_the_pipeline(qt_app, make_win
# --------------------------------------------------------------------- the menu
def test_the_view_menu_opens_the_3d_settings(qt_app, make_window):
def test_the_view_menu_opens_the_3d_settings(make_window):
"""视图 ▸ 三维显示设置… is the way in that does not depend on the pane's header."""
from PyQt5.QtWidgets import QApplication