summaryrefslogtreecommitdiff
path: root/indra/newview/tests/llagentaccess_test.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-29 07:43:28 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-29 07:56:09 +0300
commit1b68f71348ecf3983b76b40d7940da8377f049b7 (patch)
tree2974eddaef130a067c26033d60a59fc790365b3d /indra/newview/tests/llagentaccess_test.cpp
parentaf4ea94efc1999f3b19fd8d643d0331f0b77e265 (diff)
#824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed
Diffstat (limited to 'indra/newview/tests/llagentaccess_test.cpp')
-rw-r--r--indra/newview/tests/llagentaccess_test.cpp338
1 files changed, 169 insertions, 169 deletions
diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp
index 45ce1ba62f..6739096baa 100644
--- a/indra/newview/tests/llagentaccess_test.cpp
+++ b/indra/newview/tests/llagentaccess_test.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llagentaccess_test.cpp
* @brief LLAgentAccess tests
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,7 +40,7 @@
static U32 test_preferred_maturity = SIM_ACCESS_PG;
LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name)
+: LLInstanceTracker<LLControlGroup, std::string>(name)
{
}
@@ -51,241 +51,241 @@ LLControlGroup::~LLControlGroup()
// Implementation of just the LLControlGroup methods we requre
LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist)
{
- test_preferred_maturity = initial_val;
- return NULL;
+ test_preferred_maturity = initial_val;
+ return NULL;
}
void LLControlGroup::setU32(const std::string& name, U32 val)
{
- test_preferred_maturity = val;
+ test_preferred_maturity = val;
}
U32 LLControlGroup::getU32(const std::string& name)
{
- return test_preferred_maturity;
+ return test_preferred_maturity;
}
//----------------------------------------------------------------------------
-
+
namespace tut
{
struct agentaccess
{
};
-
- typedef test_group<agentaccess> agentaccess_t;
- typedef agentaccess_t::object agentaccess_object_t;
- tut::agentaccess_t tut_agentaccess("LLAgentAccess");
-
- template<> template<>
- void agentaccess_object_t::test<1>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
+
+ typedef test_group<agentaccess> agentaccess_t;
+ typedef agentaccess_t::object agentaccess_object_t;
+ tut::agentaccess_t tut_agentaccess("LLAgentAccess");
+
+ template<> template<>
+ void agentaccess_object_t::test<1>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 prefersPG", aa.prefersPG());
- ensure("1 prefersMature", !aa.prefersMature());
- ensure("1 prefersAdult", !aa.prefersAdult());
+ ensure("1 prefersPG", aa.prefersPG());
+ ensure("1 prefersMature", !aa.prefersMature());
+ ensure("1 prefersAdult", !aa.prefersAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("2 prefersPG", !aa.prefersPG());
- ensure("2 prefersMature", aa.prefersMature());
- ensure("2 prefersAdult", !aa.prefersAdult());
+ ensure("2 prefersPG", !aa.prefersPG());
+ ensure("2 prefersMature", aa.prefersMature());
+ ensure("2 prefersAdult", !aa.prefersAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("3 prefersPG", !aa.prefersPG());
- ensure("3 prefersMature", aa.prefersMature());
- ensure("3 prefersAdult", aa.prefersAdult());
+ ensure("3 prefersPG", !aa.prefersPG());
+ ensure("3 prefersMature", aa.prefersMature());
+ ensure("3 prefersAdult", aa.prefersAdult());
#endif // HACKED_GODLIKE_VIEWER
}
-
- template<> template<>
- void agentaccess_object_t::test<2>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
- // make sure default is PG
+
+ template<> template<>
+ void agentaccess_object_t::test<2>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
+ // make sure default is PG
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 isTeen", aa.isTeen());
- ensure("1 isMature", !aa.isMature());
- ensure("1 isAdult", !aa.isAdult());
+ ensure("1 isTeen", aa.isTeen());
+ ensure("1 isMature", !aa.isMature());
+ ensure("1 isAdult", !aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- // check the conversion routine
+
+ // check the conversion routine
#ifndef HACKED_GODLIKE_VIEWER
- ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P'));
- ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M'));
- ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A'));
- ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q'));
+ ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P'));
+ ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M'));
+ ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A'));
+ ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q'));
#endif // HACKED_GODLIKE_VIEWER
-
- // now try the other method of setting it - PG
- aa.setMaturity('P');
- ensure("2 isTeen", aa.isTeen());
+
+ // now try the other method of setting it - PG
+ aa.setMaturity('P');
+ ensure("2 isTeen", aa.isTeen());
#ifndef HACKED_GODLIKE_VIEWER
- ensure("2 isMature", !aa.isMature());
- ensure("2 isAdult", !aa.isAdult());
+ ensure("2 isMature", !aa.isMature());
+ ensure("2 isAdult", !aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- // Mature
- aa.setMaturity('M');
+
+ // Mature
+ aa.setMaturity('M');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("3 isTeen", !aa.isTeen());
- ensure("3 isMature", aa.isMature());
- ensure("3 isAdult", !aa.isAdult());
+ ensure("3 isTeen", !aa.isTeen());
+ ensure("3 isMature", aa.isMature());
+ ensure("3 isAdult", !aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- // Adult
- aa.setMaturity('A');
+
+ // Adult
+ aa.setMaturity('A');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("4 isTeen", !aa.isTeen());
- ensure("4 isMature", aa.isMature());
- ensure("4 isAdult", aa.isAdult());
+ ensure("4 isTeen", !aa.isTeen());
+ ensure("4 isMature", aa.isMature());
+ ensure("4 isAdult", aa.isAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- }
-
- template<> template<>
- void agentaccess_object_t::test<3>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
+
+ }
+
+ template<> template<>
+ void agentaccess_object_t::test<3>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
#ifndef HACKED_GODLIKE_VIEWER
- ensure("starts normal", !aa.isGodlike());
+ ensure("starts normal", !aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_NOT);
+ aa.setGodLevel(GOD_NOT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("stays normal", !aa.isGodlike());
+ ensure("stays normal", !aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_FULL);
+ aa.setGodLevel(GOD_FULL);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("sets full", aa.isGodlike());
+ ensure("sets full", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_NOT);
+ aa.setGodLevel(GOD_NOT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("resets normal", !aa.isGodlike());
+ ensure("resets normal", !aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setAdminOverride(true);
+ aa.setAdminOverride(true);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("admin true", aa.getAdminOverride());
- ensure("overrides 1", aa.isGodlike());
+ ensure("admin true", aa.getAdminOverride());
+ ensure("overrides 1", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setGodLevel(GOD_FULL);
+ aa.setGodLevel(GOD_FULL);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("overrides 2", aa.isGodlike());
+ ensure("overrides 2", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
- aa.setAdminOverride(false);
+ aa.setAdminOverride(false);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("admin false", !aa.getAdminOverride());
- ensure("overrides 3", aa.isGodlike());
+ ensure("admin false", !aa.getAdminOverride());
+ ensure("overrides 3", aa.isGodlike());
#endif // HACKED_GODLIKE_VIEWER
}
-
- template<> template<>
- void agentaccess_object_t::test<4>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
+
+ template<> template<>
+ void agentaccess_object_t::test<4>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 pg to start", aa.wantsPGOnly());
- ensure("2 pg to start", !aa.canAccessMature());
- ensure("3 pg to start", !aa.canAccessAdult());
+ ensure("1 pg to start", aa.wantsPGOnly());
+ ensure("2 pg to start", !aa.canAccessMature());
+ ensure("3 pg to start", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setGodLevel(GOD_FULL);
+
+ aa.setGodLevel(GOD_FULL);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 full god", !aa.wantsPGOnly());
- ensure("2 full god", aa.canAccessMature());
- ensure("3 full god", aa.canAccessAdult());
+ ensure("1 full god", !aa.wantsPGOnly());
+ ensure("2 full god", aa.canAccessMature());
+ ensure("3 full god", aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setGodLevel(GOD_NOT);
- aa.setAdminOverride(true);
+
+ aa.setGodLevel(GOD_NOT);
+ aa.setAdminOverride(true);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 admin mode", !aa.wantsPGOnly());
- ensure("2 admin mode", aa.canAccessMature());
- ensure("3 admin mode", aa.canAccessAdult());
+ ensure("1 admin mode", !aa.wantsPGOnly());
+ ensure("2 admin mode", aa.canAccessMature());
+ ensure("3 admin mode", aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
- aa.setAdminOverride(false);
- aa.setMaturity('M');
- // preferred is still pg by default
+ aa.setAdminOverride(false);
+ aa.setMaturity('M');
+ // preferred is still pg by default
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 mature pref pg", aa.wantsPGOnly());
- ensure("2 mature pref pg", !aa.canAccessMature());
- ensure("3 mature pref pg", !aa.canAccessAdult());
+ ensure("1 mature pref pg", aa.wantsPGOnly());
+ ensure("2 mature pref pg", !aa.canAccessMature());
+ ensure("3 mature pref pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 mature", !aa.wantsPGOnly());
- ensure("2 mature", aa.canAccessMature());
- ensure("3 mature", !aa.canAccessAdult());
+ ensure("1 mature", !aa.wantsPGOnly());
+ ensure("2 mature", aa.canAccessMature());
+ ensure("3 mature", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_PG);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 mature pref pg", aa.wantsPGOnly());
- ensure("2 mature pref pg", !aa.canAccessMature());
- ensure("3 mature pref pg", !aa.canAccessAdult());
+ ensure("1 mature pref pg", aa.wantsPGOnly());
+ ensure("2 mature pref pg", !aa.canAccessMature());
+ ensure("3 mature pref pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setMaturity('A');
+
+ aa.setMaturity('A');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 adult pref pg", aa.wantsPGOnly());
- ensure("2 adult pref pg", !aa.canAccessMature());
- ensure("3 adult pref pg", !aa.canAccessAdult());
+ ensure("1 adult pref pg", aa.wantsPGOnly());
+ ensure("2 adult pref pg", !aa.canAccessMature());
+ ensure("3 adult pref pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 adult", !aa.wantsPGOnly());
- ensure("2 adult", aa.canAccessMature());
- ensure("3 adult", aa.canAccessAdult());
+ ensure("1 adult", !aa.wantsPGOnly());
+ ensure("2 adult", aa.canAccessMature());
+ ensure("3 adult", aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
- // make sure that even if pref is high, if access is low we block access
- // this shouldn't occur in real life but we want to be safe
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
- aa.setMaturity('P');
+ // make sure that even if pref is high, if access is low we block access
+ // this shouldn't occur in real life but we want to be safe
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+ aa.setMaturity('P');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 pref adult, actual pg", aa.wantsPGOnly());
- ensure("2 pref adult, actual pg", !aa.canAccessMature());
- ensure("3 pref adult, actual pg", !aa.canAccessAdult());
+ ensure("1 pref adult, actual pg", aa.wantsPGOnly());
+ ensure("2 pref adult, actual pg", !aa.canAccessMature());
+ ensure("3 pref adult, actual pg", !aa.canAccessAdult());
#endif // HACKED_GODLIKE_VIEWER
-
- }
-
- template<> template<>
- void agentaccess_object_t::test<5>()
- {
- LLControlGroup cgr("test");
- cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
- LLAgentAccess aa(cgr);
-
- cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
- aa.setMaturity('M');
+
+ }
+
+ template<> template<>
+ void agentaccess_object_t::test<5>()
+ {
+ LLControlGroup cgr("test");
+ cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO);
+ LLAgentAccess aa(cgr);
+
+ cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT);
+ aa.setMaturity('M');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE);
+ ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE);
#endif // HACKED_GODLIKE_VIEWER
-
- aa.setMaturity('P');
+
+ aa.setMaturity('P');
#ifndef HACKED_GODLIKE_VIEWER
- ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG);
+ ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG);
#endif // HACKED_GODLIKE_VIEWER
- }
+ }
}