| 38 | |
| 39 | # Basic view creation and MainWindow events |
| 40 | def test_1 |
| 41 | |
| 42 | if !RBA.constants.member?(:Application) |
| 43 | return |
| 44 | end |
| 45 | |
| 46 | app = RBA::Application.instance |
| 47 | mw = app.main_window |
| 48 | mw.close_all |
| 49 | |
| 50 | created = 0 |
| 51 | created_proc = proc { created += 1 } |
| 52 | current_view_changed = 0 |
| 53 | current_view_changed_proc = proc { current_view_changed += 1 } |
| 54 | closed = 0 |
| 55 | closed_proc = proc { closed += 1 } |
| 56 | mw.on_view_created += created_proc |
| 57 | mw.on_current_view_changed += current_view_changed_proc |
| 58 | mw.on_view_closed += closed_proc |
| 59 | |
| 60 | cv1 = mw.create_layout(1) |
| 61 | assert_equal(RBA::LayoutView::current.index, 0) |
| 62 | assert_equal(RBA::LayoutView::current.active_cellview_index, 0) |
| 63 | assert_equal(RBA::LayoutView::current.active_cellview.index, 0) |
| 64 | assert_equal(RBA::CellView::active.index, 0) |
| 65 | assert_equal(RBA::CellView::active.view.index, 0) |
| 66 | assert_equal(cv1.index, 0) |
| 67 | assert_equal(cv1.view.index, 0) |
| 68 | |
| 69 | assert_equal(created, 1) |
| 70 | assert_equal(current_view_changed, 1) |
| 71 | assert_equal(closed, 0) |
| 72 | |
| 73 | cv2 = mw.create_layout(2) |
| 74 | assert_equal(RBA::LayoutView::current.index, 0) |
| 75 | assert_equal(RBA::LayoutView::current.active_cellview_index, 1) |
| 76 | assert_equal(RBA::LayoutView::current.active_cellview.index, 1) |
| 77 | assert_equal(RBA::CellView::active.index, 1) |
| 78 | assert_equal(RBA::CellView::active.view.index, 0) |
| 79 | assert_equal(cv2.index, 1) |
| 80 | assert_equal(cv2.view.index, 0) |
| 81 | |
| 82 | assert_equal(created, 1) |
| 83 | assert_equal(current_view_changed, 1) |
| 84 | assert_equal(closed, 0) |
| 85 | |
| 86 | cv3 = mw.create_layout(1) |
| 87 | assert_equal(RBA::LayoutView::current.index, 1) |
| 88 | assert_equal(RBA::LayoutView::current.main_window.view(1).index, 1) |
| 89 | assert_equal(RBA::LayoutView::current.active_cellview_index, 0) |
| 90 | assert_equal(RBA::LayoutView::current.active_cellview.index, 0) |
| 91 | assert_equal(RBA::CellView::active.index, 0) |
| 92 | assert_equal(RBA::CellView::active.view.index, 1) |
| 93 | assert_equal(cv3.index, 0) |
| 94 | assert_equal(cv3.view.index, 1) |
| 95 | |
| 96 | assert_equal(mw.current_view_index, 1) |
| 97 | assert_equal(created, 2) |
nothing calls this directly
no test coverage detected