PuzzleSDK
AudioIssue18597Test类 参考

#include <NewAudioEngineTest.h>

+ 类 AudioIssue18597Test 继承关系图:
+ AudioIssue18597Test 的协作图:

Public 成员函数

 CREATE_FUNC (AudioIssue18597Test)
 
virtual bool init () override
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 AudioEngineTestDemo
 AudioEngineTestDemo ()
 
virtual void onExit () override
 
virtual void onBackCallback (cocos2d::Ref *sender) override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 
virtual void onEnter () override
 

Public 属性

float _time
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Protected 属性 继承自 AudioEngineTestDemo
std::shared_ptr< bool > _isDestroyed
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 NewAudioEngineTest.h164 行定义.

成员函数说明

◆ CREATE_FUNC()

AudioIssue18597Test::CREATE_FUNC ( AudioIssue18597Test  )

◆ init()

bool AudioIssue18597Test::init ( )
overridevirtual

在文件 NewAudioEngineTest.cpp658 行定义.

659{
660 if (AudioEngineTestDemo::init())
661 {
662 auto& layerSize = this->getContentSize();
663
664 //test case for https://github.com/cocos2d/cocos2d-x/issues/18597
665 this->schedule([=](float dt)
666 {
667 CCLOG("issues 18597 audio crash test");
668 for (int i = 0; i< 2;++i)
669 {
670 auto id = AudioEngine::play2d("audio/MUS_BGM_Battle_Round1_v1.caf", true, 1.0f);
671 this->runAction(Sequence::create(
672 DelayTime::create(8.0f),
673 CallFunc::create([=]()
674 {
675 AudioEngine::stop(id);
676 }),
677 nullptr
678 ));
679 }
680 }, 2.0, 10000, 0.0, "audio test");
681 // add label to show the side effect of "UnqueueBuffers Before alSourceStop"
682 _time = 0.0;
683 auto labelTime = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "time: ");
684 labelTime->setPosition(layerSize.width * 0.5f, layerSize.height * 0.5f);
685 labelTime->setTag(999);
686 this->addChild(labelTime);
687 // update label quickly
688 this->schedule([=](float dt){
689 _time += dt;
690 char timeString[20] = {0};
691 sprintf(timeString, "Time %2.2f", _time);
692 dynamic_cast<Label *>(this->getChildByTag(999))->setString(timeString);
693 }, 0.05, 1000000, 0, "update label quickly");
694
695 return true;
696 }
697
698 return false;
699}

引用了 _time.

◆ subtitle()

std::string AudioIssue18597Test::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 NewAudioEngineTest.cpp706 行定义.

707{
708 return "no crash for more than 10 minutes";
709}

◆ title()

std::string AudioIssue18597Test::title ( ) const
overridevirtual

重载 AudioEngineTestDemo .

在文件 NewAudioEngineTest.cpp701 行定义.

702{
703 return "Test for issue 18597";
704}

类成员变量说明

◆ _time

float AudioIssue18597Test::_time

在文件 NewAudioEngineTest.h169 行定义.

被这些函数引用 init().


该类的文档由以下文件生成: