From 32e9f9eb15e3cfc99f5b5b1ccf98d921b7c74199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B5=D1=81=D1=88=D0=B0=D0=BF=D0=BE=D1=88=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Mon, 11 Apr 2016 13:44:25 +0300 Subject: [PATCH] Add js-tests for page view indicator tune. --- .../GUITest/UIPageViewTest/UIPageViewTest.js | 56 +++++++++++++++++++ tests/js-tests/src/GUITest/UISceneManager.js | 6 ++ 2 files changed, 62 insertions(+) diff --git a/tests/js-tests/src/GUITest/UIPageViewTest/UIPageViewTest.js b/tests/js-tests/src/GUITest/UIPageViewTest/UIPageViewTest.js index d29d5a8ccd..d87eae89e9 100644 --- a/tests/js-tests/src/GUITest/UIPageViewTest/UIPageViewTest.js +++ b/tests/js-tests/src/GUITest/UIPageViewTest/UIPageViewTest.js @@ -732,3 +732,59 @@ var UIPageViewChildSizeTest = UIMainLayer.extend({ } } }); + +var UIPageViewIndicatorTest = UIMainLayer.extend({ + init: function () { + if(this._super()){ + var widgetSize = this._widget.getContentSize(); + + this._topDisplayLabel.setString("PageView indidcator custom texture\nscale : 0.5, index color: RED"); + this._topDisplayLabel.setFontSize(14); + this._topDisplayLabel.x = widgetSize.width / 2.0; + this._topDisplayLabel.y = widgetSize.height / 2.0 + this._topDisplayLabel.height; + + this._bottomDisplayLabel.setString("PageView"); + this._bottomDisplayLabel.x = widgetSize.width / 2; + this._bottomDisplayLabel.y = widgetSize.height / 2 - this._bottomDisplayLabel.height * 3; + + var background = this._widget.getChildByName("background_Panel"); + var backgroundSize = background.getContentSize(); + + var pageView = new ccui.PageView(); + pageView.setContentSize(cc.size(240, 130)); + pageView.x = (widgetSize.width - backgroundSize.width) / 2 + (backgroundSize.width - pageView.width) / 2; + pageView.y = (widgetSize.height - backgroundSize.height) / 2 + (backgroundSize.height - pageView.height) / 2; + pageView.removeAllPages(); + + pageView.setIndicatorEnabled(true); + pageView.setIndicatorSpaceBetweenIndexNodes(5); + pageView.setIndicatorIndexNodesScale(0.5); + pageView.setIndicatorIndexNodesTexture("ccs-res/cocosui/green_edit.png"); + pageView.setIndicatorIndexNodesColor(cc.color.RED); + + var pageCount = 4; + for(var i = 0; i < pageCount; i++){ + var layout = new ccui.Layout(); + layout.setContentSize(cc.size(240, 130)); + + var imageView = new ccui.ImageView(); + imageView.setScale9Enabled(true); + imageView.loadTexture("ccs-res/cocosui/scrollviewbg.png"); + imageView.setContentSize(cc.size(240, 130)); + imageView.x = layout.getContentSize().width / 2; + imageView.y = layout.getContentSize().height / 2; + layout.addChild(imageView); + var pageNumber = i+1; + var label = new ccui.Text("page" + pageNumber, "Marker Felt",30); + label.setColor(cc.color(192, 192, 192)); + label.setPosition(cc.p(layout.getContentSize().width / 2, layout.getContentSize().height / 2)); + layout.addChild(label); + + pageView.insertPage(layout, i); + } + this._mainNode.addChild(pageView); + return true; + } + return false; + } +}); diff --git a/tests/js-tests/src/GUITest/UISceneManager.js b/tests/js-tests/src/GUITest/UISceneManager.js index 18b0cd4d04..d1aa7feffd 100644 --- a/tests/js-tests/src/GUITest/UISceneManager.js +++ b/tests/js-tests/src/GUITest/UISceneManager.js @@ -533,6 +533,12 @@ func: function () { return new UIPageViewChildSizeTest(); } + }, + { + title: "UIPageViewIndicatorTest", + func: function () { + return new UIPageViewIndicatorTest(); + } } ], "UIListView": [