diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 4 | ||||
-rw-r--r-- | main/tests/test_string.cpp | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index fc9ec3b2d9..da77962c8a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1027,7 +1027,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false)); - OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(GLOBAL_DEF("application/run/low_processor_mode_sleep_usec", 8000)); + OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(GLOBAL_DEF("application/run/low_processor_mode_sleep_usec", 6900)); // Roughly 144 FPS ProjectSettings::get_singleton()->set_custom_property_info("application/run/low_processor_mode_sleep_usec", PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater")); // No negative numbers Engine::get_singleton()->set_frame_delay(frame_delay); @@ -1949,7 +1949,7 @@ bool Main::iteration() { return exit; if (OS::get_singleton()->is_in_low_processor_usage_mode() || !OS::get_singleton()->can_draw()) - OS::get_singleton()->delay_usec(OS::get_singleton()->get_low_processor_usage_mode_sleep_usec()); //apply some delay to force idle time (results in about 60 FPS max) + OS::get_singleton()->delay_usec(OS::get_singleton()->get_low_processor_usage_mode_sleep_usec()); //apply some delay to force idle time else { uint32_t frame_delay = Engine::get_singleton()->get_frame_delay(); if (frame_delay) diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index dcbb930d1b..531887a452 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -33,6 +33,7 @@ //#include "core/math/math_funcs.h" #include "core/io/ip_address.h" #include "core/os/os.h" +#include "modules/regex/regex.h" #include <stdio.h> #include "test_string.h" @@ -429,9 +430,20 @@ bool test_25() { bool test_26() { - //TODO: Do replacement RegEx test - return true; -}; + OS::get_singleton()->print("\n\nTest 26: RegEx substitution\n"); + + String s = "Double all the vowels."; + + OS::get_singleton()->print("\tString: %ls\n", s.c_str()); + OS::get_singleton()->print("\tRepeating instances of 'aeiou' once\n"); + + RegEx re("(?<vowel>[aeiou])"); + s = re.sub(s, "$0$vowel", true); + + OS::get_singleton()->print("\tResult: %ls\n", s.c_str()); + + return (s == "Doouublee aall thee vooweels."); +} struct test_27_data { char const *data; |