2016-06-18 07:07:33 +08:00
|
|
|
//
|
|
|
|
// Bug-15776.cpp
|
|
|
|
// cocos2d_tests
|
|
|
|
//
|
|
|
|
// Created by Ricardo Quesada on 6/17/16.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Bug-15776.h"
|
|
|
|
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
|
2016-08-05 14:04:39 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// IMPORTANT:
|
|
|
|
// THIS TEST WILL CRASH ON TextureCache::addImage()
|
|
|
|
// THIS IS NOT A BUG
|
|
|
|
// It is expected to crash there
|
|
|
|
//
|
2016-06-18 07:07:33 +08:00
|
|
|
bool Bug15776Layer::init()
|
|
|
|
{
|
|
|
|
if (BugsTestBase::init())
|
|
|
|
{
|
|
|
|
cocos2d::Image *cocos2dxImage = new cocos2d::Image();
|
|
|
|
cocos2dxImage->initWithImageData(nullptr, 0);
|
|
|
|
// should not crash. invalid cocos2dImage
|
|
|
|
auto texture2d = Director::getInstance()->getTextureCache()->addImage(cocos2dxImage, "unused");
|
|
|
|
return texture2d;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2016-08-05 14:04:39 +08:00
|
|
|
|
|
|
|
std::string Bug15776Layer::title() const
|
|
|
|
{
|
|
|
|
return "Testing Issue #15776";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string Bug15776Layer::subtitle() const
|
|
|
|
{
|
|
|
|
return "It should crash on TextureCache::addImage()";
|
|
|
|
}
|