diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 4142872d83..f73229a5c2 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -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 = ""; }; 1AC3590D18CEC25300F37B72 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1AC3590F18CEC26700F37B72 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 1AC3592618CECF0A00F37B72 /* AccelerometerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccelerometerTest.cpp; sourceTree = ""; }; - 1AC3592718CECF0A00F37B72 /* AccelerometerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccelerometerTest.h; sourceTree = ""; }; 1AC3592918CECF0A00F37B72 /* ActionManagerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionManagerTest.cpp; sourceTree = ""; }; 1AC3592A18CECF0A00F37B72 /* ActionManagerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionManagerTest.h; sourceTree = ""; }; 1AC3592C18CECF0A00F37B72 /* ActionsEaseTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionsEaseTest.cpp; sourceTree = ""; }; @@ -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 = ""; }; - 1AC3592518CECF0A00F37B72 /* AccelerometerTest */ = { - isa = PBXGroup; - children = ( - 1AC3592618CECF0A00F37B72 /* AccelerometerTest.cpp */, - 1AC3592718CECF0A00F37B72 /* AccelerometerTest.h */, - ); - path = AccelerometerTest; - sourceTree = ""; - }; 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 */, diff --git a/tests/cpp-tests/Android.mk b/tests/cpp-tests/Android.mk index f678d83b32..bcf53c2263 100644 --- a/tests/cpp-tests/Android.mk +++ b/tests/cpp-tests/Android.mk @@ -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 \ diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index f0e70599e7..32c8e8421f 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -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 diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp deleted file mode 100644 index 2ec0db333b..0000000000 --- a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp +++ /dev/null @@ -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); -} diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h deleted file mode 100644 index 28669d6a1a..0000000000 --- a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h +++ /dev/null @@ -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 diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 30ec74c1eb..375dd8c5b4 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -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();} }, diff --git a/tests/cpp-tests/Classes/tests.h b/tests/cpp-tests/Classes/tests.h index 06ec824dc7..a780586f37 100644 --- a/tests/cpp-tests/Classes/tests.h +++ b/tests/cpp-tests/Classes/tests.h @@ -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"