mirror of https://github.com/axmolengine/axmol.git
Test code updated with long to int32_t changes
This commit is contained in:
parent
d8fd94db8a
commit
89ba502d20
|
@ -773,7 +773,7 @@ void ActionSequence2::callback2(Node* sender)
|
|||
addChild(label);
|
||||
}
|
||||
|
||||
void ActionSequence2::callback3(Node* sender, long data)
|
||||
void ActionSequence2::callback3(Node* sender, int32_t data)
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
|
@ -950,7 +950,7 @@ void ActionCallFunction::callback2(Node* sender)
|
|||
CCLOG("sender is: %p", sender);
|
||||
}
|
||||
|
||||
void ActionCallFunction::callback3(Node* sender, long data)
|
||||
void ActionCallFunction::callback3(Node* sender, int32_t data)
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
|
|
|
@ -205,7 +205,7 @@ public:
|
|||
|
||||
void callback1();
|
||||
void callback2(Node* sender);
|
||||
void callback3(Node* sender, long data);
|
||||
void callback3(Node* sender, int32_t data);
|
||||
};
|
||||
|
||||
class ActionSequence3 : public ActionsDemo
|
||||
|
@ -351,7 +351,7 @@ public:
|
|||
|
||||
void callback1();
|
||||
void callback2(Node* pTarget);
|
||||
void callback3(Node* pTarget, long data);
|
||||
void callback3(Node* pTarget, int32_t data);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ bool Bug14327Layer::init()
|
|||
|
||||
void Bug14327Layer::update(float dt)
|
||||
{
|
||||
long delta = _removeTime - time(nullptr);
|
||||
int32_t delta = _removeTime - time(nullptr);
|
||||
if (delta > 0)
|
||||
{
|
||||
ldiv_t ret = ldiv(delta, 60L);
|
||||
|
|
|
@ -900,7 +900,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender)
|
|||
|
||||
// update sprite number
|
||||
char szText[16];
|
||||
sprintf(szText,"%ld sprits", static_cast<long>(_layer3D->getChildrenCount()));
|
||||
sprintf(szText,"%ld sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
|
||||
_labelSprite3DCount->setString(szText);
|
||||
}
|
||||
|
||||
|
@ -928,7 +928,7 @@ void CameraCullingDemo::delSpriteCallback(Ref* sender)
|
|||
|
||||
// update sprite number
|
||||
char szText[16];
|
||||
sprintf(szText,"%ld sprits", static_cast<long>(_layer3D->getChildrenCount()));
|
||||
sprintf(szText,"%ld sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
|
||||
_labelSprite3DCount->setString(szText);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ bool TableViewTest::init()
|
|||
|
||||
void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell)
|
||||
{
|
||||
CCLOG("cell touched at index: %ld", static_cast<long>(cell->getIdx()));
|
||||
CCLOG("cell touched at index: %ld", static_cast<int32_t>(cell->getIdx()));
|
||||
}
|
||||
|
||||
Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
|
||||
|
@ -84,7 +84,7 @@ Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
|
|||
|
||||
TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx)
|
||||
{
|
||||
auto string = StringUtils::format("%ld", static_cast<long>(idx));
|
||||
auto string = StringUtils::format("%ld", static_cast<int32_t>(idx));
|
||||
TableViewCell *cell = table->dequeueCell();
|
||||
if (!cell) {
|
||||
cell = new (std::nothrow) CustomTableViewCell();
|
||||
|
|
|
@ -373,7 +373,7 @@ void TestFileFuncs::onEnter()
|
|||
this->addChild(label);
|
||||
|
||||
// getFileSize Test
|
||||
long size = sharedFileUtils->getFileSize(filepath);
|
||||
int32_t size = sharedFileUtils->getFileSize(filepath);
|
||||
msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
|
||||
label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(x, y * 3);
|
||||
|
@ -1160,7 +1160,7 @@ void TestFileFuncsAsync::onEnter()
|
|||
label->setPosition(x, y * 4);
|
||||
this->addChild(label);
|
||||
|
||||
sharedFileUtils->getFileSize(filepath, [=](long size) {
|
||||
sharedFileUtils->getFileSize(filepath, [=](int32_t size) {
|
||||
auto msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
|
||||
auto label = Label::createWithSystemFont(msg, "", 20);
|
||||
label->setPosition(x, y * 3);
|
||||
|
|
|
@ -311,7 +311,7 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re
|
|||
log("%s completed", response->getHttpRequest()->getTag());
|
||||
}
|
||||
|
||||
long statusCode = response->getResponseCode();
|
||||
int32_t statusCode = response->getResponseCode();
|
||||
char statusString[64] = {};
|
||||
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
|
||||
_labelStatusCode->setString(statusString);
|
||||
|
@ -460,7 +460,7 @@ void HttpClientClearRequestsTest::onHttpRequestCompleted(HttpClient *sender, Htt
|
|||
log("%s completed", response->getHttpRequest()->getTag());
|
||||
}
|
||||
|
||||
long statusCode = response->getResponseCode();
|
||||
int32_t statusCode = response->getResponseCode();
|
||||
char statusString[64] = {};
|
||||
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
|
||||
_labelStatusCode->setString(statusString);
|
||||
|
|
|
@ -885,7 +885,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender)
|
|||
|
||||
//remove cache data
|
||||
Sprite3DCache::getInstance()->removeAllSprite3DData();
|
||||
long index = 0;
|
||||
int32_t index = 0;
|
||||
for (const auto& path : _paths) {
|
||||
Sprite3D::createAsync(path, CC_CALLBACK_2(AsyncLoadSprite3DTest::asyncLoad_Callback, this), (void*)index++);
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender)
|
|||
|
||||
void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param)
|
||||
{
|
||||
long index = (long)param;
|
||||
auto index = (int32_t)param;
|
||||
auto node = getChildByTag(101);
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
float width = s.width / _paths.size();
|
||||
|
@ -1324,7 +1324,7 @@ Sprite3DReskinTest::Sprite3DReskinTest()
|
|||
}
|
||||
void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender)
|
||||
{
|
||||
long index = (long)(((MenuItemLabel*)sender)->getUserData());
|
||||
auto index = (int32_t)(((MenuItemLabel*)sender)->getUserData());
|
||||
if (index < (int)SkinType::MAX_TYPE)
|
||||
{
|
||||
_curSkin[index] = (_curSkin[index] + 1) % _skins[index].size();
|
||||
|
@ -1506,7 +1506,7 @@ void Sprite3DWithOBBPerformanceTest::onTouchesMoved(const std::vector<Touch*>& t
|
|||
void Sprite3DWithOBBPerformanceTest::update(float dt)
|
||||
{
|
||||
char szText[16];
|
||||
sprintf(szText, "%lu cubes", static_cast<unsigned long>(_obb.size()));
|
||||
sprintf(szText, "%lu cubes", static_cast<uint32_t>(_obb.size()));
|
||||
_labelCubeCount->setString(szText);
|
||||
|
||||
if (_drawDebug)
|
||||
|
|
|
@ -129,7 +129,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -438,7 +438,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -558,7 +558,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
}
|
||||
|
||||
pageView->pushBackCustomItem(outerBox);
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<int32_t>(pageView->getItems().size())));
|
||||
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
||||
});
|
||||
_uiLayer->addChild(button);
|
||||
|
@ -579,7 +579,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
{
|
||||
CCLOG("There is no page to remove!");
|
||||
}
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<int32_t>(pageView->getItems().size())));
|
||||
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
||||
|
||||
});
|
||||
|
@ -594,7 +594,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
button3->addClickEventListener([=](Ref* sender)
|
||||
{
|
||||
pageView->removeAllItems();
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<int32_t>(pageView->getItems().size())));
|
||||
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
||||
|
||||
});
|
||||
|
@ -623,7 +623,7 @@ void UIPageViewDynamicAddAndRemoveTest::pageViewEvent(Ref *pSender, PageView::Ev
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>((pageView->getCurrentPageIndex() + 1))));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>((pageView->getCurrentPageIndex() + 1))));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -825,7 +825,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -984,7 +984,7 @@ void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType ty
|
|||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -69,12 +69,12 @@ bool UIRichTextTest::init()
|
|||
std::string str2 = config->getValue("Japanese").asString();
|
||||
CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s",
|
||||
str1.c_str(),
|
||||
static_cast<long>(str1.length()),
|
||||
static_cast<int32_t>(str1.length()),
|
||||
StringUtils::getCharacterCountInUTF8String(str1),
|
||||
Helper::getSubStringOfUTF8String(str1, 0, 5).c_str());
|
||||
CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s",
|
||||
str2.c_str(),
|
||||
static_cast<long>(str2.length()),
|
||||
static_cast<int32_t>(str2.length()),
|
||||
StringUtils::getCharacterCountInUTF8String(str2),
|
||||
Helper::getSubStringOfUTF8String(str2, 0, 2).c_str());
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ bool TestController::blockTouchBegan(Touch* touch, Event* event)
|
|||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||
#include <windows.h>
|
||||
|
||||
static long __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp)
|
||||
static int32_t __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp)
|
||||
{
|
||||
if (s_testController)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue