diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 4 | ||||
-rw-r--r-- | main/performance.cpp | 3 | ||||
-rw-r--r-- | main/tests/test_gdscript.cpp | 28 | ||||
-rw-r--r-- | main/tests/test_string.cpp | 14 |
4 files changed, 41 insertions, 8 deletions
diff --git a/main/main.cpp b/main/main.cpp index 0871b12338..fc9ec3b2d9 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1882,7 +1882,9 @@ bool Main::iteration() { uint64_t idle_begin = OS::get_singleton()->get_ticks_usec(); - OS::get_singleton()->get_main_loop()->idle(step * time_scale); + if (OS::get_singleton()->get_main_loop()->idle(step * time_scale)) { + exit = true; + } message_queue->flush(); VisualServer::get_singleton()->sync(); //sync if still drawing from previous frames. diff --git a/main/performance.cpp b/main/performance.cpp index 49a08aa8d1..2f7ebf7656 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -154,7 +154,8 @@ float Performance::get_monitor(Monitor p_monitor) const { case PHYSICS_3D_ISLAND_COUNT: return PhysicsServer::get_singleton()->get_process_info(PhysicsServer::INFO_ISLAND_COUNT); case AUDIO_OUTPUT_LATENCY: return AudioServer::get_singleton()->get_output_latency(); - default: {} + default: { + } } return 0; diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 27180f84aa..87bd640001 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -127,6 +127,7 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) { case GDScriptParser::OperatorNode::OP_PARENT_CALL: txt += "."; + FALLTHROUGH; case GDScriptParser::OperatorNode::OP_CALL: { ERR_FAIL_COND_V(c_node->arguments.size() < 1, ""); @@ -283,10 +284,16 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) { case GDScriptParser::OperatorNode::OP_BIT_XOR: { txt = _parser_expr(c_node->arguments[0]) + "^" + _parser_expr(c_node->arguments[1]); } break; - default: {} + default: { + } } } break; + case GDScriptParser::Node::TYPE_CAST: { + const GDScriptParser::CastNode *cast_node = static_cast<const GDScriptParser::CastNode *>(p_expr); + txt = _parser_expr(cast_node->source_node) + " as " + cast_node->cast_type.to_string(); + + } break; case GDScriptParser::Node::TYPE_NEWLINE: { //skippie @@ -667,6 +674,17 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 2; } break; + case GDScriptFunction::OPCODE_CAST_TO_SCRIPT: { + + txt += " cast "; + txt += DADDR(3); + txt += "="; + txt += DADDR(1); + txt += " as "; + txt += DADDR(2); + incr += 4; + + } break; case GDScriptFunction::OPCODE_CONSTRUCT: { Variant::Type t = Variant::Type(code[ip + 1]); @@ -1016,19 +1034,17 @@ MainLoop *test(TestType p_type) { return NULL; } - GDScript *script = memnew(GDScript); + Ref<GDScript> gds; + gds.instance(); GDScriptCompiler gdc; - err = gdc.compile(&parser, script); + err = gdc.compile(&parser, gds.ptr()); if (err) { print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error()); - memdelete(script); return NULL; } - Ref<GDScript> gds = Ref<GDScript>(script); - Ref<GDScript> current = gds; while (current.is_valid()) { diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index 3465fd783e..dcbb930d1b 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -1053,6 +1053,19 @@ bool test_33() { return empty.parse_utf8(NULL, -1) == true; } +bool test_34() { + OS::get_singleton()->print("\n\nTest 34: Cyrillic to_lower()\n"); + + String upper = L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"; + String lower = L"абвгдеёжзийклмнопрстуфхцчшщъыьэюя"; + + String test = upper.to_lower(); + + bool state = test == lower; + + return state; +} + typedef bool (*TestFunc)(void); TestFunc test_funcs[] = { @@ -1090,6 +1103,7 @@ TestFunc test_funcs[] = { test_31, test_32, test_33, + test_34, 0 }; |