|
22 | 22 | Scene as GfxScene, |
23 | 23 | ScreenCoordsCamera, |
24 | 24 | Texture, |
| 25 | + TrackballController, |
25 | 26 | have_imgui_bundle, |
26 | 27 | ) |
27 | 28 | from fury.ui import Rectangle2D, UIContext |
@@ -222,7 +223,7 @@ def test_screen_initialization_default(): |
222 | 223 | assert screen.size == (640, 480) # Default size of pygfx |
223 | 224 | assert screen.position == (0, 0) # Default position of pygfx |
224 | 225 | assert isinstance(screen.camera, PerspectiveCamera) |
225 | | - assert isinstance(screen.controller, OrbitController) |
| 226 | + assert isinstance(screen.controller, TrackballController) |
226 | 227 |
|
227 | 228 | assert ( |
228 | 229 | len(screen.scene.main_scene.children) == 3 |
@@ -522,11 +523,40 @@ def test_show_manager_with_empty_config(): |
522 | 523 | assert len(show_m.screens) == 1 |
523 | 524 |
|
524 | 525 |
|
| 526 | +def test_show_manager_with_empty_title(): |
| 527 | + """Test initialization with empty screen config.""" |
| 528 | + show_m = ShowManager(window_type="offscreen", title=None) |
| 529 | + assert show_m._title == "FURY 2.0" |
| 530 | + show_m = ShowManager(window_type="offscreen", title="") |
| 531 | + assert show_m._title == "FURY 2.0" |
| 532 | + |
| 533 | + |
525 | 534 | def test_display_default(sample_actor): |
526 | 535 | """Test the display function with default parameters.""" |
527 | 536 | with patch("fury.window.ShowManager") as mock_show_manager: |
528 | | - show([sample_actor]) |
| 537 | + show(sample_actor) |
529 | 538 | mock_show_manager.assert_called_once() |
| 539 | + kwargs = mock_show_manager.call_args.kwargs |
| 540 | + assert kwargs["window_type"] == "default" |
| 541 | + assert kwargs["title"] == "FURY 2.0" |
| 542 | + assert sample_actor in kwargs["scene"].main_scene.children |
| 543 | + mock_show_manager.return_value.start.assert_called_once_with() |
| 544 | + |
| 545 | + |
| 546 | +def test_display_accepts_iterable_actors(sample_actor): |
| 547 | + """Test the display function with a non-list iterable of actors.""" |
| 548 | + second_actor = sphere(np.array([[1, 0, 0]]), material="basic", impostor=False) |
| 549 | + actors = (item for item in (sample_actor, second_actor)) |
| 550 | + |
| 551 | + with patch("fury.window.ShowManager") as mock_show_manager: |
| 552 | + show(actors, window_type="offscreen", title="Iterable actors") |
| 553 | + |
| 554 | + kwargs = mock_show_manager.call_args.kwargs |
| 555 | + assert kwargs["window_type"] == "offscreen" |
| 556 | + assert kwargs["title"] == "Iterable actors" |
| 557 | + assert sample_actor in kwargs["scene"].main_scene.children |
| 558 | + assert second_actor in kwargs["scene"].main_scene.children |
| 559 | + mock_show_manager.return_value.start.assert_called_once_with() |
530 | 560 |
|
531 | 561 |
|
532 | 562 | def test_add_remove_ui_to_from_scene(sample_actor): |
|
0 commit comments