summaryrefslogtreecommitdiff
path: root/indra/newview/tests
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/tests')
-rw-r--r--indra/newview/tests/llagentaccess_test.cpp4
-rw-r--r--indra/newview/tests/lldateutil_test.cpp15
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp30
-rw-r--r--indra/newview/tests/llsecapi_test.cpp10
-rw-r--r--indra/newview/tests/llsechandler_basic_test.cpp16
-rw-r--r--indra/newview/tests/llslurl_test.cpp14
-rw-r--r--indra/newview/tests/llviewerassetstats_test.cpp2
-rw-r--r--indra/newview/tests/llviewercontrollistener_test.cpp4
-rw-r--r--indra/newview/tests/llviewerhelputil_test.cpp6
-rw-r--r--indra/newview/tests/llviewernetwork_test.cpp14
-rw-r--r--indra/newview/tests/llworldmap_test.cpp4
-rw-r--r--indra/newview/tests/llworldmipmap_test.cpp4
12 files changed, 64 insertions, 59 deletions
diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp
index 6739096baa..6f5b3a9721 100644
--- a/indra/newview/tests/llagentaccess_test.cpp
+++ b/indra/newview/tests/llagentaccess_test.cpp
@@ -55,12 +55,12 @@ LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initi
return NULL;
}
-void LLControlGroup::setU32(const std::string& name, U32 val)
+void LLControlGroup::setU32(std::string_view name, U32 val)
{
test_preferred_maturity = val;
}
-U32 LLControlGroup::getU32(const std::string& name)
+U32 LLControlGroup::getU32(std::string_view name)
{
return test_preferred_maturity;
}
diff --git a/indra/newview/tests/lldateutil_test.cpp b/indra/newview/tests/lldateutil_test.cpp
index e9d4982e35..151aadfd4b 100644
--- a/indra/newview/tests/lldateutil_test.cpp
+++ b/indra/newview/tests/lldateutil_test.cpp
@@ -38,18 +38,23 @@
// Baked-in return values for getString()
-std::map< std::string, std::string > gString;
+std::map< std::string, std::string, std::less<>> gString;
// Baked-in return values for getCountString()
// map of pairs of input xml_desc and integer count
typedef std::pair< std::string, int > count_string_t;
std::map< count_string_t, std::string > gCountString;
-std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
+std::string LLTrans::getString(const std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
- std::string text = gString[xml_desc];
- LLStringUtil::format(text, args);
- return text;
+ auto it = gString.find(xml_desc);
+ if (it != gString.end())
+ {
+ std::string text = it->second;
+ LLStringUtil::format(text, args);
+ return text;
+ }
+ return {};
}
std::string LLTrans::getCountString(const std::string& language, const std::string& xml_desc, S32 count)
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 62250cbbfd..bff2289a7c 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -74,12 +74,12 @@ static LLSD gLoginCreds;
static bool gDisconnectCalled = false;
#include "../llviewerwindow.h"
-void LLViewerWindow::setShowProgress(BOOL show) {}
+void LLViewerWindow::setShowProgress(bool show) {}
LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; }
LLViewerWindow* gViewerWindow;
-std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
return std::string("test_trans");
}
@@ -198,13 +198,13 @@ LLControlGroup gSavedSettings("Global");
LLControlGroup::LLControlGroup(const std::string& name) :
LLInstanceTracker<LLControlGroup, std::string>(name){}
LLControlGroup::~LLControlGroup() {}
-void LLControlGroup::setBOOL(const std::string& name, BOOL val) {}
-BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; }
-F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; }
-U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; }
-void LLControlGroup::setString(const std::string& name, const std::string& val) {}
-std::string LLControlGroup::getString(const std::string& name) { return "test_string"; }
-LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; }
+void LLControlGroup::setBOOL(std::string_view name, bool val) {}
+bool LLControlGroup::getBOOL(std::string_view name) { return false; }
+F32 LLControlGroup::getF32(std::string_view name) { return 0.0f; }
+U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { return 1; }
+void LLControlGroup::setString(std::string_view name, const std::string& val) {}
+std::string LLControlGroup::getString(std::string_view name) { return "test_string"; }
+LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; }
LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; }
#include "lluicolortable.h"
@@ -235,7 +235,7 @@ static LLEventPump * gTOSReplyPump = NULL;
LLPointer<LLSecAPIHandler> gSecAPIHandler;
//static
-LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus)
+LLFloater* LLFloaterReg::showInstance(std::string_view name, const LLSD& key, bool focus)
{
gTOSType = name;
gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]);
@@ -345,13 +345,13 @@ namespace tut
gTOSReplyPump = 0; // clear the callback.
- gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("NoInventoryLibrary", false, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("ConnectAsGod", false, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("UseDebugMenus", false, "", LLControlVariable::PERSIST_NO);
gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO);
gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", LLControlVariable::PERSIST_NO);
- gSavedSettings.declareBOOL("CmdLineSkipUpdater", TRUE, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("LoginLastLocation", false, "", LLControlVariable::PERSIST_NO);
+ gSavedSettings.declareBOOL("CmdLineSkipUpdater", true, "", LLControlVariable::PERSIST_NO);
LLSD authenticator = LLSD::emptyMap();
LLSD identifier = LLSD::emptyMap();
diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp
index ef3da40397..1a2fa7d8f6 100644
--- a/indra/newview/tests/llsecapi_test.cpp
+++ b/indra/newview/tests/llsecapi_test.cpp
@@ -43,8 +43,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name,
const std::string& initial_val,
const std::string& comment,
LLControlVariable::ePersist persist) {return NULL;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-std::string LLControlGroup::getString(const std::string& name)
+void LLControlGroup::setString(std::string_view name, const std::string& val){}
+std::string LLControlGroup::getString(std::string_view name)
{
return "";
}
@@ -109,10 +109,10 @@ namespace tut
{
// retrieve an unknown handler
- ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr);
LLPointer<LLSecAPIHandler> test1_handler = new LLSecAPIBasicHandler();
registerSecHandler("sectest1", test1_handler);
- ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr);
LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1");
ensure("Retrieved sectest1 handler should be the same",
retrieved_test1_handler == test1_handler);
@@ -120,7 +120,7 @@ namespace tut
// insert a second handler
LLPointer<LLSecAPIHandler> test2_handler = new LLSecAPIBasicHandler();
registerSecHandler("sectest2", test2_handler);
- ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+ ensure("'Unknown' handler should be NULL", getSecHandler("unknown") == nullptr);
retrieved_test1_handler = getSecHandler("sectest1");
ensure("Retrieved sectest1 handler should be the same",
retrieved_test1_handler == test1_handler);
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
index bfe32406cb..f6ed745e96 100644
--- a/indra/newview/tests/llsechandler_basic_test.cpp
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -78,8 +78,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name,
const std::string& initial_val,
const std::string& comment,
LLControlVariable::ePersist persist) {return NULL;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-std::string LLControlGroup::getString(const std::string& name)
+void LLControlGroup::setString(std::string_view name, const std::string& val){}
+std::string LLControlGroup::getString(std::string_view name)
{
if (name == "FirstName")
@@ -90,7 +90,7 @@ std::string LLControlGroup::getString(const std::string& name)
}
// Stub for --no-verify-ssl-cert
-BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; }
+bool LLControlGroup::getBOOL(std::string_view name) { return false; }
LLSD LLCredential::getLoginParams()
{
@@ -634,19 +634,19 @@ namespace tut
// Read each of the 4 Pem certs and store in mX509*Cert pointers
BIO * validation_bio;
- validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());
+ validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), static_cast<S32>(mPemTestCert.length()));
PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
BIO_free(validation_bio);
- validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length());
+ validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), static_cast<S32>(mPemRootCert.length()));
PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL);
BIO_free(validation_bio);
- validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length());
+ validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), static_cast<S32>(mPemIntermediateCert.length()));
PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL);
BIO_free(validation_bio);
- validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length());
+ validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), static_cast<S32>(mPemChildCert.length()));
PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL);
BIO_free(validation_bio);
}
@@ -964,7 +964,7 @@ namespace tut
// test creation of credentials
my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator);
// test save without saving authenticator.
- handler->saveCredential(my_cred, FALSE);
+ handler->saveCredential(my_cred, false);
my_new_cred = handler->loadCredential("mysavedgrid");
ensure_equals("saved credential without auth",
(const std::string)my_new_cred->getIdentifier()["type"], "test_type");
diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp
index 92ba68a073..fc9f5b707a 100644
--- a/indra/newview/tests/llslurl_test.cpp
+++ b/indra/newview/tests/llslurl_test.cpp
@@ -46,10 +46,10 @@ static const char * const TEST_FILENAME("llslurl_test.xml");
class LLTrans
{
public:
- static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
+ static std::string getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
};
-std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
return std::string();
}
@@ -64,14 +64,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name,
const std::string& initial_val,
const std::string& comment,
LLControlVariable::ePersist persist) {return NULL;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
+void LLControlGroup::setString(std::string_view name, const std::string& val){}
std::string gCmdLineLoginURI;
std::string gCmdLineGridChoice;
std::string gCmdLineHelperURI;
std::string gLoginPage;
std::string gCurrentGrid;
-std::string LLControlGroup::getString(const std::string& name)
+std::string LLControlGroup::getString(std::string_view name)
{
if (name == "CmdLineGridChoice")
return gCmdLineGridChoice;
@@ -84,7 +84,7 @@ std::string LLControlGroup::getString(const std::string& name)
return "";
}
-LLSD LLControlGroup::getLLSD(const std::string& name)
+LLSD LLControlGroup::getLLSD(std::string_view name)
{
if (name == "CmdLineLoginURI")
{
@@ -96,9 +96,9 @@ LLSD LLControlGroup::getLLSD(const std::string& name)
return LLSD();
}
-LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
+LLPointer<LLControlVariable> LLControlGroup::getControl(std::string_view name)
{
- ctrl_name_table_t::iterator iter = mNameTable.find(name);
+ ctrl_name_table_t::iterator iter = mNameTable.find(name.data());
return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
}
diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp
index 278de5f31c..d5e281bba8 100644
--- a/indra/newview/tests/llviewerassetstats_test.cpp
+++ b/indra/newview/tests/llviewerassetstats_test.cpp
@@ -43,7 +43,7 @@ namespace LLStatViewer
LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample");
}
-void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts)
+void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars)
{
counts.resize(3);
counts[0] = 0;
diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp
index a5eeae8e5b..f261a04544 100644
--- a/indra/newview/tests/llviewercontrollistener_test.cpp
+++ b/indra/newview/tests/llviewercontrollistener_test.cpp
@@ -40,7 +40,7 @@ namespace tut
{
Global.declareString("strvar", "woof", "string variable");
// together we will stroll the boolvar, ma cherie
- Global.declareBOOL("boolvar", TRUE, "bool variable");
+ Global.declareBOOL("boolvar", true, "bool variable");
}
};
typedef test_group<llviewercontrollistener_data> llviewercontrollistener_group;
@@ -167,7 +167,7 @@ namespace tut
"boolvar",
llsd::map("name", "boolvar",
"type", "Boolean",
- "value", TRUE,
+ "value", true,
"comment", "bool variable")));
}
} // namespace tut
diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp
index 7890e9330c..9ee6625bf1 100644
--- a/indra/newview/tests/llviewerhelputil_test.cpp
+++ b/indra/newview/tests/llviewerhelputil_test.cpp
@@ -53,8 +53,8 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name,
const std::string& initial_val,
const std::string& comment,
LLControlVariable::ePersist persist) {return NULL;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-std::string LLControlGroup::getString(const std::string& name)
+void LLControlGroup::setString(std::string_view name, const std::string& val){}
+std::string LLControlGroup::getString(std::string_view name)
{
if (name == "HelpURLFormat")
return gHelpURL;
@@ -75,7 +75,7 @@ static void substitute_string(std::string &input, const std::string &search, con
#include "../llagent.h"
LLAgent::LLAgent() : mAgentAccess(NULL) { }
LLAgent::~LLAgent() { }
-bool LLAgent::isGodlike() const { return FALSE; }
+bool LLAgent::isGodlike() const { return false; }
LLAgent gAgent;
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index cd5e20f6dd..d9cb9e7538 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -45,10 +45,10 @@ static const char * const TEST_FILENAME("llviewernetwork_test.xml");
class LLTrans
{
public:
- static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
+ static std::string getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
};
-std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string)
{
std::string grid_label = std::string();
if(xml_desc == "AgniGridLabel")
@@ -73,14 +73,14 @@ LLControlVariable* LLControlGroup::declareString(const std::string& name,
const std::string& initial_val,
const std::string& comment,
LLControlVariable::ePersist persist) {return NULL;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
+void LLControlGroup::setString(std::string_view name, const std::string& val){}
std::string gCmdLineLoginURI;
std::string gCmdLineGridChoice;
std::string gCmdLineHelperURI;
std::string gLoginPage;
std::string gCurrentGrid;
-std::string LLControlGroup::getString(const std::string& name)
+std::string LLControlGroup::getString(std::string_view name)
{
if (name == "CmdLineGridChoice")
return gCmdLineGridChoice;
@@ -93,7 +93,7 @@ std::string LLControlGroup::getString(const std::string& name)
return "";
}
-LLSD LLControlGroup::getLLSD(const std::string& name)
+LLSD LLControlGroup::getLLSD(std::string_view name)
{
if (name == "CmdLineLoginURI")
{
@@ -105,9 +105,9 @@ LLSD LLControlGroup::getLLSD(const std::string& name)
return LLSD();
}
-LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
+LLPointer<LLControlVariable> LLControlGroup::getControl(std::string_view name)
{
- ctrl_name_table_t::iterator iter = mNameTable.find(name);
+ ctrl_name_table_t::iterator iter = mNameTable.find(name.data());
return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
}
diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp
index 03ab9de96c..d5bf189d82 100644
--- a/indra/newview/tests/llworldmap_test.cpp
+++ b/indra/newview/tests/llworldmap_test.cpp
@@ -49,7 +49,7 @@
// Stub image calls
void LLGLTexture::setBoostLevel(S32 ) { }
void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { }
-LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8,
+LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, bool, LLGLTexture::EBoostLevel, S8,
LLGLint, LLGLenum, LLHost ) { return NULL; }
// Stub related map calls
@@ -66,7 +66,7 @@ void LLWorldMipmap::equalizeBoostLevels() { }
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load) { return NULL; }
// Stub other stuff
-std::string LLTrans::getString(const std::string &, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); }
+std::string LLTrans::getString(std::string_view, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); }
void LLUIString::updateResult() const { }
void LLUIString::setArg(const std::string& , const std::string& ) { }
void LLUIString::assign(const std::string& ) { }
diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp
index dcbee79536..0a5de18e0f 100644
--- a/indra/newview/tests/llworldmipmap_test.cpp
+++ b/indra/newview/tests/llworldmipmap_test.cpp
@@ -43,12 +43,12 @@
// * A simulator for a class can be implemented here. Please comment and document thoroughly.
void LLGLTexture::setBoostLevel(S32 ) { }
-LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8,
+LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, bool, LLGLTexture::EBoostLevel, S8,
LLGLint, LLGLenum, const LLUUID& ) { return NULL; }
LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) { }
LLControlGroup::~LLControlGroup() { }
-std::string LLControlGroup::getString(const std::string& ) { return std::string("test_url"); }
+std::string LLControlGroup::getString(std::string_view) { return std::string("test_url"); }
LLControlGroup gSavedSettings("test_settings");
// End Stubbing