issue #4819: remove AccelerometerTest

This commit is contained in:
minggo 2014-05-28 18:10:37 +08:00
parent 120aa0f24e
commit 0ad0f9c405
7 changed files with 0 additions and 130 deletions

View File

@ -295,8 +295,6 @@
1AC3590A18CEC1FB00F37B72 /* ipadhd in Resources */ = {isa = PBXBuildFile; fileRef = 1AC3590118CEC1FB00F37B72 /* ipadhd */; };
1AC3590B18CEC1FB00F37B72 /* iphone in Resources */ = {isa = PBXBuildFile; fileRef = 1AC3590218CEC1FB00F37B72 /* iphone */; };
1AC3590C18CEC1FB00F37B72 /* iphone in Resources */ = {isa = PBXBuildFile; fileRef = 1AC3590218CEC1FB00F37B72 /* iphone */; };
1AC35B1F18CECF0C00F37B72 /* AccelerometerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3592618CECF0A00F37B72 /* AccelerometerTest.cpp */; };
1AC35B2018CECF0C00F37B72 /* AccelerometerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3592618CECF0A00F37B72 /* AccelerometerTest.cpp */; };
1AC35B2118CECF0C00F37B72 /* ActionManagerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3592918CECF0A00F37B72 /* ActionManagerTest.cpp */; };
1AC35B2218CECF0C00F37B72 /* ActionManagerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3592918CECF0A00F37B72 /* ActionManagerTest.cpp */; };
1AC35B2318CECF0C00F37B72 /* ActionsEaseTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3592C18CECF0A00F37B72 /* ActionsEaseTest.cpp */; };
@ -1337,8 +1335,6 @@
1AC3590218CEC1FB00F37B72 /* iphone */ = {isa = PBXFileReference; lastKnownFileType = folder; name = iphone; path = "../tests/cpp-empty-test/Resources/iphone"; sourceTree = "<group>"; };
1AC3590D18CEC25300F37B72 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1AC3590F18CEC26700F37B72 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1AC3592618CECF0A00F37B72 /* AccelerometerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccelerometerTest.cpp; sourceTree = "<group>"; };
1AC3592718CECF0A00F37B72 /* AccelerometerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccelerometerTest.h; sourceTree = "<group>"; };
1AC3592918CECF0A00F37B72 /* ActionManagerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionManagerTest.cpp; sourceTree = "<group>"; };
1AC3592A18CECF0A00F37B72 /* ActionManagerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionManagerTest.h; sourceTree = "<group>"; };
1AC3592C18CECF0A00F37B72 /* ActionsEaseTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionsEaseTest.cpp; sourceTree = "<group>"; };
@ -2218,7 +2214,6 @@
1AC3592418CECF0A00F37B72 /* Classes */ = {
isa = PBXGroup;
children = (
1AC3592518CECF0A00F37B72 /* AccelerometerTest */,
1AC3592818CECF0A00F37B72 /* ActionManagerTest */,
1AC3592B18CECF0A00F37B72 /* ActionsEaseTest */,
1AC3592E18CECF0A00F37B72 /* ActionsProgressTest */,
@ -2294,15 +2289,6 @@
path = "../tests/cpp-tests/Classes";
sourceTree = "<group>";
};
1AC3592518CECF0A00F37B72 /* AccelerometerTest */ = {
isa = PBXGroup;
children = (
1AC3592618CECF0A00F37B72 /* AccelerometerTest.cpp */,
1AC3592718CECF0A00F37B72 /* AccelerometerTest.h */,
);
path = AccelerometerTest;
sourceTree = "<group>";
};
1AC3592818CECF0A00F37B72 /* ActionManagerTest */ = {
isa = PBXGroup;
children = (
@ -4606,7 +4592,6 @@
1AC35BF918CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
1AC35BF118CECF0C00F37B72 /* EditBoxTest.cpp in Sources */,
1AC35B3918CECF0C00F37B72 /* Bug-1174.cpp in Sources */,
1AC35B1F18CECF0C00F37B72 /* AccelerometerTest.cpp in Sources */,
1AC35BE318CECF0C00F37B72 /* CCControlColourPickerTest.cpp in Sources */,
29080DB1191B595E0066F8DF /* UILayoutTest.cpp in Sources */,
1AC35B2318CECF0C00F37B72 /* ActionsEaseTest.cpp in Sources */,
@ -4785,7 +4770,6 @@
1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
1AC35BF218CECF0C00F37B72 /* EditBoxTest.cpp in Sources */,
1AC35B3A18CECF0C00F37B72 /* Bug-1174.cpp in Sources */,
1AC35B2018CECF0C00F37B72 /* AccelerometerTest.cpp in Sources */,
1AC35BE418CECF0C00F37B72 /* CCControlColourPickerTest.cpp in Sources */,
29080DD4191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */,
1AC35B2418CECF0C00F37B72 /* ActionsEaseTest.cpp in Sources */,

View File

@ -12,7 +12,6 @@ Classes/BaseTest.cpp \
Classes/controller.cpp \
Classes/testBasic.cpp \
Classes/VisibleRect.cpp \
Classes/AccelerometerTest/AccelerometerTest.cpp \
Classes/ActionManagerTest/ActionManagerTest.cpp \
Classes/ActionsEaseTest/ActionsEaseTest.cpp \
Classes/ActionsProgressTest/ActionsProgressTest.cpp \

View File

@ -14,7 +14,6 @@ else()
endif()
set(SAMPLE_SRC
Classes/AccelerometerTest/AccelerometerTest.cpp
Classes/ActionManagerTest/ActionManagerTest.cpp
Classes/ActionsEaseTest/ActionsEaseTest.cpp
Classes/ActionsProgressTest/ActionsProgressTest.cpp

View File

@ -1,81 +0,0 @@
#include "AccelerometerTest.h"
#include "../testResource.h"
#include "cocos2d.h"
#define FIX_POS(_pos, _min, _max) \
if (_pos < _min) \
_pos = _min; \
else if (_pos > _max) \
_pos = _max; \
//------------------------------------------------------------------
//
// AccelerometerTest
//
//------------------------------------------------------------------
AccelerometerTest::AccelerometerTest()
{
}
AccelerometerTest::~AccelerometerTest()
{
_ball->release();
Device::setAccelerometerEnabled(false);
}
std::string AccelerometerTest::title() const
{
return "AccelerometerTest";
}
void AccelerometerTest::onEnter()
{
Layer::onEnter();
Device::setAccelerometerEnabled(true);
auto listener = EventListenerAcceleration::create(CC_CALLBACK_2(AccelerometerTest::onAcceleration, this));
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32.0f);
addChild(label, 1);
label->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y-50) );
_ball = Sprite::create("Images/ball.png");
_ball->setPosition(Vec2(VisibleRect::center().x, VisibleRect::center().y));
addChild(_ball);
_ball->retain();
}
void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event)
{
/*FIXME: Testing on the Nexus S sometimes _ball is NULL */
if ( _ball == nullptr ) {
return;
}
auto ballSize = _ball->getContentSize();
auto pos = _ball->getPosition();
pos.x += acc->x * 9.81f;
pos.y += acc->y * 9.81f;
FIX_POS(pos.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0));
FIX_POS(pos.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0));
_ball->setPosition(pos);
}
//------------------------------------------------------------------
//
// AccelerometerTestScene
//
//------------------------------------------------------------------
void AccelerometerTestScene::runThisTest()
{
auto layer = new AccelerometerTest();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -1,29 +0,0 @@
#ifndef _ACCELEROMETER_TEST_H_
#define _ACCELEROMETER_TEST_H_
#include "../testBasic.h"
USING_NS_CC;
class AccelerometerTest: public Layer
{
protected:
Sprite* _ball;
public:
AccelerometerTest();
~AccelerometerTest();
void onAcceleration(Acceleration* acc, Event* event);
virtual std::string title() const;
virtual void onEnter() override;
};
class AccelerometerTestScene : public TestScene
{
public:
virtual void runThisTest();
};
#endif

View File

@ -34,7 +34,6 @@ Controller g_aTestNames[] = {
// TESTS MUST BE ORDERED ALPHABETICALLY
// violators will be prosecuted
//
{ "Accelerometer", []() { return new AccelerometerTestScene(); } },
{ "ActionManager", [](){return new ActionManagerTestScene(); } },
{ "Actions - Basic", [](){ return new ActionsTestScene(); } },
{ "Actions - Ease", [](){return new ActionsEaseTestScene();} },

View File

@ -32,7 +32,6 @@
#include "Box2DTest/Box2dTest.h"
#include "Box2DTestBed/Box2dView.h"
#include "EffectsAdvancedTest/EffectsAdvancedTest.h"
#include "AccelerometerTest/AccelerometerTest.h"
#include "KeypadTest/KeypadTest.h"
#include "KeyboardTest/KeyboardTest.h"
#include "InputTest/MouseTest.h"