mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 07:02:25 +00:00
!16124 图形native测试用例编码整改and用例更新
Merge pull request !16124 from HaoXinyu/mybranch
This commit is contained in:
commit
1788ac636b
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/adapter/android
|
||||
/adapter/ios
|
||||
/.vscode
|
||||
|
@ -25,8 +25,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ContentEffectNodeTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -76,7 +76,7 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Alpha_Test_1)
|
||||
|
||||
// set background image alpha
|
||||
const std::string imgPath = "/data/local/tmp/appearance_test.jpg";
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
int x = (i % rowCount) * (nodeWidth + nodeGap);
|
||||
int y = (columnCount + columnCount) * (nodeHeight + nodeGap);
|
||||
auto testNodeBgImg = SetUpNodeBgImage(imgPath, { x, y, nodeWidth, nodeHeight });
|
||||
@ -157,7 +157,7 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Alpha_Offscreen_Te
|
||||
RegisterNode(testNodeParent);
|
||||
|
||||
auto testNodeChild = RSCanvasNode::Create();
|
||||
testNodeChild->SetBounds({ x, y, nodeSize, nodeSize });
|
||||
testNodeChild->SetBounds({ 0, 0, nodeSize, nodeSize });
|
||||
testNodeChild->SetTranslate(0, 50, 0); // Set Y-Position to 50
|
||||
testNodeChild->SetAlpha(0.2); // Set alpha to 0.2
|
||||
testNodeChild->SetBackgroundColor(colorList[i]);
|
||||
@ -180,7 +180,7 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Alpha_Offscreen_Te
|
||||
RegisterNode(testNodeParent);
|
||||
|
||||
auto testNodeChild = RSCanvasNode::Create();
|
||||
testNodeChild->SetBounds({ x, y, nodeSize, nodeSize });
|
||||
testNodeChild->SetBounds({ 0, 0, nodeSize, nodeSize });
|
||||
testNodeChild->SetTranslate(0, 50, 0); // Set Y-Position to 50
|
||||
testNodeChild->SetAlpha(0.2); // Set alpha = 0.2
|
||||
testNodeChild->SetBackgroundColor(colorList[i]);
|
||||
|
@ -93,7 +93,7 @@ GRAPHIC_TEST(AppearanceTest01, CONTENT_DISPLAY_TEST, Appearance_Border_Radius_Co
|
||||
|
||||
// four different color
|
||||
auto testNodeFourColor = RSCanvasNode::Create();
|
||||
setNode(testNodeFourColor, { 0, nodeSize * 3, nodeSize, nodeSize },
|
||||
setNode(testNodeFourColor, { 0, nodePos * 3, nodeSize, nodeSize },
|
||||
Vector4<Color>(colorList[0], colorList[1], colorList[2], colorList[3]));
|
||||
GetRootNode()->AddChild(testNodeFourColor);
|
||||
RegisterNode(testNodeFourColor);
|
||||
|
@ -297,8 +297,8 @@ GRAPHIC_TEST(AppearanceTest02, CONTENT_DISPLAY_TEST, Appearance_Border_Touch_Tes
|
||||
testNode2->SetTranslate(xList[i], yList[i], 0);
|
||||
testNode2->SetBackgroundColor(0xff000000);
|
||||
testNode2->SetBorderStyle(styleList[i], styleList[i], styleList[i], styleList[i]);
|
||||
testNode1->SetBorderDashGap({ dashGap, dashGap, dashGap, dashGap });
|
||||
testNode1->SetBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth);
|
||||
testNode2->SetBorderDashGap({ dashGap, dashGap, dashGap, dashGap });
|
||||
testNode2->SetBorderWidth(borderWidth, borderWidth, borderWidth, borderWidth);
|
||||
testNode2->SetBorderColor(0xff0000ff, 0xff0000ff, 0xff0000ff, 0xff0000ff);
|
||||
GetRootNode()->AddChild(testNode2);
|
||||
RegisterNode(testNode2);
|
||||
|
@ -24,8 +24,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -37,33 +37,38 @@ public:
|
||||
|
||||
GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, ClipRRect_Test_1)
|
||||
{
|
||||
Vector4f rect[] = {
|
||||
const Vector4f rect[] = {
|
||||
{ 0.0, 0.0, 250.0, 250.0 },
|
||||
{ 100.0, 100.0, 450.0, 450.0 },
|
||||
{ 100.0, 100.0, 200.0, 200.0 },
|
||||
};
|
||||
Vector4f radius[] = {
|
||||
const Vector4f radius[] = {
|
||||
{ 100.0, 100.0, 100.0, 100.0 },
|
||||
{ 250.0, 250.0, 250.0, 250.0 },
|
||||
{ 500.0, 500.0, 500.0, 500.0 },
|
||||
};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
const int counts = 3;
|
||||
for (int i = 0; i < counts; i++) {
|
||||
for (int j = 0; j < counts; j++) {
|
||||
Vector4f bounds = { i * 410.0, j * 500.0, 400.0, 400.0 };
|
||||
const int nodeSize = 400;
|
||||
const int fontSize = 50;
|
||||
|
||||
auto testFaNode = RSCanvasNode::Create();
|
||||
testFaNode->SetBounds({ i * 410.0, j * 500.0, 400.0, 400.0 });
|
||||
testFaNode->SetFrame({ i * 410.0, j * 500.0, 400.0, 400.0 });
|
||||
testFaNode->SetBounds(bounds);
|
||||
testFaNode->SetFrame(bounds);
|
||||
auto imageModifier = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier->SetWidth(400);
|
||||
imageModifier->SetHeight(400);
|
||||
imageModifier->SetWidth(nodeSize);
|
||||
imageModifier->SetHeight(nodeSize);
|
||||
imageModifier->SetPixelMapPath("/data/local/tmp/fg_test.jpg");
|
||||
testFaNode->AddModifier(imageModifier);
|
||||
auto textModifier = std::make_shared<TextCustomModifier>();
|
||||
textModifier->SetText("TestText");
|
||||
textModifier->SetFontSize(50.0);
|
||||
textModifier->SetFontSize(fontSize);
|
||||
testFaNode->AddModifier(textModifier);
|
||||
testFaNode->SetClipToBounds(true);
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0.0, 50.0, 400.0, 400.0 });
|
||||
testNode->SetBounds({ 0.0, fontSize, nodeSize, nodeSize });
|
||||
testNode->SetBackgroundColor(0xff00ff00);
|
||||
testFaNode->AddChild(testNode);
|
||||
testFaNode->SetClipRRect(rect[i], radius[j]);
|
||||
@ -76,28 +81,33 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, ClipRRect_Test_1)
|
||||
|
||||
GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, ClipRRect_Test_2)
|
||||
{
|
||||
Vector4f rect[] = {
|
||||
const Vector4f rect[] = {
|
||||
{ 0.0, 0.0, 250.0, 250.0 },
|
||||
{ 100.0, 100.0, 450.0, 450.0 },
|
||||
{ 100.0, 100.0, 200.0, 200.0 },
|
||||
};
|
||||
Vector4f radius[] = {
|
||||
const Vector4f radius[] = {
|
||||
{ 100.0, 100.0, 100.0, 100.0 },
|
||||
{ 250.0, 250.0, 250.0, 250.0 },
|
||||
{ 500.0, 500.0, 500.0, 500.0 },
|
||||
};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
const int counts = 3;
|
||||
for (int i = 0; i < counts; i++) {
|
||||
for (int j = 0; j < counts; j++) {
|
||||
Vector4f bounds = { i * 410.0, j * 500.0, 400.0, 400.0 };
|
||||
const int nodeSize = 400;
|
||||
const int nodePosY = 50;
|
||||
|
||||
auto testFaNode = RSCanvasNode::Create();
|
||||
testFaNode->SetBounds({ i * 410.0, j * 500.0, 400.0, 400.0 });
|
||||
testFaNode->SetBounds(bounds);
|
||||
auto imageModifier = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier->SetWidth(400);
|
||||
imageModifier->SetHeight(400);
|
||||
imageModifier->SetWidth(nodeSize);
|
||||
imageModifier->SetHeight(nodeSize);
|
||||
imageModifier->SetPixelMapPath("/data/local/tmp/fg_test.jpg");
|
||||
testFaNode->AddModifier(imageModifier);
|
||||
testFaNode->SetClipToBounds(false);
|
||||
auto testNode = RSCanvasNode::Create();
|
||||
testNode->SetBounds({ 0.0, 50.0, 400.0, 400.0 });
|
||||
testNode->SetBounds({ 0.0, nodePosY, nodeSize, nodeSize });
|
||||
testNode->SetBackgroundColor(0xff00ff00);
|
||||
testFaNode->AddChild(testNode);
|
||||
testFaNode->SetClipRRect(rect[i], radius[j]);
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest03 : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -54,37 +54,44 @@ GRAPHIC_TEST(AppearanceTest03, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Ra
|
||||
{
|
||||
Color colorList[] = { Color(0, 0, 0), Color(255, 0, 0), Color(0, 255, 0), Color(0, 0, 255) };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
const int nodeCount = 4;
|
||||
const int columnCount = 2;
|
||||
const int nodeSize = 500;
|
||||
const int nodeHalfSize = 250;
|
||||
const int nodePos = 520;
|
||||
|
||||
for (int i = 0; i < nodeCount; i++) {
|
||||
int x = (i % columnCount) * nodePos;
|
||||
int y = (i / columnCount) * nodePos;
|
||||
auto testNodeColor = RSCanvasNode::Create();
|
||||
setNode(testNodeColor, { x, y, 500, 500 }, Vector4<Color>(colorList[i]));
|
||||
setNode(testNodeColor, { x, y, nodeSize, nodeSize }, Vector4<Color>(colorList[i]));
|
||||
GetRootNode()->AddChild(testNodeColor);
|
||||
RegisterNode(testNodeColor);
|
||||
}
|
||||
|
||||
// parent black, child red color, white border
|
||||
auto testNodeParent = RSCanvasNode::Create();
|
||||
setNode(testNodeParent, { 0, 520 * 2, 500, 500 }, Vector4<Color>(colorList[0]));
|
||||
setNode(testNodeParent, { 0, nodePos * 2, nodeSize, nodeSize }, Vector4<Color>(colorList[0]));
|
||||
testNodeParent->SetBackgroundColor(0xff000000);
|
||||
GetRootNode()->AddChild(testNodeParent);
|
||||
RegisterNode(testNodeParent);
|
||||
|
||||
const int testPos = 50;
|
||||
auto testNodeChild = RSCanvasNode::Create();
|
||||
setNode(testNodeChild, { 50, 50, 250, 250 }, Vector4<Color>(Color(0xffffffff)));
|
||||
setNode(testNodeChild, { testPos, testPos, nodeHalfSize, nodeHalfSize }, Vector4<Color>(Color(0xffffffff)));
|
||||
testNodeChild->SetForegroundColor(0xffff0000);
|
||||
testNodeParent->AddChild(testNodeChild);
|
||||
RegisterNode(testNodeChild);
|
||||
|
||||
// alpha border
|
||||
auto testNodeAlphaColor = RSCanvasNode::Create();
|
||||
setNode(testNodeAlphaColor, { 520, 520 * 2, 500, 500 }, Vector4<Color>(Color(0x7dffffff)));
|
||||
setNode(testNodeAlphaColor, { nodePos, nodePos * 2, nodeSize, nodeSize }, Vector4<Color>(Color(0x7dffffff)));
|
||||
GetRootNode()->AddChild(testNodeAlphaColor);
|
||||
RegisterNode(testNodeAlphaColor);
|
||||
|
||||
// four different color
|
||||
auto testNodeFourColor = RSCanvasNode::Create();
|
||||
setNode(testNodeFourColor, { 0, 520 * 3, 500, 500 },
|
||||
setNode(testNodeFourColor, { 0, nodePos * 3, nodeSize, nodeSize },
|
||||
Vector4<Color>(colorList[0], colorList[1], colorList[2], colorList[3]));
|
||||
GetRootNode()->AddChild(testNodeFourColor);
|
||||
RegisterNode(testNodeFourColor);
|
||||
@ -98,15 +105,23 @@ GRAPHIC_TEST(AppearanceTest03, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Ra
|
||||
Color color(0, 0, 0);
|
||||
Vector4<Color> outLineColor = { color, color, color, color };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
const int nodeCount = 3;
|
||||
const int columnCount = 2;
|
||||
const int nodeSize = 500;
|
||||
const int nodePos = 520;
|
||||
const float radiusVal = 50.0f;
|
||||
const int offsetVal = 20;
|
||||
const int offsetVal2 = 600;
|
||||
|
||||
for (int i = 0; i < nodeCount; i++) {
|
||||
int x = (i % columnCount) * nodePos;
|
||||
int y = (i / columnCount) * nodePos;
|
||||
auto testNodeWidth = RSCanvasNode::Create();
|
||||
testNodeWidth->SetBounds({ x, y, 500, 500 });
|
||||
testNodeWidth->SetTranslate(widthList[i] + 20, widthList[i] + 50, 0);
|
||||
testNodeWidth->SetBounds({ x, y, nodeSize, nodeSize });
|
||||
testNodeWidth->SetTranslate(widthList[i] + offsetVal, widthList[i] + radiusVal, 0);
|
||||
testNodeWidth->SetOutlineStyle(style);
|
||||
testNodeWidth->SetOutlineWidth({ widthList[i], widthList[i], widthList[i], widthList[i] });
|
||||
testNodeWidth->SetOutlineRadius({ 50.0, 50.0, 50.0, 50.0 });
|
||||
testNodeWidth->SetOutlineRadius({ radiusVal, radiusVal, radiusVal, radiusVal });
|
||||
testNodeWidth->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeWidth);
|
||||
RegisterNode(testNodeWidth);
|
||||
@ -114,11 +129,11 @@ GRAPHIC_TEST(AppearanceTest03, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Ra
|
||||
|
||||
// four different width
|
||||
auto testNodeFourWidth = RSCanvasNode::Create();
|
||||
testNodeFourWidth->SetBounds({ 0, 520 * 2, 500, 500 });
|
||||
testNodeFourWidth->SetTranslate(20, 600, 0);
|
||||
testNodeFourWidth->SetBounds({ 0, nodePos * 2, nodeSize, nodeSize });
|
||||
testNodeFourWidth->SetTranslate(offsetVal, offsetVal2, 0);
|
||||
testNodeFourWidth->SetOutlineStyle(style);
|
||||
testNodeFourWidth->SetOutlineWidth({ widthList[1] * 0, widthList[1] * 2, widthList[1] * 4, widthList[1] * 8 });
|
||||
testNodeFourWidth->SetOutlineRadius({ 50.0, 50.0, 50.0, 50.0 });
|
||||
testNodeFourWidth->SetOutlineRadius({ radiusVal, radiusVal, radiusVal, radiusVal });
|
||||
testNodeFourWidth->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeFourWidth);
|
||||
RegisterNode(testNodeFourWidth);
|
||||
@ -134,16 +149,24 @@ GRAPHIC_TEST(AppearanceTest03, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Ra
|
||||
Color color(0, 0, 0);
|
||||
Vector4<Color> outLineColor = { color, color, color, color };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
const int nodeCount = 4;
|
||||
const int columnCount = 2;
|
||||
const int nodeSize = 500;
|
||||
const int nodePos = 520;
|
||||
const float radiusVal = 50.0f;
|
||||
const int borderWidth = 5;
|
||||
const int tranlateVal = 20;
|
||||
|
||||
for (int i = 0; i < nodeCount; i++) {
|
||||
int x = (i % columnCount) * nodePos;
|
||||
int y = (i / columnCount) * nodePos;
|
||||
auto testNodeStyle = RSCanvasNode::Create();
|
||||
testNodeStyle->SetBounds({ x, y, 500, 500 });
|
||||
testNodeStyle->SetTranslate(20, 20, 0);
|
||||
testNodeStyle->SetBounds({ x, y, nodeSize, nodeSize });
|
||||
testNodeStyle->SetTranslate(tranlateVal, tranlateVal, 0);
|
||||
Vector4<BorderStyle> style = Vector4<BorderStyle>((BorderStyle)i);
|
||||
testNodeStyle->SetOutlineStyle(style);
|
||||
testNodeStyle->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeStyle->SetOutlineRadius({ 50.0, 50.0, 50.0, 50.0 });
|
||||
testNodeStyle->SetOutlineWidth({ borderWidth, borderWidth, borderWidth, borderWidth });
|
||||
testNodeStyle->SetOutlineRadius({ radiusVal, radiusVal, radiusVal, radiusVal });
|
||||
testNodeStyle->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeStyle);
|
||||
RegisterNode(testNodeStyle);
|
||||
@ -151,12 +174,12 @@ GRAPHIC_TEST(AppearanceTest03, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Ra
|
||||
|
||||
// four different style
|
||||
auto testNodeFourStyle = RSCanvasNode::Create();
|
||||
testNodeFourStyle->SetBounds({ 0, 520 * 2, 500, 500 });
|
||||
testNodeFourStyle->SetTranslate(20, 20, 0);
|
||||
testNodeFourStyle->SetBounds({ 0, nodePos * 2, nodeSize, nodeSize });
|
||||
testNodeFourStyle->SetTranslate(tranlateVal, tranlateVal, 0);
|
||||
Vector4<BorderStyle> style2 = Vector4<BorderStyle>((BorderStyle)0, (BorderStyle)1, (BorderStyle)2, (BorderStyle)3);
|
||||
testNodeFourStyle->SetOutlineStyle(style2);
|
||||
testNodeFourStyle->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeFourStyle->SetOutlineRadius({ 50.0, 50.0, 50.0, 50.0 });
|
||||
testNodeFourStyle->SetOutlineWidth({ borderWidth, borderWidth, borderWidth, borderWidth });
|
||||
testNodeFourStyle->SetOutlineRadius({ radiusVal, radiusVal, radiusVal, radiusVal });
|
||||
testNodeFourStyle->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeFourStyle);
|
||||
RegisterNode(testNodeFourStyle);
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "parameters_defination.h"
|
||||
#include "rs_graphic_test.h"
|
||||
|
||||
using namespace testing;
|
||||
@ -22,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest04 : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -51,37 +52,40 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Co
|
||||
{
|
||||
Color colorList[] = { Color(0, 0, 0), Color(255, 0, 0), Color(0, 255, 0), Color(0, 0, 255) };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
auto testNodeColor = RSCanvasNode::Create();
|
||||
setNode(testNodeColor, { x, y, 500, 500 }, Vector4<Color>(colorList[i]));
|
||||
setNode(testNodeColor, { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ }, Vector4<Color>(colorList[i]));
|
||||
GetRootNode()->AddChild(testNodeColor);
|
||||
RegisterNode(testNodeColor);
|
||||
}
|
||||
|
||||
// parent black, child red color, white border
|
||||
auto testNodeParent = RSCanvasNode::Create();
|
||||
setNode(testNodeParent, { 0, 520 * 2, 500, 500 }, Vector4<Color>(colorList[0]));
|
||||
setNode(
|
||||
testNodeParent, { 0, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ }, Vector4<Color>(colorList[0]));
|
||||
testNodeParent->SetBackgroundColor(0xff000000);
|
||||
GetRootNode()->AddChild(testNodeParent);
|
||||
RegisterNode(testNodeParent);
|
||||
|
||||
auto testNodeChild = RSCanvasNode::Create();
|
||||
setNode(testNodeChild, { 50, 50, 250, 250 }, Vector4<Color>(Color(0xffffffff)));
|
||||
setNode(
|
||||
testNodeChild, { FIFTY_, FIFTY_, TWO_HUNDRED_FIFTY_, TWO_HUNDRED_FIFTY_ }, Vector4<Color>(Color(0xffffffff)));
|
||||
testNodeChild->SetForegroundColor(0xffff0000);
|
||||
testNodeParent->AddChild(testNodeChild);
|
||||
RegisterNode(testNodeChild);
|
||||
|
||||
// alpha border
|
||||
auto testNodeAlphaColor = RSCanvasNode::Create();
|
||||
setNode(testNodeAlphaColor, { 520, 520 * 2, 500, 500 }, Vector4<Color>(Color(0x7dffffff)));
|
||||
setNode(testNodeAlphaColor, { FIVE_HUNDRED_TWENTY_, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ },
|
||||
Vector4<Color>(Color(0x7dffffff)));
|
||||
GetRootNode()->AddChild(testNodeAlphaColor);
|
||||
RegisterNode(testNodeAlphaColor);
|
||||
|
||||
// four different color
|
||||
auto testNodeFourColor = RSCanvasNode::Create();
|
||||
setNode(testNodeFourColor, { 0, 520 * 3, 500, 500 },
|
||||
setNode(testNodeFourColor, { 0, FIVE_HUNDRED_TWENTY_ * 3, FIVE_HUNDRED_, FIVE_HUNDRED_ },
|
||||
Vector4<Color>(colorList[0], colorList[1], colorList[2], colorList[3]));
|
||||
GetRootNode()->AddChild(testNodeFourColor);
|
||||
RegisterNode(testNodeFourColor);
|
||||
@ -95,12 +99,12 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Wi
|
||||
Color color(0, 0, 0);
|
||||
Vector4<Color> outLineColor = { color, color, color, color };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
for (int i = 0; i < THREE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
auto testNodeWidth = RSCanvasNode::Create();
|
||||
testNodeWidth->SetBounds({ x, y, 500, 500 });
|
||||
testNodeWidth->SetTranslate(widthList[i] + 20, widthList[i] + 50, 0);
|
||||
testNodeWidth->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeWidth->SetTranslate(widthList[i] + TWENTY_, widthList[i] + FIFTY_, 0);
|
||||
testNodeWidth->SetOutlineStyle(style);
|
||||
testNodeWidth->SetOutlineWidth({ widthList[i], widthList[i], widthList[i], widthList[i] });
|
||||
testNodeWidth->SetOutlineColor(outLineColor);
|
||||
@ -110,8 +114,8 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Wi
|
||||
|
||||
// four different width
|
||||
auto testNodeFourWidth = RSCanvasNode::Create();
|
||||
testNodeFourWidth->SetBounds({ 0, 520 * 2, 500, 500 });
|
||||
testNodeFourWidth->SetTranslate(20, 600, 0);
|
||||
testNodeFourWidth->SetBounds({ 0, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeFourWidth->SetTranslate(TWENTY_, SIX_HUNDRED_, 0);
|
||||
testNodeFourWidth->SetOutlineStyle(style);
|
||||
testNodeFourWidth->SetOutlineWidth({ widthList[1] * 0, widthList[1] * 2, widthList[1] * 4, widthList[1] * 8 });
|
||||
testNodeFourWidth->SetOutlineColor(outLineColor);
|
||||
@ -129,15 +133,15 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_St
|
||||
Color color(0, 0, 0);
|
||||
Vector4<Color> outLineColor = { color, color, color, color };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
auto testNodeStyle = RSCanvasNode::Create();
|
||||
testNodeStyle->SetBounds({ x, y, 500, 500 });
|
||||
testNodeStyle->SetTranslate(20, 20, 0);
|
||||
testNodeStyle->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeStyle->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
Vector4<BorderStyle> style = Vector4<BorderStyle>((BorderStyle)i);
|
||||
testNodeStyle->SetOutlineStyle(style);
|
||||
testNodeStyle->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeStyle->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeStyle->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeStyle);
|
||||
RegisterNode(testNodeStyle);
|
||||
@ -145,11 +149,11 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_St
|
||||
|
||||
// four different style
|
||||
auto testNodeFourStyle = RSCanvasNode::Create();
|
||||
testNodeFourStyle->SetBounds({ 0, 520 * 2, 500, 500 });
|
||||
testNodeFourStyle->SetTranslate(20, 20, 0);
|
||||
testNodeFourStyle->SetBounds({ 0, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeFourStyle->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
Vector4<BorderStyle> style2 = Vector4<BorderStyle>((BorderStyle)0, (BorderStyle)1, (BorderStyle)2, (BorderStyle)3);
|
||||
testNodeFourStyle->SetOutlineStyle(style2);
|
||||
testNodeFourStyle->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeFourStyle->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeFourStyle->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeFourStyle);
|
||||
RegisterNode(testNodeFourStyle);
|
||||
@ -158,21 +162,21 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_St
|
||||
// Dash Width
|
||||
GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_DashWidth_Test_1)
|
||||
{
|
||||
uint32_t widthList[] = { 0, 20, 120, 250 };
|
||||
uint32_t widthList[] = { 0, 20, 120, TWO_HUNDRED_FIFTY_ };
|
||||
Vector4<BorderStyle> style = Vector4<BorderStyle>((BorderStyle)1);
|
||||
Color color(0, 0, 0);
|
||||
Vector4<Color> outLineColor = { color, color, color, color };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
auto testNodeDashWidth = RSCanvasNode::Create();
|
||||
testNodeDashWidth->SetBounds({ x, y, 500, 500 });
|
||||
testNodeDashWidth->SetTranslate(20, 20, 0);
|
||||
testNodeDashWidth->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeDashWidth->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
// dash style
|
||||
testNodeDashWidth->SetOutlineStyle(style);
|
||||
testNodeDashWidth->SetBorderDashWidth({ widthList[i], widthList[i], widthList[i], widthList[i] });
|
||||
testNodeDashWidth->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeDashWidth->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeDashWidth->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeDashWidth);
|
||||
RegisterNode(testNodeDashWidth);
|
||||
@ -180,24 +184,24 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Da
|
||||
|
||||
// four different dash width
|
||||
auto testNodeFourDashWidth = RSCanvasNode::Create();
|
||||
testNodeFourDashWidth->SetBounds({ 0, 520 * 2, 500, 500 });
|
||||
testNodeFourDashWidth->SetTranslate(20, 20, 0);
|
||||
testNodeFourDashWidth->SetBounds({ 0, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeFourDashWidth->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
testNodeFourDashWidth->SetOutlineStyle(style);
|
||||
testNodeFourDashWidth->SetBorderDashWidth(
|
||||
{ widthList[1] * 0, widthList[1] * 2, widthList[1] * 4, widthList[1] * 8 });
|
||||
testNodeFourDashWidth->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeFourDashWidth->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeFourDashWidth->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeFourDashWidth);
|
||||
RegisterNode(testNodeFourDashWidth);
|
||||
|
||||
// not dash style, set dash width
|
||||
auto testNodeSolid = RSCanvasNode::Create();
|
||||
testNodeSolid->SetBounds({ 520, 520 * 2, 500, 500 });
|
||||
testNodeSolid->SetTranslate(20, 20, 0);
|
||||
testNodeSolid->SetBounds({ FIVE_HUNDRED_TWENTY_, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeSolid->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
// solid style
|
||||
testNodeSolid->SetOutlineStyle(style);
|
||||
testNodeSolid->SetBorderDashWidth({ widthList[1], widthList[1], widthList[1], widthList[1] });
|
||||
testNodeSolid->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeSolid->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeSolid->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeSolid);
|
||||
RegisterNode(testNodeSolid);
|
||||
@ -206,21 +210,21 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Da
|
||||
// Dash Gap
|
||||
GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_DashGap_Test_1)
|
||||
{
|
||||
uint32_t gapList[] = { 0, 20, 120, 250 };
|
||||
uint32_t gapList[] = { 0, 20, 120, TWO_HUNDRED_FIFTY_ };
|
||||
Vector4<BorderStyle> style = Vector4<BorderStyle>((BorderStyle)1);
|
||||
Color color(0, 0, 0);
|
||||
Vector4<Color> outLineColor = { color, color, color, color };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 520;
|
||||
int y = (i / 2) * 520;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TWENTY_;
|
||||
auto testNodeDashGap = RSCanvasNode::Create();
|
||||
testNodeDashGap->SetBounds({ x, y, 500, 500 });
|
||||
testNodeDashGap->SetTranslate(20, 20, 0);
|
||||
testNodeDashGap->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeDashGap->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
// dash style
|
||||
testNodeDashGap->SetOutlineStyle(style);
|
||||
testNodeDashGap->SetBorderDashGap({ gapList[i], gapList[i], gapList[i], gapList[i] });
|
||||
testNodeDashGap->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeDashGap->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeDashGap->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeDashGap);
|
||||
RegisterNode(testNodeDashGap);
|
||||
@ -228,23 +232,23 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_Da
|
||||
|
||||
// four different dash width
|
||||
auto testNodeFourDashGap = RSCanvasNode::Create();
|
||||
testNodeFourDashGap->SetBounds({ 0, 520 * 2, 500, 500 });
|
||||
testNodeFourDashGap->SetTranslate(20, 20, 0);
|
||||
testNodeFourDashGap->SetBounds({ 0, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeFourDashGap->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
testNodeFourDashGap->SetOutlineStyle(style);
|
||||
testNodeFourDashGap->SetBorderDashGap({ gapList[1] * 0, gapList[1] * 2, gapList[1] * 4, gapList[1] * 8 });
|
||||
testNodeFourDashGap->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeFourDashGap->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeFourDashGap->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeFourDashGap);
|
||||
RegisterNode(testNodeFourDashGap);
|
||||
|
||||
// not dash style, set dash width
|
||||
auto testNodeSolid = RSCanvasNode::Create();
|
||||
testNodeSolid->SetBounds({ 520, 520 * 2, 500, 500 });
|
||||
testNodeSolid->SetTranslate(20, 20, 0);
|
||||
testNodeSolid->SetBounds({ FIVE_HUNDRED_TWENTY_, FIVE_HUNDRED_TWENTY_ * 2, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeSolid->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
// solid style
|
||||
testNodeSolid->SetOutlineStyle(style);
|
||||
testNodeSolid->SetBorderDashGap({ gapList[1], gapList[1], gapList[1], gapList[1] });
|
||||
testNodeSolid->SetOutlineWidth({ 5, 5, 5, 5 });
|
||||
testNodeSolid->SetOutlineWidth({ FIVE_, FIVE_, FIVE_, FIVE_ });
|
||||
testNodeSolid->SetOutlineColor(outLineColor);
|
||||
GetRootNode()->AddChild(testNodeSolid);
|
||||
RegisterNode(testNodeSolid);
|
||||
@ -262,32 +266,32 @@ GRAPHIC_TEST(AppearanceTest04, CONTENT_DISPLAY_TEST, Appearance_OutlineBorder_To
|
||||
float xList[] = { 50, 50, 525, 525 };
|
||||
float yList[] = { 50, 50, 20, 20 };
|
||||
// overlay
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 560;
|
||||
int y = (i / 2) * 510;
|
||||
if (i == 3) {
|
||||
x -= 560;
|
||||
y += 510;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_SIXTY_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
if (i == THREE_) {
|
||||
x -= FIVE_HUNDRED_SIXTY_;
|
||||
y += FIVE_HUNDRED_TEN_;
|
||||
}
|
||||
auto testNode1 = RSCanvasNode::Create();
|
||||
testNode1->SetBounds({ x, y, 500, 500 });
|
||||
testNode1->SetTranslate(20, 20, 0);
|
||||
testNode1->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode1->SetTranslate(TWENTY_, TWENTY_, 0);
|
||||
testNode1->SetBackgroundColor(0xff000000);
|
||||
Vector4<BorderStyle> style = Vector4<BorderStyle>((BorderStyle)styleList[i]);
|
||||
testNode1->SetOutlineStyle(style);
|
||||
testNode1->SetBorderDashGap({ 25, 25, 25, 25 });
|
||||
testNode1->SetOutlineWidth({ 10, 10, 10, 10 });
|
||||
testNode1->SetBorderDashGap({ TWENTY_FIVE_, TWENTY_FIVE_, TWENTY_FIVE_, TWENTY_FIVE_ });
|
||||
testNode1->SetOutlineWidth({ TEN_, TEN_, TEN_, TEN_ });
|
||||
testNode1->SetOutlineColor(outLineColor1);
|
||||
GetRootNode()->AddChild(testNode1);
|
||||
RegisterNode(testNode1);
|
||||
|
||||
auto testNode2 = RSCanvasNode::Create();
|
||||
testNode2->SetBounds({ x, y, 500, 500 });
|
||||
testNode2->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode2->SetTranslate(xList[i], yList[i], 0);
|
||||
testNode2->SetBackgroundColor(0xff000000);
|
||||
testNode2->SetOutlineStyle(style);
|
||||
testNode2->SetBorderDashGap({ 25, 25, 25, 25 });
|
||||
testNode2->SetOutlineWidth({ 10, 10, 10, 10 });
|
||||
testNode2->SetBorderDashGap({ TWENTY_FIVE_, TWENTY_FIVE_, TWENTY_FIVE_, TWENTY_FIVE_ });
|
||||
testNode2->SetOutlineWidth({ TEN_, TEN_, TEN_, TEN_ });
|
||||
testNode2->SetOutlineColor(outLineColor2);
|
||||
GetRootNode()->AddChild(testNode2);
|
||||
RegisterNode(testNode2);
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "parameters_defination.h"
|
||||
#include "rs_graphic_test.h"
|
||||
#include "rs_graphic_test_img.h"
|
||||
|
||||
@ -23,8 +24,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -39,14 +40,14 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Color_Test_
|
||||
{
|
||||
uint32_t colorList[] = { 0xff000000, 0xffff0000, 0xff00ff00, 0xff0000ff };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeColor = RSCanvasNode::Create();
|
||||
testNodeColor->SetBounds({ x, y, 500, 500 });
|
||||
testNodeColor->SetTranslate(100, 100, 0);
|
||||
testNodeColor->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeColor->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeColor->SetShadowColor(colorList[i]);
|
||||
testNodeColor->SetShadowRadius(50);
|
||||
testNodeColor->SetShadowRadius(FIFTY_);
|
||||
GetRootNode()->AddChild(testNodeColor);
|
||||
RegisterNode(testNodeColor);
|
||||
}
|
||||
@ -55,12 +56,12 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Color_Test_
|
||||
// shadow offset
|
||||
GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Offset_Test_1)
|
||||
{
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeOffset = RSCanvasNode::Create();
|
||||
testNodeOffset->SetBounds({ x, y, 500, 500 });
|
||||
testNodeOffset->SetTranslate(100, 100, 0);
|
||||
testNodeOffset->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeOffset->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeOffset->SetShadowColor(0xff000000);
|
||||
switch (i) {
|
||||
case 0: {
|
||||
@ -82,7 +83,7 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Offset_Test
|
||||
default:
|
||||
break;
|
||||
}
|
||||
testNodeOffset->SetShadowRadius(50);
|
||||
testNodeOffset->SetShadowRadius(FIFTY_);
|
||||
GetRootNode()->AddChild(testNodeOffset);
|
||||
RegisterNode(testNodeOffset);
|
||||
}
|
||||
@ -90,12 +91,12 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Offset_Test
|
||||
|
||||
GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Offset_Test_2)
|
||||
{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < FIVE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeOffset = RSCanvasNode::Create();
|
||||
testNodeOffset->SetBounds({ x, y, 500, 500 });
|
||||
testNodeOffset->SetTranslate(100, 100, 0);
|
||||
testNodeOffset->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeOffset->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeOffset->SetBackgroundColor(0xffc0c0c0);
|
||||
testNodeOffset->SetShadowColor(0xff000000);
|
||||
testNodeOffset->SetShadowRadius(50);
|
||||
@ -118,8 +119,8 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Offset_Test
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
testNodeOffset->SetTranslate(0, 200, 0);
|
||||
testNodeOffset->SetShadowOffset(500, 500);
|
||||
testNodeOffset->SetTranslate(0, TWO_HUNDRED_, 0);
|
||||
testNodeOffset->SetShadowOffset(FIVE_HUNDRED_, FIVE_HUNDRED_);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -135,16 +136,16 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Alpha_Test_
|
||||
{
|
||||
float alphaList[] = { 0, 0.2, 0.8, 1 };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeAlpha = RSCanvasNode::Create();
|
||||
testNodeAlpha->SetBounds({ x, y, 500, 500 });
|
||||
testNodeAlpha->SetTranslate(100, 100, 0);
|
||||
testNodeAlpha->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeAlpha->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeAlpha->SetBackgroundColor(0xffc0c0c0);
|
||||
testNodeAlpha->SetShadowColor(0xff000000);
|
||||
testNodeAlpha->SetShadowAlpha(alphaList[i]);
|
||||
testNodeAlpha->SetShadowRadius(50);
|
||||
testNodeAlpha->SetShadowRadius(FIFTY_);
|
||||
GetRootNode()->AddChild(testNodeAlpha);
|
||||
RegisterNode(testNodeAlpha);
|
||||
}
|
||||
@ -155,12 +156,12 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Radius_Test
|
||||
{
|
||||
float radiusList[] = { 0, 50, 250 };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < THREE_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeRadius = RSCanvasNode::Create();
|
||||
testNodeRadius->SetBounds({ x, y, 500, 500 });
|
||||
testNodeRadius->SetTranslate(100, 100, 0);
|
||||
testNodeRadius->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeRadius->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeRadius->SetBackgroundColor(0xffc0c0c0);
|
||||
testNodeRadius->SetShadowColor(0xff000000);
|
||||
testNodeRadius->SetShadowRadius(radiusList[i]);
|
||||
@ -169,20 +170,21 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Radius_Test
|
||||
}
|
||||
|
||||
// ClipToBounds
|
||||
const int yPos = 1250;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
auto testNodeParent = RSCanvasNode::Create();
|
||||
testNodeParent->SetBounds({ i * 600, 1250, 500, 500 });
|
||||
testNodeParent->SetTranslate(100, 100, 0);
|
||||
testNodeParent->SetBounds({ i * SIX_HUNDRED_, yPos, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeParent->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeParent->SetClipToBounds(i);
|
||||
GetRootNode()->AddChild(testNodeParent);
|
||||
RegisterNode(testNodeParent);
|
||||
|
||||
auto testNodeChild = RSCanvasNode::Create();
|
||||
testNodeChild->SetBounds({ 0, 0, 400, 400 });
|
||||
testNodeChild->SetTranslate(100, 100, 0);
|
||||
testNodeChild->SetBounds({ 0, 0, FOUR_HUNDRED_, FOUR_HUNDRED_ });
|
||||
testNodeChild->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeChild->SetBackgroundColor(0xffc0c0c0);
|
||||
testNodeChild->SetShadowColor(0xff000000);
|
||||
testNodeChild->SetShadowRadius(50);
|
||||
testNodeChild->SetShadowRadius(FIFTY_);
|
||||
testNodeParent->AddChild(testNodeChild);
|
||||
RegisterNode(testNodeChild);
|
||||
}
|
||||
@ -198,34 +200,34 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Strategy_Te
|
||||
float radiusList[] = { 50, 100 };
|
||||
float offsetList[] = { 0, 50 };
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
for (int i = 0; i < SIX_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNodeParent = RSCanvasNode::Create();
|
||||
testNodeParent->SetBounds({ x, y, 500, 500 });
|
||||
testNodeParent->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
auto imageModifier = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier->SetWidth(500);
|
||||
imageModifier->SetHeight(500);
|
||||
imageModifier->SetWidth(FIVE_HUNDRED_);
|
||||
imageModifier->SetHeight(FIVE_HUNDRED_);
|
||||
imageModifier->SetPixelMapPath("/data/local/tmp/appearance_test.jpg");
|
||||
testNodeParent->AddModifier(imageModifier);
|
||||
GetRootNode()->AddChild(testNodeParent);
|
||||
RegisterNode(testNodeParent);
|
||||
|
||||
auto testNodeChild = RSCanvasNode::Create();
|
||||
testNodeChild->SetBounds({ 0, 0, 250, 250 });
|
||||
testNodeChild->SetTranslate(100, 100, 0);
|
||||
testNodeChild->SetBounds({ 0, 0, TWO_HUNDRED_FIFTY_, TWO_HUNDRED_FIFTY_ });
|
||||
testNodeChild->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
testNodeChild->SetBackgroundColor(0xffffffff);
|
||||
testNodeChild->SetShadowAlpha(alphaList[i % 2]);
|
||||
testNodeChild->SetShadowOffset(offsetList[i % 2], offsetList[i % 2]);
|
||||
testNodeChild->SetShadowAlpha(alphaList[i % TWO_]);
|
||||
testNodeChild->SetShadowOffset(offsetList[i % TWO_], offsetList[i % TWO_]);
|
||||
// 1st, 2nd row, Average and Primary, radius
|
||||
if (i < 4) {
|
||||
testNodeChild->SetShadowColorStrategy((i / 2) + 1);
|
||||
testNodeChild->SetShadowRadius(radiusList[i % 2]);
|
||||
testNodeChild->SetShadowColorStrategy((i / TWO_) + 1);
|
||||
testNodeChild->SetShadowRadius(radiusList[i % TWO_]);
|
||||
}
|
||||
// third row, Shadow Elevation, normal shadow
|
||||
else {
|
||||
testNodeChild->SetShadowColorStrategy(i / 2);
|
||||
testNodeChild->SetShadowElevation(radiusList[i % 2]);
|
||||
testNodeChild->SetShadowColorStrategy(i / TWO_);
|
||||
testNodeChild->SetShadowElevation(radiusList[i % TWO_]);
|
||||
}
|
||||
testNodeParent->AddChild(testNodeChild);
|
||||
RegisterNode(testNodeChild);
|
||||
@ -237,23 +239,23 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Filled_Test
|
||||
{
|
||||
float alphaList[] = { 1, 0.5 };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeFilled = RSCanvasNode::Create();
|
||||
testNodeFilled->SetBounds({ x, y, 500, 500 });
|
||||
testNodeFilled->SetTranslate(100, 100, 0);
|
||||
testNodeFilled->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeFilled->SetTranslate(ONE_HUNDRED_, ONE_HUNDRED_, 0);
|
||||
auto imageModifier = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier->SetWidth(500);
|
||||
imageModifier->SetHeight(500);
|
||||
imageModifier->SetWidth(FIVE_HUNDRED_);
|
||||
imageModifier->SetHeight(FIVE_HUNDRED_);
|
||||
imageModifier->SetPixelMapPath("/data/local/tmp/appearance_test.jpg");
|
||||
testNodeFilled->AddModifier(imageModifier);
|
||||
testNodeFilled->SetAlpha(0.5);
|
||||
testNodeFilled->SetShadowColor(0xff00ff00);
|
||||
testNodeFilled->SetShadowOffset(50, 50);
|
||||
testNodeFilled->SetShadowRadius(50);
|
||||
testNodeFilled->SetShadowIsFilled(i / 2);
|
||||
testNodeFilled->SetShadowAlpha(alphaList[i % 2]);
|
||||
testNodeFilled->SetShadowOffset(FIFTY_, FIFTY_);
|
||||
testNodeFilled->SetShadowRadius(FIFTY_);
|
||||
testNodeFilled->SetShadowIsFilled(i / TWO_);
|
||||
testNodeFilled->SetShadowAlpha(alphaList[i % TWO_]);
|
||||
GetRootNode()->AddChild(testNodeFilled);
|
||||
RegisterNode(testNodeFilled);
|
||||
}
|
||||
@ -262,18 +264,18 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Filled_Test
|
||||
// shadow mask
|
||||
GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_mask_Test_1)
|
||||
{
|
||||
for (int i = 0; i < 2; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < TWO_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeMask = RSCanvasNode::Create();
|
||||
testNodeMask->SetBounds({ x, y, 500, 500 });
|
||||
testNodeMask->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
auto imageModifier = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier->SetWidth(500);
|
||||
imageModifier->SetHeight(500);
|
||||
imageModifier->SetWidth(FIVE_HUNDRED_);
|
||||
imageModifier->SetHeight(FIVE_HUNDRED_);
|
||||
imageModifier->SetPixelMapPath("/data/local/tmp/appearance_test.jpg");
|
||||
testNodeMask->AddModifier(imageModifier);
|
||||
testNodeMask->SetShadowMask(i);
|
||||
testNodeMask->SetShadowRadius(100);
|
||||
testNodeMask->SetShadowRadius(ONE_HUNDRED_);
|
||||
testNodeMask->SetShadowAlpha(0.5);
|
||||
GetRootNode()->AddChild(testNodeMask);
|
||||
RegisterNode(testNodeMask);
|
||||
@ -286,14 +288,14 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Shadow_Touch_Test_
|
||||
float alphaList[] = { 1, 0.5 };
|
||||
uint32_t colorList[] = { 0xff000000, 0xffff0000 };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 600;
|
||||
int y = (i / 2) * 600;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_;
|
||||
auto testNodeTouch = RSCanvasNode::Create();
|
||||
testNodeTouch->SetBounds({ x, y, 500, 500 });
|
||||
testNodeTouch->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNodeTouch->SetShadowColor(colorList[i]);
|
||||
testNodeTouch->SetShadowRadius(100);
|
||||
testNodeTouch->SetShadowAlpha(alphaList[i / 2]);
|
||||
testNodeTouch->SetShadowRadius(ONE_HUNDRED_);
|
||||
testNodeTouch->SetShadowAlpha(alphaList[i / TWO_]);
|
||||
GetRootNode()->AddChild(testNodeTouch);
|
||||
RegisterNode(testNodeTouch);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "rs_graphic_test.h"
|
||||
#include "rs_graphic_test_img.h"
|
||||
#include "parameters_defination.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -23,8 +24,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -39,14 +40,14 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Spherize_Test_1)
|
||||
{
|
||||
float spherizeList[] = { 0, 0.001, 0.5, 1 };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNodeSpherize = RSCanvasNode::Create();
|
||||
testNodeSpherize->SetBounds({ x, y, 500, 500 });
|
||||
testNodeSpherize->SetBounds({ x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
auto imageModifier = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier->SetWidth(500);
|
||||
imageModifier->SetHeight(500);
|
||||
imageModifier->SetWidth(FIVE_HUNDRED_);
|
||||
imageModifier->SetHeight(FIVE_HUNDRED_);
|
||||
imageModifier->SetPixelMapPath("/data/local/tmp/appearance_test.jpg");
|
||||
testNodeSpherize->AddModifier(imageModifier);
|
||||
testNodeSpherize->SetSpherizeDegree(spherizeList[i]);
|
||||
@ -59,13 +60,13 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Spherize_Test_1)
|
||||
GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_Spherize_Test_2)
|
||||
{
|
||||
auto testNodeSpherizeBlur = RSCanvasNode::Create();
|
||||
testNodeSpherizeBlur->SetBounds({ 0, 0, 500, 500 });
|
||||
testNodeSpherizeBlur->SetBounds({ 0, 0, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
auto imageModifier2 = std::make_shared<ImageCustomModifier>();
|
||||
imageModifier2->SetWidth(500);
|
||||
imageModifier2->SetHeight(500);
|
||||
imageModifier2->SetWidth(FIVE_HUNDRED_);
|
||||
imageModifier2->SetHeight(FIVE_HUNDRED_);
|
||||
imageModifier2->SetPixelMapPath("/data/local/tmp/appearance_test.jpg");
|
||||
testNodeSpherizeBlur->AddModifier(imageModifier2);
|
||||
testNodeSpherizeBlur->SetForegroundEffectRadius(10);
|
||||
testNodeSpherizeBlur->SetForegroundEffectRadius(TEN_);
|
||||
testNodeSpherizeBlur->SetSpherizeDegree(1);
|
||||
GetRootNode()->AddChild(testNodeSpherizeBlur);
|
||||
RegisterNode(testNodeSpherizeBlur);
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "parameters_defination.h"
|
||||
#include "rs_graphic_test.h"
|
||||
#include "rs_graphic_test_img.h"
|
||||
|
||||
@ -26,8 +27,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -40,10 +41,10 @@ public:
|
||||
GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_ForegroundEffectRadius_Test_1)
|
||||
{
|
||||
float radiusList[] = { 0, 10.0, 100.0 };
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < THREE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetForegroundEffectRadius(radiusList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
@ -54,10 +55,10 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_Saturation_Test_1)
|
||||
{
|
||||
float radiusList[] = { 10.0, 0.0, 10.0, 10.0 };
|
||||
float degreeList[] = { 0.0, 0.5, 0.5, 5.0 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetForegroundBlurRadius(radiusList[i]);
|
||||
testNode->SetForegroundBlurSaturation(degreeList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
@ -69,10 +70,10 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_Brightness_Test_1)
|
||||
{
|
||||
float radiusList[] = { 10.0, 0.0, 10.0, 10.0 };
|
||||
float degreeList[] = { 0.0, 0.5, 0.5, 1.5 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetForegroundBlurRadius(radiusList[i]);
|
||||
testNode->SetForegroundBlurBrightness(degreeList[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
@ -84,10 +85,10 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_Color_Test_1)
|
||||
{
|
||||
float radiusList[] = { 10.0, 0.0, 10.0 };
|
||||
uint32_t colorList[] = { 0x00ffffff, 0x0000ff00, 0x7d00ff00 };
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
for (int i = 0; i < THREE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetForegroundBlurRadius(radiusList[i]);
|
||||
testNode->SetForegroundBlurMaskColor(RSColor::FromArgbInt(colorList[i]));
|
||||
GetRootNode()->AddChild(testNode);
|
||||
@ -97,11 +98,11 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_Color_Test_1)
|
||||
|
||||
GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_ColorMode_Test_1)
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int x = (i % 2) * 510;
|
||||
int y = (i / 2) * 510;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 500, 500 });
|
||||
testNode->SetForegroundBlurRadius(10.f);
|
||||
for (int i = 0; i < THREE_; i++) {
|
||||
int x = (i % TWO_) * FIVE_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * FIVE_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, FIVE_HUNDRED_, FIVE_HUNDRED_ });
|
||||
testNode->SetForegroundBlurRadius(TEN_);
|
||||
testNode->SetForegroundBlurMaskColor(RSColor::FromArgbInt(0x7dff0000));
|
||||
testNode->SetForegroundBlurColorMode(i);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
@ -113,10 +114,10 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_RadiusXY_Test_1)
|
||||
{
|
||||
float radiusX[] = { 0.0, 1.1, 10.0, 10.0 };
|
||||
float radiusY[] = { 0.0, 10.0, 1.1, 10.0 };
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x = (i % 2) * 610;
|
||||
int y = (i / 2) * 610;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 600, 600 });
|
||||
for (int i = 0; i < FOUR_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, SIX_HUNDRED_, SIX_HUNDRED_ });
|
||||
testNode->SetForegroundBlurRadiusX(radiusX[i]);
|
||||
testNode->SetForegroundBlurRadiusY(radiusY[i]);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
@ -140,13 +141,13 @@ GRAPHIC_TEST(ForegroundTest, CONTENT_DISPLAY_TEST, Blur_LinearGradientBlur_Test_
|
||||
{ std::make_pair(0.0, 0.0), std::make_pair(1.0, 1.0) },
|
||||
{ std::make_pair(0.0, 0.0), std::make_pair(1.0, 0.5), std::make_pair(0.0, 1.0) },
|
||||
};
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int x = (i % 2) * 610;
|
||||
int y = (i / 2) * 610;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, 600, 600 });
|
||||
testNode->SetFrame({ x, y, 600, 600 });
|
||||
for (int i = 0; i < FIVE_; i++) {
|
||||
int x = (i % TWO_) * SIX_HUNDRED_TEN_;
|
||||
int y = (i / TWO_) * SIX_HUNDRED_TEN_;
|
||||
auto testNode = SetUpNodeBgImage("/data/local/tmp/fg_test.jpg", { x, y, SIX_HUNDRED_, SIX_HUNDRED_ });
|
||||
testNode->SetFrame({ x, y, SIX_HUNDRED_, SIX_HUNDRED_ });
|
||||
std::shared_ptr<RSLinearGradientBlurPara> param(
|
||||
std::make_shared<Rosen::RSLinearGradientBlurPara>(100.f, fractionStops[i], direction[i]));
|
||||
std::make_shared<Rosen::RSLinearGradientBlurPara>(ONE_HUNDRED_, fractionStops[i], direction[i]));
|
||||
testNode->SetLinearGradientBlurPara(param);
|
||||
GetRootNode()->AddChild(testNode);
|
||||
RegisterNode(testNode);
|
||||
|
@ -25,8 +25,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest01 : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest02 : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -27,8 +27,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class ForegroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -24,8 +24,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -24,8 +24,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -22,8 +22,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef PARAMETERS_DEFINATION_H
|
||||
#define PARAMETERS_DEFINATION_H
|
||||
|
||||
#define ZERO_ 0
|
||||
#define ONE_ 1
|
||||
#define TWO_ 2
|
||||
#define THREE_ 3
|
||||
#define FOUR_ 4
|
||||
#define FIVE_ 5
|
||||
#define SIX_ 6
|
||||
#define SEVEN_ 7
|
||||
#define EIGHT_ 8
|
||||
#define NINE_ 9
|
||||
|
||||
#define TEN_ 10
|
||||
#define TWENTY_ 20
|
||||
#define TWENTY_FIVE_ 25
|
||||
#define THIRTY_ 30
|
||||
#define FORTY_ 40
|
||||
#define FIFTY_ 50
|
||||
|
||||
#define ONE_HUNDRED_ 100
|
||||
#define ONE_HUNDRED_TWENTY_ 120
|
||||
#define TWO_HUNDRED_ 200
|
||||
#define TWO_HUNDRED_FIFTY_ 250
|
||||
#define THREE_HUNDRED_ 300
|
||||
#define FOUR_HUNDRED_ 400
|
||||
#define FIVE_HUNDRED_ 500
|
||||
#define FIVE_HUNDRED_TEN_ 510
|
||||
#define FIVE_HUNDRED_TWENTY_ 520
|
||||
#define FIVE_HUNDRED_SIXTY_ 560
|
||||
#define SIX_HUNDRED_ 600
|
||||
#define SIX_HUNDRED_TEN_ 610
|
||||
|
||||
#endif // PARAMETERS_DEFINATION_H
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -92,6 +92,7 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_PixelStretchPercen
|
||||
|
||||
std::vector<Vector4f> pixelStretchList = { { 0, 0, 0, 0 }, { 0, 0.10, 0, 0 }, { 0, 0, 0.5, 0 }, { 0, 0, 0, 1.0 },
|
||||
{ 0.1, 0.2, 0.3, 0.4 } };
|
||||
Vector4f midVal = { 0.5, 0.5, 0.5, 0.5 };
|
||||
std::vector<Drawing::TileMode> modeList = { Drawing::TileMode::CLAMP, Drawing::TileMode::CLAMP,
|
||||
Drawing::TileMode::REPEAT, Drawing::TileMode::MIRROR, Drawing::TileMode::DECAL };
|
||||
|
||||
@ -103,6 +104,8 @@ GRAPHIC_TEST(AppearanceTest, CONTENT_DISPLAY_TEST, Appearance_PixelStretchPercen
|
||||
testNodeBackGround->SetBorderStyle(0, 0, 0, 0);
|
||||
testNodeBackGround->SetBorderWidth(5, 5, 5, 5);
|
||||
testNodeBackGround->SetBorderColor(Vector4<Color>(RgbPalette::Green()));
|
||||
// Set PixelStretch to a middle value, DTS2024092542149
|
||||
testNodeBackGround->SetPixelStretchPercent(midVal, modeList[i]);
|
||||
testNodeBackGround->SetPixelStretchPercent(pixelStretchList[i], modeList[i]);
|
||||
GetRootNode()->AddChild(testNodeBackGround);
|
||||
RegisterNode(testNodeBackGround);
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class AppearanceTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -36,8 +36,8 @@ public:
|
||||
|
||||
class GeometryTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -25,8 +25,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
@ -181,6 +181,51 @@ GRAPHIC_TEST(BackgroundTest, CONTENT_DISPLAY_TEST, Background_Blur_Mask_Color_Te
|
||||
}
|
||||
}
|
||||
|
||||
GRAPHIC_TEST(BackgroundTest, CONTENT_DISPLAY_TEST, Background_Blur_Mask_Color_Alpha_Test)
|
||||
{
|
||||
int columnCount = 3;
|
||||
int rowCount = 4;
|
||||
auto sizeX = screenWidth / columnCount;
|
||||
auto sizeY = screenHeight / rowCount;
|
||||
|
||||
std::vector<Color> colorList = {
|
||||
Color(0xff000000), // RgbPalette::Black()
|
||||
Color(0xffffffff), // RgbPalette::White()
|
||||
Color(0x2dff0000), // RgbPalette::Red()
|
||||
Color(0x4d00ff00), // RgbPalette::Green()
|
||||
Color(0x6d0000ff), // RgbPalette::Blue()
|
||||
Color(0x8d00ffff), // RgbPalette::Cyan()
|
||||
Color(0xad444444), // RgbPalette::Gray()
|
||||
Color(0xcdff00ff), // RgbPalette::Magenta()
|
||||
Color(0x00000000), // RgbPalette::Transparent()
|
||||
Color(0x10000000), // RgbPalette::Transparent()
|
||||
Color(0x20000000), // RgbPalette::Transparent()
|
||||
Color(0x30000000), // RgbPalette::Transparent()
|
||||
};
|
||||
|
||||
std::vector<int> radiusList = { 10, 20, 30, 40, 50, 60, 70, 80, 90, -100, -10, 0 };
|
||||
std::vector<float> saturationList = { 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 0.6, 1.0, 1.4 };
|
||||
std::vector<float> brightnessList = { 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 0.6, 1.0, 1.4 };
|
||||
std::vector<float> alphaList = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2 };
|
||||
|
||||
for (int i = 0; i < colorList.size(); i++) {
|
||||
int x = (i % columnCount) * sizeX;
|
||||
int y = (i / columnCount) * sizeY;
|
||||
auto testNodeBackGround =
|
||||
SetUpNodeBgImage("/data/local/tmp/Images/backGroundImage.jpg", { x, y, sizeX - 10, sizeY - 10 });
|
||||
testNodeBackGround->SetBorderStyle(0, 0, 0, 0);
|
||||
testNodeBackGround->SetBorderWidth(5, 5, 5, 5);
|
||||
testNodeBackGround->SetBorderColor(Vector4<Color>(RgbPalette::Red()));
|
||||
testNodeBackGround->SetBackgroundBlurRadius(radiusList[i]);
|
||||
testNodeBackGround->SetBackgroundBlurSaturation(saturationList[i]);
|
||||
testNodeBackGround->SetBackgroundBlurBrightness(brightnessList[i]);
|
||||
testNodeBackGround->SetBackgroundBlurMaskColor(colorList[i]);
|
||||
testNodeBackGround->SetAlpha(alphaList[i]);
|
||||
GetRootNode()->AddChild(testNodeBackGround);
|
||||
RegisterNode(testNodeBackGround);
|
||||
}
|
||||
}
|
||||
|
||||
GRAPHIC_TEST(BackgroundTest, CONTENT_DISPLAY_TEST, Background_Blur_Color_Mode_Test)
|
||||
{
|
||||
int columnCount = 3;
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest01 : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
@ -23,8 +23,8 @@ namespace OHOS::Rosen {
|
||||
|
||||
class BackgroundTest : public RSGraphicTest {
|
||||
private:
|
||||
int screenWidth = 1260;
|
||||
int screenHeight = 2720;
|
||||
const int screenWidth = 1260;
|
||||
const int screenHeight = 2720;
|
||||
|
||||
public:
|
||||
// called before each tests
|
||||
|
Loading…
Reference in New Issue
Block a user