| 10 | // << wrap-layout-require |
| 11 | |
| 12 | export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayout> { |
| 13 | public create(): wrapLayoutModule.WrapLayout { |
| 14 | // >> wrap-layout-new |
| 15 | var wrapLayout = new wrapLayoutModule.WrapLayout(); |
| 16 | // << wrap-layout-new |
| 17 | |
| 18 | wrapLayout.width = { value: 200, unit: 'px' }; |
| 19 | wrapLayout.height = { value: 200, unit: 'px' }; |
| 20 | |
| 21 | for (let i = 0; i < 2; i++) { |
| 22 | let label = new Label(); |
| 23 | label.text = '' + i; |
| 24 | |
| 25 | label.width = { value: 100, unit: 'px' }; |
| 26 | label.height = { value: 100, unit: 'px' }; |
| 27 | wrapLayout.addChild(label); |
| 28 | } |
| 29 | |
| 30 | return wrapLayout; |
| 31 | } |
| 32 | |
| 33 | public test_StackLayout_recycling() { |
| 34 | helper.nativeView_recycling_test(() => new wrapLayoutModule.WrapLayout()); |
| 35 | } |
| 36 | |
| 37 | public testItemWidhtItemHeight() { |
| 38 | let wrap = this.testView; |
| 39 | wrap.removeChildren(); |
| 40 | |
| 41 | wrap.itemWidth = { value: 40, unit: 'px' }; |
| 42 | wrap.itemHeight = { value: 40, unit: 'px' }; |
| 43 | |
| 44 | let lbl1 = new layoutHelper.MyButton(); |
| 45 | lbl1.text = '1'; |
| 46 | wrap.addChild(lbl1); |
| 47 | |
| 48 | let lbl2 = new layoutHelper.MyButton(); |
| 49 | lbl2.text = '2'; |
| 50 | lbl2.width = { value: 80, unit: 'px' }; |
| 51 | lbl2.height = { value: 80, unit: 'px' }; |
| 52 | wrap.addChild(lbl2); |
| 53 | |
| 54 | this.waitUntilTestElementLayoutIsValid(); |
| 55 | |
| 56 | TKUnit.assertEqual(lbl1.measureWidth, 40, 'lbl1.measureWidth'); |
| 57 | TKUnit.assertEqual(lbl1.measureHeight, 40, 'lbl1.measureHeight'); |
| 58 | TKUnit.assertEqual(lbl1.layoutWidth, 40, 'lbl1.layoutWidth'); |
| 59 | TKUnit.assertEqual(lbl1.layoutHeight, 40, 'lbl1.layoutHeight'); |
| 60 | |
| 61 | TKUnit.assertEqual(lbl2.measureWidth, 40, 'lbl2.measureWidth'); |
| 62 | TKUnit.assertEqual(lbl2.measureHeight, 40, 'lbl2.measureHeight'); |
| 63 | TKUnit.assertEqual(lbl2.layoutWidth, 40, 'lbl2.layoutWidth'); |
| 64 | TKUnit.assertEqual(lbl2.layoutHeight, 40, 'lbl2.layoutHeight'); |
| 65 | } |
| 66 | |
| 67 | public testPaddingReduceAvailableSize() { |
| 68 | let wrap = this.testView; |
| 69 | wrap.removeChildren(); |
nothing calls this directly
no outgoing calls
no test coverage detected