| 15 | // << dock-layout-others |
| 16 | |
| 17 | export class DockLayoutTest extends testModule.UITest<DockLayout> { |
| 18 | public create(): DockLayout { |
| 19 | let rootLayout = new DockLayout(); |
| 20 | rootLayout.height = { value: 300, unit: 'px' }; |
| 21 | rootLayout.width = { value: 300, unit: 'px' }; |
| 22 | |
| 23 | return rootLayout; |
| 24 | } |
| 25 | |
| 26 | public test_recycling() { |
| 27 | testHelper.nativeView_recycling_test(() => new DockLayout()); |
| 28 | } |
| 29 | |
| 30 | public test_item_recycling() { |
| 31 | testHelper.nativeView_recycling_test( |
| 32 | () => new button.Button(), |
| 33 | () => new DockLayout() |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | public test_stretchLastChild_DefaultValue() { |
| 38 | TKUnit.assertEqual(this.testView.stretchLastChild, true, 'Default stretchLastChild.'); |
| 39 | } |
| 40 | |
| 41 | public test_dock_DefaultValue() { |
| 42 | var testBtn = new button.Button(); |
| 43 | var value = dockModule.DockLayout.getDock(testBtn); |
| 44 | TKUnit.assertEqual(value, CoreTypes.Dock.left, 'Default dock value.'); |
| 45 | } |
| 46 | |
| 47 | public test_setInvalidDock_Throws() { |
| 48 | var testBtn = new button.Button(); |
| 49 | |
| 50 | TKUnit.assertThrows(() => { |
| 51 | dockModule.DockLayout.setDock(testBtn, <'left'>'invalid'); |
| 52 | }); |
| 53 | } |
| 54 | |
| 55 | public test_dock_left() { |
| 56 | var testBtn = new helper.MyButton(); |
| 57 | testBtn.width = { value: 20, unit: 'px' }; |
| 58 | this.testView.stretchLastChild = false; |
| 59 | this.testView.addChild(testBtn); |
| 60 | |
| 61 | this.waitUntilTestElementLayoutIsValid(); |
| 62 | |
| 63 | helper.assertLayout(testBtn, 0, 0, 20, 300); |
| 64 | } |
| 65 | |
| 66 | public test_dock_right() { |
| 67 | var testBtn = new helper.MyButton(); |
| 68 | testBtn.width = { value: 20, unit: 'px' }; |
| 69 | dockModule.DockLayout.setDock(testBtn, 'right'); |
| 70 | this.testView.stretchLastChild = false; |
| 71 | this.testView.addChild(testBtn); |
| 72 | |
| 73 | this.waitUntilTestElementLayoutIsValid(); |
| 74 |
nothing calls this directly
no outgoing calls
no test coverage detected