diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-08-09 12:06:09 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-08-09 12:06:09 -0700 |
commit | 9488baada3c0aec7cfa4256708fdda82861cd502 (patch) | |
tree | 1f71293b54161733269a6f340574ec4960623d0f /indra/newview/tests/llagentaccess_test.cpp | |
parent | de08d74dc6da594c20aed3673114cbc0ef6d3305 (diff) | |
parent | 1869a399beb2cb3fa52d21f9c288f4c3b6ab4deb (diff) |
Pull and merge from ssh://hg@bitbucket.org/lindenlab/viewer-beta.
Diffstat (limited to 'indra/newview/tests/llagentaccess_test.cpp')
-rw-r--r-- | indra/newview/tests/llagentaccess_test.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp index 0141a219c5..3ba25f3c10 100644 --- a/indra/newview/tests/llagentaccess_test.cpp +++ b/indra/newview/tests/llagentaccess_test.cpp @@ -84,19 +84,25 @@ namespace tut 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER } template<> template<> @@ -107,33 +113,43 @@ namespace tut 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()); +#endif // HACKED_GODLIKE_VIEWER // 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')); +#endif // HACKED_GODLIKE_VIEWER // 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()); +#endif // HACKED_GODLIKE_VIEWER // Mature aa.setMaturity('M'); +#ifndef HACKED_GODLIKE_VIEWER ensure("3 isTeen", !aa.isTeen()); ensure("3 isMature", aa.isMature()); ensure("3 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER // Adult aa.setMaturity('A'); +#ifndef HACKED_GODLIKE_VIEWER ensure("4 isTeen", !aa.isTeen()); ensure("4 isMature", aa.isMature()); ensure("4 isAdult", aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER } @@ -144,21 +160,35 @@ namespace tut cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); LLAgentAccess aa(cgr); +#ifndef HACKED_GODLIKE_VIEWER ensure("starts normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_NOT); +#ifndef HACKED_GODLIKE_VIEWER ensure("stays normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER ensure("sets full", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_NOT); +#ifndef HACKED_GODLIKE_VIEWER ensure("resets normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setAdminOverride(true); +#ifndef HACKED_GODLIKE_VIEWER ensure("admin true", aa.getAdminOverride()); ensure("overrides 1", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER ensure("overrides 2", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setAdminOverride(false); +#ifndef HACKED_GODLIKE_VIEWER ensure("admin false", !aa.getAdminOverride()); ensure("overrides 3", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER } template<> template<> @@ -168,55 +198,73 @@ namespace tut cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#endif // HACKED_GODLIKE_VIEWER 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()); +#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'); +#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()); +#endif // HACKED_GODLIKE_VIEWER } @@ -229,10 +277,14 @@ namespace tut 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); +#endif // HACKED_GODLIKE_VIEWER aa.setMaturity('P'); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG); +#endif // HACKED_GODLIKE_VIEWER } } |