mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 06:33:49 +00:00
Merge pull request #1159 from GarageGames/navigation-default-on
Include navigation and testing modules by default
This commit is contained in:
commit
47626684ce
10 changed files with 146 additions and 138 deletions
|
|
@ -25,57 +25,59 @@
|
|||
#include "platform/platformNet.h"
|
||||
#include "core/util/journal/process.h"
|
||||
|
||||
struct TcpHandle
|
||||
{
|
||||
NetSocket mSocket;
|
||||
S32 mDataReceived;
|
||||
|
||||
void notify(NetSocket sock, U32 state)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
|
||||
// Ok - what's the state? We do some dumb responses to given states
|
||||
// in order to fulfill the request.
|
||||
if(state == Net::Connected)
|
||||
{
|
||||
U8 reqBuffer[] = {
|
||||
"GET / HTTP/1.0\nUser-Agent: Torque/1.0\n\n"
|
||||
};
|
||||
|
||||
Net::Error e = Net::sendtoSocket(mSocket, reqBuffer, sizeof(reqBuffer));
|
||||
|
||||
ASSERT_EQ(Net::NoError, e)
|
||||
<< "Got an error sending our HTTP request!";
|
||||
}
|
||||
else
|
||||
{
|
||||
Process::requestShutdown();
|
||||
mSocket = NULL;
|
||||
ASSERT_EQ(Net::Disconnected, state)
|
||||
<< "Ended with a network error!";
|
||||
}
|
||||
}
|
||||
|
||||
void receive(NetSocket sock, RawData incomingData)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
|
||||
mDataReceived += incomingData.size;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(Net, TCPRequest)
|
||||
{
|
||||
struct handle
|
||||
{
|
||||
NetSocket mSocket;
|
||||
S32 mDataReceived;
|
||||
|
||||
void notify(NetSocket sock, U32 state)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
|
||||
// Ok - what's the state? We do some dumb responses to given states
|
||||
// in order to fulfill the request.
|
||||
if(state == Net::Connected)
|
||||
{
|
||||
U8 reqBuffer[] = {
|
||||
"GET / HTTP/1.0\nUser-Agent: Torque/1.0\n\n"
|
||||
};
|
||||
|
||||
Net::Error e = Net::sendtoSocket(mSocket, reqBuffer, sizeof(reqBuffer));
|
||||
|
||||
ASSERT_EQ(Net::NoError, e)
|
||||
<< "Got an error sending our HTTP request!";
|
||||
}
|
||||
else
|
||||
{
|
||||
Process::requestShutdown();
|
||||
mSocket = NULL;
|
||||
ASSERT_EQ(Net::Disconnected, state)
|
||||
<< "Ended with a network error!";
|
||||
}
|
||||
}
|
||||
|
||||
void receive(NetSocket sock, RawData incomingData)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
|
||||
mDataReceived += incomingData.size;
|
||||
}
|
||||
} handler;
|
||||
TcpHandle handler;
|
||||
|
||||
handler.mSocket = InvalidSocket;
|
||||
handler.mDataReceived = 0;
|
||||
|
||||
// Hook into the signals.
|
||||
Net::smConnectionNotify. notify(&handler, &handle::notify);
|
||||
Net::smConnectionReceive.notify(&handler, &handle::receive);
|
||||
Net::smConnectionNotify .notify(&handler, &TcpHandle::notify);
|
||||
Net::smConnectionReceive.notify(&handler, &TcpHandle::receive);
|
||||
|
||||
// Open a TCP connection to garagegames.com
|
||||
handler.mSocket = Net::openConnectTo("72.246.107.193:80");
|
||||
|
|
@ -83,79 +85,81 @@ TEST(Net, TCPRequest)
|
|||
while(Process::processEvents() && (Platform::getRealMilliseconds() < limit) ) {}
|
||||
|
||||
// Unhook from the signals.
|
||||
Net::smConnectionNotify. remove(&handler, &handle::notify);
|
||||
Net::smConnectionReceive.remove(&handler, &handle::receive);
|
||||
Net::smConnectionNotify .remove(&handler, &TcpHandle::notify);
|
||||
Net::smConnectionReceive.remove(&handler, &TcpHandle::receive);
|
||||
|
||||
EXPECT_GT(handler.mDataReceived, 0)
|
||||
<< "Didn't get any data back!";
|
||||
}
|
||||
|
||||
struct JournalHandle
|
||||
{
|
||||
NetSocket mSocket;
|
||||
S32 mDataReceived;
|
||||
|
||||
void notify(NetSocket sock, U32 state)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
|
||||
// Ok - what's the state? We do some dumb responses to given states
|
||||
// in order to fulfill the request.
|
||||
if(state == Net::Connected)
|
||||
{
|
||||
U8 reqBuffer[] = {
|
||||
"GET / HTTP/1.0\nUser-Agent: Torque/1.0\n\n"
|
||||
};
|
||||
|
||||
Net::Error e = Net::sendtoSocket(mSocket, reqBuffer, sizeof(reqBuffer));
|
||||
|
||||
ASSERT_EQ(Net::NoError, e)
|
||||
<< "Got an error sending our HTTP request!";
|
||||
}
|
||||
else
|
||||
{
|
||||
Process::requestShutdown();
|
||||
mSocket = NULL;
|
||||
ASSERT_EQ(Net::Disconnected, state)
|
||||
<< "Ended with a network error!";
|
||||
}
|
||||
}
|
||||
|
||||
void receive(NetSocket sock, RawData incomingData)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
mDataReceived += incomingData.size;
|
||||
}
|
||||
|
||||
void makeRequest()
|
||||
{
|
||||
mSocket = InvalidSocket;
|
||||
mDataReceived = 0;
|
||||
|
||||
// Hook into the signals.
|
||||
Net::smConnectionNotify .notify(this, &JournalHandle::notify);
|
||||
Net::smConnectionReceive.notify(this, &JournalHandle::receive);
|
||||
|
||||
// Open a TCP connection to garagegames.com
|
||||
mSocket = Net::openConnectTo("72.246.107.193:80");
|
||||
|
||||
// Let the callbacks enable things to process.
|
||||
while(Process::processEvents()) {}
|
||||
|
||||
// Unhook from the signals.
|
||||
Net::smConnectionNotify .remove(this, &JournalHandle::notify);
|
||||
Net::smConnectionReceive.remove(this, &JournalHandle::receive);
|
||||
|
||||
EXPECT_GT(mDataReceived, 0)
|
||||
<< "Didn't get any data back!";
|
||||
}
|
||||
};
|
||||
|
||||
TEST(Net, JournalTCPRequest)
|
||||
{
|
||||
struct handle
|
||||
{
|
||||
NetSocket mSocket;
|
||||
S32 mDataReceived;
|
||||
|
||||
void notify(NetSocket sock, U32 state)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
|
||||
// Ok - what's the state? We do some dumb responses to given states
|
||||
// in order to fulfill the request.
|
||||
if(state == Net::Connected)
|
||||
{
|
||||
U8 reqBuffer[] = {
|
||||
"GET / HTTP/1.0\nUser-Agent: Torque/1.0\n\n"
|
||||
};
|
||||
|
||||
Net::Error e = Net::sendtoSocket(mSocket, reqBuffer, sizeof(reqBuffer));
|
||||
|
||||
ASSERT_EQ(Net::NoError, e)
|
||||
<< "Got an error sending our HTTP request!";
|
||||
}
|
||||
else
|
||||
{
|
||||
Process::requestShutdown();
|
||||
mSocket = NULL;
|
||||
ASSERT_EQ(Net::Disconnected, state)
|
||||
<< "Ended with a network error!";
|
||||
}
|
||||
}
|
||||
|
||||
void receive(NetSocket sock, RawData incomingData)
|
||||
{
|
||||
// Only consider our own socket.
|
||||
if(mSocket != sock)
|
||||
return;
|
||||
mDataReceived += incomingData.size;
|
||||
}
|
||||
|
||||
void makeRequest()
|
||||
{
|
||||
mSocket = InvalidSocket;
|
||||
mDataReceived = 0;
|
||||
|
||||
// Hook into the signals.
|
||||
Net::smConnectionNotify. notify(this, &handle::notify);
|
||||
Net::smConnectionReceive.notify(this, &handle::receive);
|
||||
|
||||
// Open a TCP connection to garagegames.com
|
||||
mSocket = Net::openConnectTo("72.246.107.193:80");
|
||||
|
||||
// Let the callbacks enable things to process.
|
||||
while(Process::processEvents()) {}
|
||||
|
||||
// Unhook from the signals.
|
||||
Net::smConnectionNotify. remove(this, &handle::notify);
|
||||
Net::smConnectionReceive.remove(this, &handle::receive);
|
||||
|
||||
EXPECT_GT(mDataReceived, 0)
|
||||
<< "Didn't get any data back!";
|
||||
}
|
||||
} handler;
|
||||
JournalHandle handler;
|
||||
|
||||
Journal::Record("journalTCP.jrn");
|
||||
ASSERT_TRUE(Journal::IsRecording());
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ TEST(File, TouchAndTime)
|
|||
<< "Somehow failed to delete our test file.";
|
||||
};
|
||||
|
||||
// Mac has no implementations for these functions, so we 'def it out for now.
|
||||
#ifndef __MACOSX__
|
||||
// Mac/Linux have no implementations for these functions, so we 'def it out for now.
|
||||
#ifdef WIN32
|
||||
TEST(Platform, Volumes)
|
||||
{
|
||||
Vector<const char*> names;
|
||||
|
|
|
|||
|
|
@ -44,24 +44,26 @@ TEST(Platform, Sleep)
|
|||
<< "We didn't sleep at least as long as we requested!";
|
||||
};
|
||||
|
||||
struct handle
|
||||
{
|
||||
S32 mElapsedTime;
|
||||
S32 mNumberCalls;
|
||||
|
||||
handle() : mElapsedTime(0), mNumberCalls(0) {}
|
||||
|
||||
void timeEvent(S32 timeDelta)
|
||||
{
|
||||
mElapsedTime += timeDelta;
|
||||
mNumberCalls++;
|
||||
|
||||
if(mElapsedTime >= 1000)
|
||||
Process::requestShutdown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(TimeManager, BasicAPI)
|
||||
{
|
||||
struct handle
|
||||
{
|
||||
S32 mElapsedTime;
|
||||
S32 mNumberCalls;
|
||||
|
||||
void timeEvent(S32 timeDelta)
|
||||
{
|
||||
mElapsedTime += timeDelta;
|
||||
mNumberCalls++;
|
||||
|
||||
if(mElapsedTime >= 1000)
|
||||
Process::requestShutdown();
|
||||
}
|
||||
} handler;
|
||||
|
||||
handler.mElapsedTime = handler.mNumberCalls = 0;
|
||||
handle handler;
|
||||
|
||||
// Initialize the time manager...
|
||||
TimeManager time;
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ TEST(Profiler, ProfileStartEnd)
|
|||
// Do work.
|
||||
if(true)
|
||||
{
|
||||
PROFILE_END(ProfileStartEndTest);
|
||||
PROFILE_END();
|
||||
return;
|
||||
}
|
||||
PROFILE_END(ProfileStartEndTest);
|
||||
PROFILE_END();
|
||||
}
|
||||
|
||||
TEST(Profiler, ProfileScope)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue