mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixed failing tests and added page for ui-tests
This commit is contained in:
@@ -214,6 +214,9 @@
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\layouts\myview.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\layouts\stack.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\layouts\wrap.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\background.ts">
|
||||
<DependentUpon>background.xml</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\console.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\i61.ts" />
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\i73.ts" />
|
||||
@@ -673,6 +676,7 @@
|
||||
<Content Include="apps\tests\pages\fonts-test.xml" />
|
||||
<Content Include="apps\tests\pages\background-test.xml" />
|
||||
<Content Include="apps\tests\pages\page18.xml" />
|
||||
<Content Include="apps\tests\pages\test2.png" />
|
||||
<Content Include="apps\tests\ui\bindingContext_testPage.xml" />
|
||||
<Content Include="apps\tests\ui\bindingContext_testPage1.xml" />
|
||||
<Content Include="apps\tests\ui\bindingContext_testPage2.xml" />
|
||||
@@ -700,6 +704,7 @@
|
||||
<Content Include="apps\ui-tests-app\layouts\grid.xml" />
|
||||
<Content Include="apps\ui-tests-app\layouts\stack.xml" />
|
||||
<Content Include="apps\ui-tests-app\layouts\wrap.xml" />
|
||||
<Content Include="apps\ui-tests-app\pages\background.xml" />
|
||||
<Content Include="apps\ui-tests-app\pages\circle.xml" />
|
||||
<Content Include="apps\ui-tests-app\pages\i86.xml" />
|
||||
<Content Include="apps\template-blank\app.css" />
|
||||
@@ -709,6 +714,7 @@
|
||||
<Content Include="apps\ui-tests-app\modal-view\login-page.xml" />
|
||||
<Content Include="apps\ui-tests-app\modal-view\modal-view.xml" />
|
||||
<Resource Include="apps\ui-tests-app\pages\red.png" />
|
||||
<Content Include="apps\ui-tests-app\pages\test2.png" />
|
||||
<Content Include="apps\ui-tests-app\pages\textfield.xml" />
|
||||
<Content Include="apps\ui-tests-app\pages\text\text-field.xml" />
|
||||
<Content Include="apps\ui-tests-app\pages\text\text-view.xml" />
|
||||
@@ -1669,7 +1675,7 @@
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<UserProperties ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2linear-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
<UserProperties ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2linear-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -2,6 +2,7 @@
|
||||
import colorModule = require("color");
|
||||
import utilsModule = require("utils/utils");
|
||||
import enums = require("ui/enums");
|
||||
import background = require("ui/styling/background");
|
||||
|
||||
export function getNativeText(button: buttonModule.Button): string {
|
||||
return button.android.getText();
|
||||
@@ -17,7 +18,14 @@ export function getNativeColor(button: buttonModule.Button): colorModule.Color {
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(button: buttonModule.Button): colorModule.Color {
|
||||
return new colorModule.Color((<any>button.android.getBackground()).backgroundColor);
|
||||
var bkg = <any>button.android.getBackground();
|
||||
var color;
|
||||
if (bkg instanceof background.ad.BorderDrawable) {
|
||||
return (<background.ad.BorderDrawable>bkg).background.color;
|
||||
}
|
||||
else {
|
||||
return new colorModule.Color(bkg.backgroundColor)
|
||||
}
|
||||
}
|
||||
|
||||
export function getNativeTextAlignment(button: buttonModule.Button): string {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import colorModule = require("color");
|
||||
import utilsModule = require("utils/utils");
|
||||
import enums = require("ui/enums");
|
||||
import background = require("ui/styling/background");
|
||||
|
||||
export function getNativeText(textField: textFieldModule.TextField): string {
|
||||
return textField.android.getText().toString();
|
||||
@@ -26,7 +27,14 @@ export function getNativeColor(textField: textFieldModule.TextField): colorModul
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(textField: textFieldModule.TextField): colorModule.Color {
|
||||
return new colorModule.Color((<any>textField.android.getBackground()).backgroundColor);
|
||||
var bkg = <any>textField.android.getBackground();
|
||||
var color;
|
||||
if (bkg instanceof background.ad.BorderDrawable) {
|
||||
return (<background.ad.BorderDrawable>bkg).background.color;
|
||||
}
|
||||
else {
|
||||
return new colorModule.Color(bkg.backgroundColor)
|
||||
}
|
||||
}
|
||||
|
||||
export function getNativeTextAlignment(textField: textFieldModule.TextField): string {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import colorModule = require("color");
|
||||
import utilsModule = require("utils/utils");
|
||||
import enums = require("ui/enums");
|
||||
import background = require("ui/styling/background");
|
||||
|
||||
export function getNativeText(textView: textViewModule.TextView): string {
|
||||
return textView.android.getText().toString();
|
||||
@@ -30,7 +31,14 @@ export function getNativeColor(textView: textViewModule.TextView): colorModule.C
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(textView: textViewModule.TextView): colorModule.Color {
|
||||
return new colorModule.Color((<any>textView.android.getBackground()).backgroundColor);
|
||||
var bkg = <any>textView.android.getBackground();
|
||||
var color;
|
||||
if (bkg instanceof background.ad.BorderDrawable) {
|
||||
return (<background.ad.BorderDrawable>bkg).background.color;
|
||||
}
|
||||
else {
|
||||
return new colorModule.Color(bkg.backgroundColor)
|
||||
}
|
||||
}
|
||||
|
||||
export function getNativeTextAlignment(textView: textViewModule.TextView): string {
|
||||
|
||||
10
apps/ui-tests-app/pages/background.ts
Normal file
10
apps/ui-tests-app/pages/background.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import view = require("ui/core/view");
|
||||
export function applyTap(args) {
|
||||
var el = view.getViewById(view.getAncestor(args.object, "Page"), "test-element");
|
||||
(<any>el).style = args.object.tag;
|
||||
}
|
||||
|
||||
export function resetTap(args) {
|
||||
var el = view.getViewById(view.getAncestor(args.object, "Page"), "test-element");
|
||||
(<any>el).style = "";
|
||||
}
|
||||
37
apps/ui-tests-app/pages/background.xml
Normal file
37
apps/ui-tests-app/pages/background.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<Page loaded="pageLoaded">
|
||||
<GridLayout rows="auto,*">
|
||||
<WrapLayout>
|
||||
<!-- Background and Border -->
|
||||
<Button width="50" height="50" text="r" tap="resetTap"/>
|
||||
<Button width="50" height="50" text="1" tap="applyTap" tag="margin: 20; background-color: lightgreen;"/>
|
||||
<Button width="50" height="50" text="2.1" tap="applyTap" tag="margin: 20; background-color: lightgreen; border-color: lightpink; border-radius: 20; border-width: 40;"/>
|
||||
<Button width="50" height="50" text="2.2" tap="applyTap" tag="margin: 20; background-color: lightgreen; border-color: lightpink; border-radius: 40; border-width: 40;"/>
|
||||
<Button width="50" height="50" text="2.3" tap="applyTap" tag="margin: 20; background-color: lightgreen; border-color: lightpink; border-radius: 40; border-width: 20;"/>
|
||||
|
||||
<!-- Repeat -->
|
||||
<Button width="50" height="50" text="3.1" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png');"/>
|
||||
<Button width="50" height="50" text="3.2" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:repeat-y;"/>
|
||||
<Button width="50" height="50" text="3.3" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:repeat-x;"/>
|
||||
|
||||
<!-- Position -->
|
||||
<Button width="50" height="50" text="4.1" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:no-repeat;"/>
|
||||
<Button width="50" height="50" text="4.2" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: left top;"/>
|
||||
<Button width="50" height="50" text="4.3" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: center center;"/>
|
||||
<Button width="50" height="50" text="4.4" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: right bottom;"/>
|
||||
<Button width="50" height="50" text="4.5" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: 20% 80%;"/>
|
||||
|
||||
<!-- Size -->
|
||||
<Button width="50" height="50" text="5.1" tap="applyTap" tag="margin: 20; background-color: lightgreen; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: center center; background-size: 100 100;"/>
|
||||
<Button width="50" height="50" text="5.2" tap="applyTap" tag="margin: 20; background-color: lightgreen; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: center center; background-size: 100% 100%;"/>
|
||||
<Button width="50" height="50" text="5.3" tap="applyTap" tag="margin: 20; background-color: lightgreen; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: center center; background-size: cover;"/>
|
||||
<Button width="50" height="50" text="5.4" tap="applyTap" tag="margin: 20; background-color: lightgreen; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: center center; background-size: contain;"/>
|
||||
<Button width="50" height="50" text="5.5" tap="applyTap" tag="margin: 20; background-color: lightgreen; background-image: url('~/pages/test2.png'); background-repeat:no-repeat; background-position: center center; background-size: 100 100; background-color: lightgreen;"/>
|
||||
|
||||
<!-- All -->
|
||||
<Button width="50" height="50" text="6" tap="applyTap" tag="margin: 20; background-image: url('~/pages/test2.png'); background-repeat:repeat-x; background-position: 20% 80%; background-color: lightgreen; background-size: 25% 50%; border-radius: 20; border-width: 4; border-color: lightpink;"/>
|
||||
</WrapLayout>
|
||||
|
||||
<GridLayout id="test-element" row="1">
|
||||
</GridLayout>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
BIN
apps/ui-tests-app/pages/test2.png
Normal file
BIN
apps/ui-tests-app/pages/test2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 311 B |
@@ -61,8 +61,6 @@ export module ad {
|
||||
}
|
||||
|
||||
public draw(canvas: android.graphics.Canvas): void {
|
||||
//super.draw(canvas);
|
||||
console.log("BorderDrawable.draw()");
|
||||
var bounds = this.getBounds();
|
||||
var boundsF = new android.graphics.RectF(bounds);
|
||||
var boundsWidth = bounds.width();
|
||||
|
||||
Reference in New Issue
Block a user