CAM: Add AssetManager.copy() and .deepcopy()
CAM: Add copy/paste support for the ToolBitBrowser CAM: Move library dropdown and sort order combo to dedicated row to give them more space CAM: Fix: PathAssetManagerTest failed CAM: Add YamlSerializer [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci CAM: Fix CodeQL complaints CAM: add LibraryProperties dialog CAM: Replace the LibraryEditor CAM: allow for editing tool number in the tool editor dialog CAM: Remember last selected library and sort order in preferences CAM: support natural sort order in tool and library lists CAM: Fix CodeQL complaints CAM: Fix: not all attributes included in YAML serialization CAM: Fix: UTF8 chars not included in LinuxCNC export Fix: tool library not displayed when loading it for the first time CAM: Fix: custom shape class not found CAM: Check dependencies on import for friendlier error messages CAM: Open file dialogs in home by default CAM: Show "All Tools" entry in library list in the library editor CAM: fix: error on sorting tools with no tool number CAM: Fix: traceback if library contained tool number as string CAM: Fix: Linter errors in manager.py CAM: Fix: separator between library and tool buttons CAM: Add drag & drop support to the library editor CAM: Fix numerous linter errors on the AssetManager CAM: Show current library in library editor window title CAM: Add dedicated icons for library add + remove CAM: Support F2 key in library editor CAM: library editor handles delete key when library list is in focus; focus search field by default CAM: fix: tool list in dock initially not loading CAM: Fix: library editor did not open from "all tools" list CAM: Increase precision of parameters in tool summary to 3 digits fix TestToolBitListWidget
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
|
||||
"""Unit tests for the ToolBitListWidget."""
|
||||
|
||||
from typing import cast
|
||||
import unittest
|
||||
from Path.Tool.toolbit import ToolBit
|
||||
from Path.Tool.toolbit.ui.toollist import ToolBitListWidget, ToolBitUriRole
|
||||
from Path.Tool.toolbit.ui.tablecell import TwoLineTableCell
|
||||
from .PathTestUtils import PathTestWithAssets # Import the base test class
|
||||
@@ -37,7 +39,7 @@ class TestToolBitListWidget(PathTestWithAssets):
|
||||
|
||||
def test_add_toolbit(self):
|
||||
# Get a real ToolBit asset
|
||||
toolbit = self.assets.get("toolbit://5mm_Endmill")
|
||||
toolbit = cast(ToolBit, self.assets.get("toolbit://5mm_Endmill"))
|
||||
tool_no = 1
|
||||
|
||||
self.widget.add_toolbit(toolbit, str(tool_no))
|
||||
@@ -53,7 +55,7 @@ class TestToolBitListWidget(PathTestWithAssets):
|
||||
self.assertEqual(cell_widget.tool_no, str(tool_no))
|
||||
self.assertEqual(cell_widget.upper_text, toolbit.label)
|
||||
# Assuming the 5mm_Endmill asset has a shape named 'Endmill'
|
||||
self.assertEqual(cell_widget.lower_text, "5.00 mm 4-flute endmill, 30.00 mm cutting edge")
|
||||
self.assertEqual(cell_widget.lower_text, "5 mm 4-flute endmill, 30 mm cutting edge")
|
||||
|
||||
# Verify URI is stored in item data
|
||||
stored_uri = item.data(ToolBitUriRole)
|
||||
@@ -61,8 +63,8 @@ class TestToolBitListWidget(PathTestWithAssets):
|
||||
|
||||
def test_clear_list(self):
|
||||
# Add some real items first
|
||||
toolbit1 = self.assets.get("toolbit://5mm_Endmill")
|
||||
toolbit2 = self.assets.get("toolbit://slittingsaw")
|
||||
toolbit1 = cast(ToolBit, self.assets.get("toolbit://5mm_Endmill"))
|
||||
toolbit2 = cast(ToolBit, self.assets.get("toolbit://slittingsaw"))
|
||||
self.widget.add_toolbit(toolbit1, 1)
|
||||
self.widget.add_toolbit(toolbit2, 2)
|
||||
self.assertEqual(self.widget.count(), 2)
|
||||
@@ -72,9 +74,9 @@ class TestToolBitListWidget(PathTestWithAssets):
|
||||
|
||||
def test_apply_filter(self):
|
||||
# Add items with distinct text for filtering
|
||||
toolbit1 = self.assets.get("toolbit://5mm_Endmill")
|
||||
toolbit2 = self.assets.get("toolbit://slittingsaw")
|
||||
toolbit3 = self.assets.get("toolbit://probe")
|
||||
toolbit1 = cast(ToolBit, self.assets.get("toolbit://5mm_Endmill"))
|
||||
toolbit2 = cast(ToolBit, self.assets.get("toolbit://slittingsaw"))
|
||||
toolbit3 = cast(ToolBit, self.assets.get("toolbit://probe"))
|
||||
|
||||
self.widget.add_toolbit(toolbit1, 1)
|
||||
self.widget.add_toolbit(toolbit2, 2)
|
||||
@@ -117,8 +119,8 @@ class TestToolBitListWidget(PathTestWithAssets):
|
||||
self.assertEqual(cell.search_highlight, "3mm")
|
||||
|
||||
def test_get_selected_toolbit_uri(self):
|
||||
toolbit1 = self.assets.get("toolbit://5mm_Endmill")
|
||||
toolbit2 = self.assets.get("toolbit://slittingsaw")
|
||||
toolbit1 = cast(ToolBit, self.assets.get("toolbit://5mm_Endmill"))
|
||||
toolbit2 = cast(ToolBit, self.assets.get("toolbit://slittingsaw"))
|
||||
|
||||
self.widget.add_toolbit(toolbit1, 1)
|
||||
self.widget.add_toolbit(toolbit2, 2)
|
||||
|
||||
Reference in New Issue
Block a user