mirror of https://github.com/axmolengine/axmol.git
Test automation support: Fixed may not to restore TestList to the original position.
This commit is contained in:
parent
f502c5900b
commit
8b839edfde
|
@ -128,6 +128,7 @@ protected:
|
|||
TestList::TestList()
|
||||
{
|
||||
_isTestList = true;
|
||||
_shouldRestoreTableOffset = false;
|
||||
}
|
||||
|
||||
void TestList::addTest(const std::string& testName, std::function<TestBase*()> callback)
|
||||
|
@ -156,7 +157,7 @@ void TestList::runThisTest()
|
|||
scene->addChild(tableView);
|
||||
tableView->reloadData();
|
||||
|
||||
if (_tableOffset != Vec2::ZERO)
|
||||
if (_shouldRestoreTableOffset)
|
||||
{
|
||||
tableView->setContentOffset(_tableOffset);
|
||||
}
|
||||
|
@ -217,7 +218,7 @@ void TestList::tableCellTouched(TableView* table, TableViewCell* cell)
|
|||
if (test->getChildTestCount() > 0)
|
||||
{
|
||||
_tableOffset = table->getContentOffset();
|
||||
|
||||
_shouldRestoreTableOffset = true;
|
||||
_cellTouchEnabled = false;
|
||||
test->setTestParent(this);
|
||||
test->runThisTest();
|
||||
|
|
|
@ -195,6 +195,7 @@ public:
|
|||
private:
|
||||
std::vector<std::function<TestBase*()>> _testCallbacks;
|
||||
bool _cellTouchEnabled;
|
||||
bool _shouldRestoreTableOffset;
|
||||
cocos2d::Vec2 _tableOffset;
|
||||
friend class TestController;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue