diff --git a/apps/app/ui-tests-app/flexbox/flexbox.css b/apps/app/ui-tests-app/flexbox/flexbox.css new file mode 100644 index 000000000..0be39be0f --- /dev/null +++ b/apps/app/ui-tests-app/flexbox/flexbox.css @@ -0,0 +1,28 @@ +@keyframes select { + 0%, 100% { + transform: scale(1, 1); + } + 50% { + transform: scale(1.4, 1.4); + } +} +#container>Label { + border-width: 1; + border-color: black; + border-radius: 5; +} +#container>Label[selected="yes"] { + border-color: yellow; + /* animation-name: select; + animation-duration: 0.2s; + animation-fill-mode: forwards; + animation-iteration-count: 1;*/ +} + +.control { + font-size: 11; +} +.control Button { + padding: 2; + margin: 2; +} \ No newline at end of file diff --git a/apps/app/ui-tests-app/flexbox/flexbox.ts b/apps/app/ui-tests-app/flexbox/flexbox.ts new file mode 100644 index 000000000..592b855dd --- /dev/null +++ b/apps/app/ui-tests-app/flexbox/flexbox.ts @@ -0,0 +1,55 @@ +import {isAndroid} from "platform"; +import * as flexbox from "ui/layouts/flexbox-layout"; + +function set(what: string) { + return function(args) { + args.object.page.getViewById("container")[what] = args.object.text; + } +} + +export const flexDirection = set("flexDirection"); +export const flexWrap = set("flexWrap"); +export const justifyContent = set("justifyContent"); +export const alignItems = set("alignItems"); +export const alignContent = set("alignContent"); + +let lastSelection = null; +export function select(args) { + console.log("Select: " + args.object); + lastSelection = args.object; + + if (isAndroid) { + let layoutParams = lastSelection.android.getLayoutParams(); + console.log("Selection: " + lastSelection + ": " + layoutParams); + console.log(" - margin: " + layoutParams.topMargin + " " + layoutParams.rightMargin + " " + layoutParams.bottomMargin + " " + layoutParams.leftMargin); + } +} + +export function order({object}) { + if (!lastSelection) { + return; + } + let value = object.text; + console.log("Set order " + value + " " + lastSelection); + flexbox.FlexboxLayout.setOrder(lastSelection, object.text); +} + +export function flexGrow({object}) { + if (!lastSelection) { + return; + } + let value = object.text; + console.log("Set flexGrow " + value + " " + lastSelection); + flexbox.FlexboxLayout.setFlexGrow(lastSelection, object.text); +} + +export function flexShrink({object}) { + if (!lastSelection) { + return; + } + let value = object.text; + console.log("Set flexShrink " + value + " " + lastSelection); + flexbox.FlexboxLayout.setFlexShrink(lastSelection, object.text); +} + +// TODO: Align self \ No newline at end of file diff --git a/apps/app/ui-tests-app/flexbox/flexbox.xml b/apps/app/ui-tests-app/flexbox/flexbox.xml new file mode 100644 index 000000000..407a04343 --- /dev/null +++ b/apps/app/ui-tests-app/flexbox/flexbox.xml @@ -0,0 +1,119 @@ + + + +