diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index e1b439d5b3..160b677012 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -961,7 +961,7 @@ bool Widget::hitTest(const Vec2 &pt, const Camera* camera, Vec3 *p) const bool Widget::isClippingParentContainsPoint(const Vec2 &pt) { _affectByClipping = false; - Widget* parent = getWidgetParent(); + Node* parent = getParent(); Widget* clippingParent = nullptr; while (parent) { @@ -975,7 +975,7 @@ bool Widget::isClippingParentContainsPoint(const Vec2 &pt) break; } } - parent = parent->getWidgetParent(); + parent = parent->getParent(); } if (!_affectByClipping) diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index 326e0aa804..f7336977e9 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -114,6 +114,7 @@ bool AppDelegate::applicationDidFinishLaunching() searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Both"); searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Horizontal"); searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Vertical"); + searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/ScrollViewAndButton"); searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UISlider"); searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UITextField"); searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIWidgetAddNode"); @@ -155,6 +156,7 @@ bool AppDelegate::applicationDidFinishLaunching() searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Both"); searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal"); searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical"); + searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/ScrollViewAndButton"); searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UISlider"); searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UITextField"); searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIWidgetAddNode"); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp index bf9780efe6..31f9fdd20f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp @@ -11,6 +11,7 @@ UIScrollViewEditorTests::UIScrollViewEditorTests() ADD_TEST_CASE(UIScrollViewTest_Both_Editor); // ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor); // ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor); + ADD_TEST_CASE(UIScrollViewTest_ClippingWithNode); } // UIScrollViewTest_Vertical_Editor @@ -163,3 +164,29 @@ bool UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::init() return false; } + +// UIScrollViewTest_Vertical_Editor + +UIScrollViewTest_ClippingWithNode::UIScrollViewTest_ClippingWithNode() +{ + +} + +UIScrollViewTest_ClippingWithNode::~UIScrollViewTest_ClippingWithNode() +{ + +} + +bool UIScrollViewTest_ClippingWithNode::init() +{ + if (UIScene_Editor::init()) + { + Node* node = CSLoader::createNode("cocosui/UIEditorTest/UIScrollView/ScrollViewAndButton/MainScene.csb"); + _layout = static_cast(node); + _touchGroup->addChild(_layout); + + return true; + } + + return false; +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.h index e72cdad6ce..37c3ea973d 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.h @@ -100,4 +100,17 @@ protected: cocos2d::ui::Text* _displayValueLabel; }; +class UIScrollViewTest_ClippingWithNode : public UIScene_Editor +{ +public: + CREATE_FUNC(UIScrollViewTest_ClippingWithNode); + + UIScrollViewTest_ClippingWithNode(); + ~UIScrollViewTest_ClippingWithNode(); + + virtual bool init() override; +protected: + cocos2d::ui::Text* _displayValueLabel; +}; + #endif /* defined(__TestCpp__UIScrollViewTest_Editor__) */ diff --git a/tests/cpp-tests/Resources/ccs-res b/tests/cpp-tests/Resources/ccs-res index bf3539cccf..ed1fc877d3 160000 --- a/tests/cpp-tests/Resources/ccs-res +++ b/tests/cpp-tests/Resources/ccs-res @@ -1 +1 @@ -Subproject commit bf3539cccfbeaa32e143fa07c73e4d1d715ab424 +Subproject commit ed1fc877d3d58b1980d2602db68d14ce553ac0f9