Merge pull request #12923 from ZhangMenghe/ModifytestCase

Modify testCase for UITextFieldTest
This commit is contained in:
pandamicro 2015-07-21 12:53:26 +08:00
commit d478c5f8a8
1 changed files with 7 additions and 2 deletions

View File

@ -29,9 +29,15 @@ var UITextFieldTest = UIScene.extend({
var widgetSize = this._widget.getContentSize(); var widgetSize = this._widget.getContentSize();
//init text //init text
this._topDisplayLabel.setString("No Event"); this._topDisplayLabel.setString("No Event");
this._topDisplayLabel.setAnchorPoint(cc.vertex2(0.5, -1));
this._topDisplayLabel.setPosition(cc.vertex2(widgetSize.width / 2.0, widgetSize.height / 2.0 + this._topDisplayLabel.getContentSize().height * 1.5));
this._bottomDisplayLabel.setString("TextField"); this._bottomDisplayLabel.setString("TextField");
this._bottomDisplayLabel.setPosition(cc.vertex2(widgetSize.width / 2.0, widgetSize.height / 2.0 - this._bottomDisplayLabel.getContentSize().height * 3.4));
this._bottomDisplayLabel.setColor(cc.color(255, 255, 255, 255));
// Create the textfield // Create the textfield
cc.director.getOpenGLView().setIMEKeyboardState(true);
var textField = new ccui.TextField("PlaceHolder", "Marker Felt", 30); var textField = new ccui.TextField("PlaceHolder", "Marker Felt", 30);
textField.x = widgetSize.width / 2.0; textField.x = widgetSize.width / 2.0;
textField.y = widgetSize.height / 2.0; textField.y = widgetSize.height / 2.0;
@ -48,7 +54,7 @@ var UITextFieldTest = UIScene.extend({
case ccui.TextField.EVENT_ATTACH_WITH_IME: case ccui.TextField.EVENT_ATTACH_WITH_IME:
var widgetSize = this._widget.getContentSize(); var widgetSize = this._widget.getContentSize();
textField.runAction(cc.moveTo(0.225, textField.runAction(cc.moveTo(0.225,
cc.p(widgetSize.width / 2, widgetSize.height / 2 + textField.height / 2))); cc.p(widgetSize.width / 2, widgetSize.height / 2 + 30)));
this._topDisplayLabel.setString("attach with IME"); this._topDisplayLabel.setString("attach with IME");
break; break;
case ccui.TextField.EVENT_DETACH_WITH_IME: case ccui.TextField.EVENT_DETACH_WITH_IME:
@ -65,7 +71,6 @@ var UITextFieldTest = UIScene.extend({
default: default:
break; break;
} }
this._bottomDisplayLabel.setString(textField.getString());
} }
}); });