diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp index 0c637c275f..9f7a3f8f95 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp @@ -1253,13 +1253,13 @@ void BitmapFontMultiLineAlignment::stringChanged(cocos2d::Ref *sender) switch(item->getTag()) { case LongSentences: - static_cast(_labelShouldRetain)->setString(LongSentencesExample); + _labelShouldRetain->setString(LongSentencesExample); break; case LineBreaks: - static_cast(_labelShouldRetain)->setString(LineBreaksExample); + _labelShouldRetain->setString(LineBreaksExample); break; case Mixed: - static_cast(_labelShouldRetain)->setString(MixedExample); + _labelShouldRetain->setString(MixedExample); break; default: @@ -1279,13 +1279,13 @@ void BitmapFontMultiLineAlignment::alignmentChanged(cocos2d::Ref *sender) switch(item->getTag()) { case LeftAlign: - static_cast(_labelShouldRetain)->setAlignment(TextHAlignment::LEFT); + _labelShouldRetain->setAlignment(TextHAlignment::LEFT); break; case CenterAlign: - static_cast(_labelShouldRetain)->setAlignment(TextHAlignment::CENTER); + _labelShouldRetain->setAlignment(TextHAlignment::CENTER); break; case RightAlign: - static_cast(_labelShouldRetain)->setAlignment(TextHAlignment::RIGHT); + _labelShouldRetain->setAlignment(TextHAlignment::RIGHT); break; default: diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTest.h b/tests/cpp-tests/Classes/LabelTest/LabelTest.h index 48adc7c8f8..dc596eef0f 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTest.h +++ b/tests/cpp-tests/Classes/LabelTest/LabelTest.h @@ -4,6 +4,12 @@ #include "../testBasic.h" #include "../BaseTest.h" +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#elif _MSC_VER >= 1400 //vs 2005 or higher +#pragma warning (push) +#pragma warning (disable: 4996) +#endif class AtlasDemo : public BaseTest { @@ -236,7 +242,7 @@ private: const char* getCurrentAlignment(); private: TextHAlignment _horizAlign; - Node* _label; + LabelTTF* _label; TextVAlignment _vertAlign; }; @@ -285,7 +291,7 @@ public: void onTouchesMoved(const std::vector& touches, Event *event); public: - Node *_labelShouldRetain; + LabelBMFont *_labelShouldRetain; Sprite *_arrowsBarShouldRetain; Sprite *_arrowsShouldRetain; MenuItemFont *_lastSentenceItem, *_lastAlignmentItem; @@ -383,7 +389,7 @@ public: protected: void onDraw(const kmMat4 &transform, bool transformUpdated); private: - Node *label1; + LabelBMFont *label1; CustomCommand _customCommand; }; @@ -445,6 +451,11 @@ public: virtual std::string subtitle() const override; }; +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#pragma GCC diagnostic warning "-Wdeprecated-declarations" +#elif _MSC_VER >= 1400 //vs 2005 or higher +#pragma warning (pop) +#endif // we don't support linebreak mode