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