diff options
Diffstat (limited to 'main/tests')
27 files changed, 212 insertions, 758 deletions
diff --git a/main/tests/test_containers.cpp b/main/tests/test_containers.cpp deleted file mode 100644 index 956be5d169..0000000000 --- a/main/tests/test_containers.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************/ -/* test_containers.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "test_containers.h" - -#include "dvector.h" -#include "math_funcs.h" -#include "print_string.h" -#include "servers/visual/default_mouse_cursor.xpm" -#include "set.h" - -#include "image.h" -#include "list.h" -#include "variant.h" - -namespace TestContainers { - -MainLoop *test() { - - /* - HashMap<int,int> int_map; - - for (int i=0;i<68000;i++) { - - int num=(int)Math::random(0,1024); - int_map[i]=num; - } - */ - - { - - }; - -#if 0 - Set<int> set; - - print_line("Begin Insert"); - for (int i=0;i<1100;i++) { - - int num=i;//(int)Math::random(0,1024); - //print_line("inserting "+itos(num)); - set.insert( num ); - } - - /* - for (int i=0;i<400;i++) { - - int num=(int)Math::random(0,1024); - set.erase(num); - } - */ - //set.print_tree(); - - for(Set<int>::Element *I=set.front();I;I=I->next()) { - - print_line("inserted "+itos(I->get())+" prev is "+itos(I->prev()?I->prev()->get():-100)); - - } - - print_line("depth is "+itos(set.calculate_depth())); - print_line("Insert Success"); -#endif - - return NULL; -} -} diff --git a/main/tests/test_containers.h b/main/tests/test_containers.h deleted file mode 100644 index 7b589d4057..0000000000 --- a/main/tests/test_containers.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* test_containers.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef TEST_CONTAINERS_H -#define TEST_CONTAINERS_H - -#include "os/main_loop.h" -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ - -namespace TestContainers { - -MainLoop *test(); -} - -#endif diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 0607360d88..bcf4278bde 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -1053,16 +1053,6 @@ MainLoop *test(TestType p_type) { memdelete(fw); } -#if 0 - Parser parser; - Error err = parser.parse(code); - if (err) { - print_line("error:"+itos(parser.get_error_line())+":"+itos(parser.get_error_column())+":"+parser.get_error()); - } else { - print_line("Parse O-K!"); - } -#endif - memdelete(fa); return NULL; diff --git a/main/tests/test_gdscript.h b/main/tests/test_gdscript.h index b4e1665de5..f37b175913 100644 --- a/main/tests/test_gdscript.h +++ b/main/tests/test_gdscript.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index 44d4464aac..d9b2873d6b 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -70,32 +70,6 @@ public: SceneTree::init(); -#if 0 - - - Viewport *vp = memnew( Viewport ); - vp->set_world( Ref<World>( memnew( World ))); - get_root()->add_child(vp); - - vp->set_rect(Rect2(0,0,256,256)); - vp->set_as_render_target(true); - vp->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS); - - - Camera *camera = memnew( Camera ); - vp->add_child(camera); - camera->make_current(); - - Sprite *sp = memnew( Sprite ); - sp->set_texture( vp->get_render_target_texture() ); - //sp->set_texture( ResourceLoader::load("res://ball.png") ); - sp->set_position(Point2(300,300)); - get_root()->add_child(sp); - - - return; -#endif - Panel *frame = memnew(Panel); frame->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); frame->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END); @@ -111,7 +85,6 @@ public: label->set_position(Point2(80, 90)); label->set_size(Point2(170, 80)); label->set_align(Label::ALIGN_FILL); - //label->set_text("There"); label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls..."); frame->add_child(label); @@ -124,25 +97,6 @@ public: frame->add_child(button); -#if 0 - Sprite *tf = memnew( Sprite ); - frame->add_child(tf); - Image img; - ImageLoader::load_image("LarvoClub.png",&img); - - img.resize(512,512); - img.generate_mipmaps(); - img.compress(Image::COMPRESS_PVRTC4); - Ref<ImageTexture> tt = memnew( ImageTexture ); - tt->create_from_image(img); - tf->set_texture(tt); - tf->set_position(Point2(50,50)); - //tf->set_scale(Point2(0.3,0.3)); - - - return; -#endif - Tree *tree = memnew(Tree); tree->set_columns(2); @@ -182,9 +136,6 @@ public: frame->add_child(tree); - //control = memnew( Control ); - //root->add_child( control ); - LineEdit *line_edit = memnew(LineEdit); line_edit->set_position(Point2(30, 190)); @@ -244,36 +195,6 @@ public: frame->add_child(options); - /* - Tree * tree = memnew( Tree ); - tree->set_columns(2); - - tree->set_position( Point2( 230,210 ) ); - tree->set_size( Point2( 150,250 ) ); - - - TreeItem *item = tree->create_item(); - item->set_editable(0,true); - item->set_text(0,"root"); - item = tree->create_item( tree->get_root() ); - item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); - item->set_editable(0,true); - item->set_text(0,"check"); - item = tree->create_item( tree->get_root() ); - item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE); - item->set_editable(0,true); - item->set_range_config(0,0,20,0.1); - item->set_range(0,2); - item->add_button(0,Theme::get_default()->get_icon("folder","FileDialog")); - item = tree->create_item( tree->get_root() ); - item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE); - item->set_editable(0,true); - item->set_text(0,"Have,Many,Several,Options!"); - item->set_range(0,2); - - frame->add_child(tree); -*/ - RichTextLabel *richtext = memnew(RichTextLabel); richtext->set_position(Point2(600, 210)); @@ -306,18 +227,10 @@ public: richtext->add_text("keep writing a lot of text"); richtext->pop(); richtext->add_text(" so the label control overflows and the scrollbar appears.\n"); - //richtext->push_indent(1); - //richtext->add_text("By the way, testing indent levels! Yohohoho! Everything should appear to the right sightly here!\n"); - //richtext->pop(); richtext->push_meta("http://www.scrollingcapabilities.xz"); richtext->add_text("This allows to test for the scrolling capabilities "); richtext->pop(); richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, althogh it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains..."); - //richtext->add_text("Hello!\nGorgeous.."); - - //richtext->push_meta("http://www.scrollingcapabilities.xz"); - ///richtext->add_text("Hello!\n"); - //richtext->pop(); TabContainer *tabc = memnew(TabContainer); @@ -346,21 +259,6 @@ public: tabc->set_position(Point2(400, 210)); tabc->set_size(Point2(180, 250)); - - /*Ref<ImageTexture> text = memnew( ImageTexture ); - text->load("test_data/concave.png"); - - Sprite* sprite = memnew(Sprite); - sprite->set_texture(text); - sprite->set_position(Point2(300, 300)); - frame->add_child(sprite); - sprite->show(); - - Sprite* sprite2 = memnew(Sprite); - sprite->set_texture(text); - sprite->add_child(sprite2); - sprite2->set_position(Point2(50, 50)); - sprite2->show();*/ } }; diff --git a/main/tests/test_gui.h b/main/tests/test_gui.h index 881ff96956..a5c5695980 100644 --- a/main/tests/test_gui.h +++ b/main/tests/test_gui.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_image.cpp b/main/tests/test_image.cpp index 0b120f87d5..b94d93b2b1 100644 --- a/main/tests/test_image.cpp +++ b/main/tests/test_image.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_image.h b/main/tests/test_image.h index 3b1783ded7..254bccea85 100644 --- a/main/tests/test_image.h +++ b/main/tests/test_image.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp index f7c49c9249..f96c5cfe3c 100644 --- a/main/tests/test_io.cpp +++ b/main/tests/test_io.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -112,66 +112,6 @@ MainLoop *test() { FileAccess::make_default<FileAccessMemory>(FileAccess::ACCESS_USERDATA); print_line("archive test"); -#if 0 - Archive arch; - - Archive::get_singleton()->add_package("a_package"); - FileAccessArchive f; - - print_line("opening for read"); - f._open("file.txt", FileAccess::READ); - int pos = f.get_pos(); - printf("file has %i bytes, initial pos %i\n", (int)f.get_len(), pos); - - do { - printf("%c", f.get_8()); - - } while (!f.eof_reached()); - - print_line("opening for stored seek"); - f.open("seek.bin", FileAccess::READ); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(128); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - - print_line("opening for deflated seek"); - f.open("seek_deflated.bin", FileAccess::READ); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(128); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(256); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - f.seek(4); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - pos = f.get_pos(); - printf("byte at pos %i is %i\n", pos, (int)f.get_8()); - - f.close(); - - DirAccessArchive d; - String dir = "../blah1/blah2/blahask/../blah3/.//blah4/"; - printf("changing dir to %s\n", dir.utf8().get_data()); - d.change_dir(dir); - printf("current dir is %s\n", d.get_current_dir().utf8().get_data()); - - FileAccessMemory::cleanup(); -#endif }; print_line("test done"); diff --git a/main/tests/test_io.h b/main/tests/test_io.h index 765c083955..ffb834b894 100644 --- a/main/tests/test_io.h +++ b/main/tests/test_io.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp index f3ed4604e1..645db2826e 100644 --- a/main/tests/test_main.cpp +++ b/main/tests/test_main.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,19 +32,17 @@ #ifdef DEBUG_ENABLED -#include "test_containers.h" +#include "test_gdscript.h" #include "test_gui.h" +#include "test_image.h" +#include "test_io.h" #include "test_math.h" +#include "test_ordered_hash_map.h" #include "test_physics.h" #include "test_physics_2d.h" #include "test_render.h" -#include "test_sound.h" -#include "test_string.h" - -#include "test_gdscript.h" -#include "test_image.h" -#include "test_io.h" #include "test_shader_lang.h" +#include "test_string.h" const char **tests_get_names() { @@ -71,11 +69,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { return TestString::test(); } - if (p_test == "containers") { - - return TestContainers::test(); - } - if (p_test == "math") { return TestMath::test(); @@ -103,11 +96,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { } #endif - //if (p_test=="sound") { - - // return TestSound::test(); - //} - if (p_test == "io") { return TestIO::test(); @@ -143,6 +131,11 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { return TestImage::test(); } + if (p_test == "ordered_hash_map") { + + return TestOrderedHashMap::test(); + } + return NULL; } diff --git a/main/tests/test_main.h b/main/tests/test_main.h index da890a4b96..0a50e3c7be 100644 --- a/main/tests/test_main.h +++ b/main/tests/test_main.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index d21be24dab..3ba8ef51b4 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -205,54 +205,12 @@ class GetClassAndNamespace { case 'r': res = 13; break; - /* too much, not needed for now - case 'u': { - //hexnumbarh - oct is deprecated - - - for(int j=0;j<4;j++) { - CharType c = code[idx+j+1]; - if (c==0) { - r_err_str="Unterminated String"; - return ERR_PARSE_ERROR; - } - if (!((c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F'))) { - - r_err_str="Malformed hex constant in string"; - return ERR_PARSE_ERROR; - } - CharType v; - if (c>='0' && c<='9') { - v=c-'0'; - } else if (c>='a' && c<='f') { - v=c-'a'; - v+=10; - } else if (c>='A' && c<='F') { - v=c-'A'; - v+=10; - } else { - ERR_PRINT("BUG"); - v=0; - } - - res<<=4; - res|=v; - - - } - idx+=4; //will add at the end anyway - - - } break;*/ case '\"': res = '\"'; break; case '\\': res = '\\'; break; - //case '/': res='/'; break; default: { res = next; - //r_err_str="Invalid escape sequence"; - //return ERR_PARSE_ERROR; } break; } @@ -413,23 +371,6 @@ void test_vec(Plane p_vec) { print_line("out: " + v0); v0.normal.z = (v0.d / 100.0 * 2.0 - 1.0) * v0.d; print_line("out_F: " + v0); - - /*v0: 0, 0, -0.1, 0.1 -v1: 0, 0, 0, 0.1 -fix: 0, 0, 0, 0.1 -v0: 0, 0, 1.302803, 1.5 -v1: 0, 0, 1.401401, 1.5 -fix: 0, 0, 1.401401, 1.5 -v0: 0, 0, 25.851850, 26 -v1: 0, 0, 25.925926, 26 -fix: 0, 0, 25.925924, 26 -v0: 0, 0, 49.899902, 50 -v1: 0, 0, 49.949947, 50 -fix: 0, 0, 49.949951, 50 -v0: 0, 0, 100, 100 -v1: 0, 0, 100, 100 -fix: 0, 0, 100, 100 -*/ } uint32_t ihash(uint32_t a) { @@ -469,10 +410,9 @@ MainLoop *test() { const float pow2to9 = 512.0f; const float B = 15.0f; - //const float Emax = 31.0f; const float N = 9.0f; - float sharedexp = 65408.000f; //(( pow2to9 - 1.0f)/ pow2to9)*powf( 2.0f, 31.0f - 15.0f); + float sharedexp = 65408.000f; float cRed = MAX(0.0f, MIN(sharedexp, r)); float cGreen = MAX(0.0f, MIN(sharedexp, g)); @@ -480,8 +420,6 @@ MainLoop *test() { float cMax = MAX(cRed, MAX(cGreen, cBlue)); - // expp = MAX(-B - 1, log2(maxc)) + 1 + B - float expp = MAX(-B - 1.0f, floor(Math::log(cMax) / Math_LN2)) + 1.0f + B; float sMax = (float)floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f); @@ -591,8 +529,6 @@ MainLoop *test() { hashes.push_back(hashes.size()); } - //hashes.resize(50); - for (int i = nearest_shift(hashes.size()); i < 20; i++) { bool success = true; @@ -625,7 +561,6 @@ MainLoop *test() { } { - //print_line("NUM: "+itos(237641278346127)); print_line("NUM: " + itos(-128)); return NULL; } @@ -635,14 +570,12 @@ MainLoop *test() { v.normalize(); float a = 0.3; - //Quat q(v,a); Basis m(v, a); Vector3 v2(7, 3, 1); v2.normalize(); float a2 = 0.8; - //Quat q(v,a); Basis m2(v2, a2); Quat q = m; @@ -749,86 +682,6 @@ MainLoop *test() { print_line("scalar /=: " + v); } -#if 0 - print_line(String("C:\\momo\\.\\popo\\..\\gongo").simplify_path()); - print_line(String("res://../popo/..//gongo").simplify_path()); - print_line(String("res://..").simplify_path()); - - - PoolVector<uint8_t> a; - PoolVector<uint8_t> b; - - a.resize(20); - b=a; - b.resize(30); - a=b; -#endif - -#if 0 - String za = String::utf8("รก"); - printf("unicode: %x\n",za[0]); - CharString cs=za.utf8(); - for(int i=0;i<cs.size();i++) { - uint32_t v = uint8_t(cs[i]); - printf("%i - %x\n",i,v); - } - return NULL; - - print_line(String("C:\\window\\system\\momo").path_to("C:\\window\\momonga")); - print_line(String("res://momo/sampler").path_to("res://pindonga")); - print_line(String("/margarito/terere").path_to("/margarito/pilates")); - print_line(String("/algo").path_to("/algo")); - print_line(String("c:").path_to("c:\\")); - print_line(String("/").path_to("/")); - - - print_line(itos(sizeof(Variant))); - return NULL; - - Vector<StringName> path; - path.push_back("three"); - path.push_back("two"); - path.push_back("one"); - path.push_back("comeon"); - path.revert(); - - NodePath np(path,true); - - print_line(np); - - - return NULL; - - bool a=2; - - print_line(Variant(a)); - - - Transform2D mat2_1; - mat2_1.rotate(0.5); - Transform2D mat2_2; - mat2_2.translate(Vector2(1,2)); - Transform2D mat2_3 = mat2_1 * mat2_2; - mat2_3.affine_invert(); - - print_line(mat2_3.elements[0]); - print_line(mat2_3.elements[1]); - print_line(mat2_3.elements[2]); - - - - Transform mat3_1; - mat3_1.basis.rotate(Vector3(0,0,1),0.5); - Transform mat3_2; - mat3_2.translate(Vector3(1,2,0)); - Transform mat3_3 = mat3_1 * mat3_2; - mat3_3.affine_invert(); - - print_line(mat3_3.basis.get_axis(0)); - print_line(mat3_3.basis.get_axis(1)); - print_line(mat3_3.origin); - -#endif return NULL; } } diff --git a/main/tests/test_math.h b/main/tests/test_math.h index 24fd442dd0..a0328a14d0 100644 --- a/main/tests/test_math.h +++ b/main/tests/test_math.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp new file mode 100644 index 0000000000..89f4bf8593 --- /dev/null +++ b/main/tests/test_ordered_hash_map.cpp @@ -0,0 +1,171 @@ +/*************************************************************************/ +/* test_ordered_hash_map.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "ordered_hash_map.h" +#include "os/os.h" +#include "pair.h" +#include "vector.h" + +namespace TestOrderedHashMap { + +bool test_insert() { + OrderedHashMap<int, int> map; + OrderedHashMap<int, int>::Element e = map.insert(42, 84); + + return e && e.key() == 42 && e.get() == 84 && e.value() == 84 && map[42] == 84 && map.has(42) && map.find(42); +} + +bool test_insert_overwrite() { + OrderedHashMap<int, int> map; + map.insert(42, 84); + map.insert(42, 1234); + + return map[42] == 1234; +} + +bool test_erase_via_element() { + OrderedHashMap<int, int> map; + OrderedHashMap<int, int>::Element e = map.insert(42, 84); + + map.erase(e); + return !e && !map.has(42) && !map.find(42); +} + +bool test_erase_via_key() { + OrderedHashMap<int, int> map; + map.insert(42, 84); + map.erase(42); + return !map.has(42) && !map.find(42); +} + +bool test_size() { + OrderedHashMap<int, int> map; + map.insert(42, 84); + map.insert(123, 84); + map.insert(123, 84); + map.insert(0, 84); + map.insert(123485, 84); + + return map.size() == 4; +} + +bool test_iteration() { + OrderedHashMap<int, int> map; + map.insert(42, 84); + map.insert(123, 12385); + map.insert(0, 12934); + map.insert(123485, 1238888); + map.insert(123, 111111); + + Vector<Pair<int, int> > expected; + expected.push_back(Pair<int, int>(42, 84)); + expected.push_back(Pair<int, int>(123, 111111)); + expected.push_back(Pair<int, int>(0, 12934)); + expected.push_back(Pair<int, int>(123485, 1238888)); + + int idx = 0; + for (OrderedHashMap<int, int>::Element E = map.front(); E; E = E.next()) { + if (expected[idx] != Pair<int, int>(E.key(), E.value())) { + return false; + } + ++idx; + } + return true; +} + +bool test_const_iteration(const OrderedHashMap<int, int> &map) { + Vector<Pair<int, int> > expected; + expected.push_back(Pair<int, int>(42, 84)); + expected.push_back(Pair<int, int>(123, 111111)); + expected.push_back(Pair<int, int>(0, 12934)); + expected.push_back(Pair<int, int>(123485, 1238888)); + + int idx = 0; + for (OrderedHashMap<int, int>::ConstElement E = map.front(); E; E = E.next()) { + if (expected[idx] != Pair<int, int>(E.key(), E.value())) { + return false; + } + ++idx; + } + return true; +} + +bool test_const_iteration() { + OrderedHashMap<int, int> map; + map.insert(42, 84); + map.insert(123, 12385); + map.insert(0, 12934); + map.insert(123485, 1238888); + map.insert(123, 111111); + + return test_const_iteration(map); +} + +typedef bool (*TestFunc)(void); + +TestFunc test_funcs[] = { + + test_insert, + test_insert_overwrite, + test_erase_via_element, + test_erase_via_key, + test_size, + test_iteration, + test_const_iteration, + 0 + +}; + +MainLoop *test() { + + int count = 0; + int passed = 0; + + while (true) { + if (!test_funcs[count]) + break; + bool pass = test_funcs[count](); + if (pass) + passed++; + OS::get_singleton()->print("\t%s\n", pass ? "PASS" : "FAILED"); + + count++; + } + + OS::get_singleton()->print("\n\n\n"); + OS::get_singleton()->print("*************\n"); + OS::get_singleton()->print("***TOTALS!***\n"); + OS::get_singleton()->print("*************\n"); + + OS::get_singleton()->print("Passed %i of %i tests\n", passed, count); + + return NULL; +} +} // namespace TestOrderedHashMap
\ No newline at end of file diff --git a/main/tests/test_sound.h b/main/tests/test_ordered_hash_map.h index f55f25fa18..0cde250f56 100644 --- a/main/tests/test_sound.h +++ b/main/tests/test_ordered_hash_map.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* test_sound.h */ +/* test_ordered_hash_map.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,14 +27,12 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef TEST_SOUND_H -#define TEST_SOUND_H +#ifndef TEST_ORDERED_HASH_MAP_H +#define TEST_ORDERED_HASH_MAP_H -#include "os/main_loop.h" - -namespace TestSound { +namespace TestOrderedHashMap { MainLoop *test(); } -#endif // TEST_SOUND_H +#endif diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp index 5a233e818e..f149821928 100644 --- a/main/tests/test_physics.cpp +++ b/main/tests/test_physics.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -71,7 +71,6 @@ class TestPhysicsMainLoop : public MainLoop { PhysicsDirectBodyState *state = (PhysicsDirectBodyState *)p_state; VisualServer *vs = VisualServer::get_singleton(); Transform t = state->get_transform(); - //t.basis.scale( Vector3(1.0,0.5,0.2) ); vs->instance_set_transform(p_visual_instance, t); } @@ -208,7 +207,6 @@ protected: d[VS::ARRAY_VERTEX] = p_faces; d[VS::ARRAY_NORMAL] = normals; vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d); - //vs->material_set_flag( trimesh_mat, VisualServer::MATERIAL_FLAG_UNSHADED,true); RID triins = vs->instance_create2(trimesh_mesh, scenario); @@ -219,9 +217,6 @@ protected: Transform tritrans = p_xform; ps->body_set_state(tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans); vs->instance_set_transform(triins, tritrans); - //RID trimesh_material = vs->fixed_material_create(); - //vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) ); - //vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material ); } void make_grid(int p_width, int p_height, float p_cellsize, float p_cellheight, const Transform &p_xform = Transform()) { @@ -305,7 +300,6 @@ public: /* LIGHT */ RID lightaux = vs->light_create(VisualServer::LIGHT_DIRECTIONAL); - //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); scenario = vs->scenario_create(); vs->light_set_shadow(lightaux, true); light = vs->instance_create2(lightaux, scenario); @@ -327,100 +321,14 @@ public: vs->camera_set_perspective(camera, 60, 0.1, 40.0); vs->camera_set_transform(camera, Transform(Basis(), Vector3(0, 9, 12))); - //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME); Transform gxf; gxf.basis.scale(Vector3(1.4, 0.4, 1.4)); gxf.origin = Vector3(-2, 1, -2); make_grid(5, 5, 2.5, 1, gxf); - //create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,gxf); - //create_static_plane( Plane( Vector3(0,1,0), -2) ); - //test_joint(); test_fall(); - //test_joint(); - - /* - Vector<Vector3> faces; - faces.push_back( Vector3(10,0,-5) ); - faces.push_back( Vector3(0,0,10) ); - faces.push_back( Vector3(-10,-0.2,-5) ); - make_trimesh(faces); -*/ - /* Make Trimesh */ quit = false; return; - -#if 0 -#define GRID_SIZE 5 - - float grid[GRID_SIZE][GRID_SIZE]; - - for (int i=0;i<GRID_SIZE;i++) { - - for (int j=0;j<GRID_SIZE;j++) { - - grid[j][i]=Math::random(0.0, 1.0 ); - } - } - - Vector<Vector3> faces; - - for (int i=1;i<GRID_SIZE;i++) { - - for (int j=1;j<GRID_SIZE;j++) { - -#define MAKE_VERTEX(m_x, m_z) \ - faces.push_back(Vector3(m_x - GRID_SIZE / 2.0, grid[m_x][m_z], m_z - GRID_SIZE / 2.0) * 3.0) - - MAKE_VERTEX(i,j-1); - MAKE_VERTEX(i,j); - MAKE_VERTEX(i-1,j); - - MAKE_VERTEX(i-1,j-1); - MAKE_VERTEX(i,j-1); - MAKE_VERTEX(i-1,j); - - } - } - /* - faces.clear(); - faces.push_back( Vector3(0,0,-5) ); - faces.push_back( Vector3(1,0,-1) ); - faces.push_back( Vector3(-1,-0,-1) ); - */ - - RID trimesh_shape = ps->shape_create(); - ps->shape_set_data(trimesh_shape, PhysicsServer::SHAPE_CONCAVE_POLYGON,faces); - faces=ps->shape_get_shape(trimesh_shape, 0); - Vector<Vector3> normals; // for drawing - for (int i=0;i<faces.size()/3;i++) { - - Plane p( faces[i*3+0],faces[i*3+1], faces[i*3+2] ); - normals.push_back(p.normal); - normals.push_back(p.normal); - normals.push_back(p.normal); - } - - RID trimesh_mesh = vs->mesh_create(); - vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, VS::ARRAY_FORMAT_VERTEX|VS::ARRAY_FORMAT_NORMAL, faces.size() ); - vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_VERTEX, faces ); - vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_NORMAL, normals ); - RID trimesh_mat = vs->fixed_material_create(); - vs->material_generate( trimesh_mat, Color(1.0,0.5,0.3) ); - vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat ); - - RID triins = vs->instance_create2(trimesh_mesh); - - - - RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC, trimesh_shape); - Transform tritrans = Transform( Basis(), Vector3(0,0,-2) ); - ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans ); - vs->instance_set_transform( triins, tritrans ); - RID trimesh_material = vs->fixed_material_create(); - vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) ); - vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material ); -#endif } virtual bool iteration(float p_time) { @@ -445,58 +353,9 @@ public: } void test_joint() { -#if 0 - PhysicsServer * ps = PhysicsServer::get_singleton(); - - mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24))); - RID b = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - - ps->joint_create_double_pin(b,Vector3(0,0,1.0),mover,Vector3(0,0,0)); - ps->body_add_collision_exception(mover,b); - - - List<String> cmdline = OS::get_singleton()->get_cmdline_args(); - int link_count = LINK_COUNT; - if (cmdline.size() > 0 && cmdline[cmdline.size()-1].to_int()) { - link_count = cmdline[cmdline.size()-1].to_int(); - }; - - for(int i=0;i<link_count;i++) { - - RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - ps->joint_create_double_pin(b,Vector3(0,0,-0.7),c,Vector3(0,0,0.7)); - ps->body_add_collision_exception(c,b); - b=c; - } - - - create_static_plane(Plane(Vector3(0,1,0),-8)); -#endif } void test_hinge() { -#if 0 - PhysicsServer * ps = PhysicsServer::get_singleton(); - - - mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24))); - RID b = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform()); - - ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(1,1,1.0)),mover,Transform(Basis(),Vector3(0,0,0))); - ps->body_add_collision_exception(mover,b); - -/* - for(int i=0;i<20;i++) { - - RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform()); - ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(0,0,-0.7)),c,Transform(Basis(),Vector3(0,0,0.7))); - ps->body_add_collision_exception(c,b); - b=c; - } - -*/ - //create_static_plane(Plane(Vector3(0,1,0),-8)); -#endif } void test_character() { @@ -544,35 +403,21 @@ public: }; PhysicsServer::ShapeType type = shape_idx[i % 4]; - //type=PhysicsServer::SHAPE_CONVEX_POLYGON; Transform t; t.origin = Vector3(0.0 * i, 3.5 + 1.1 * i, 0.7 + 0.0 * i); - //t.origin=Vector3(-0.7+0.0*i,0.5+4.1*i,0); t.basis.rotate(Vector3(0.2, -1, 0), Math_PI / 2 * 0.6); - //t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i); - //t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i); - //t.basis.rotate(Vector3(-1,0,0),Math_PI/4*i); create_body(type, PhysicsServer::BODY_MODE_RIGID, t); - //RID b = create_body(type,i==0?PhysicsServer::BODY_MODE_STATIC:PhysicsServer::BODY_MODE_RIGID,t); } create_static_plane(Plane(Vector3(0, 1, 0), -1)); - - /* - create_static_plane( Plane( Vector3(1,0,0), -2) ); - create_static_plane( Plane( Vector3(-1,0,0), -2) ); - create_static_plane( Plane( Vector3(0,0,1), -2) ); - create_static_plane( Plane( Vector3(0,0,-1), -2) ); -*/ } void test_activate() { create_body(PhysicsServer::SHAPE_BOX, PhysicsServer::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true); - //create_body(PhysicsServer::SHAPE_SPHERE,PhysicsServer::BODY_MODE_RIGID,Transform(Basis(),Vector3(0,6,0)),true); create_static_plane(Plane(Vector3(0, 1, 0), -1)); } diff --git a/main/tests/test_physics.h b/main/tests/test_physics.h index 9c9f2fa883..166bc87b4b 100644 --- a/main/tests/test_physics.h +++ b/main/tests/test_physics.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp index 2c9b51aadb..a746973799 100644 --- a/main/tests/test_physics_2d.cpp +++ b/main/tests/test_physics_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_physics_2d.h b/main/tests/test_physics_2d.h index e2022cb1f9..572429185f 100644 --- a/main/tests/test_physics_2d.h +++ b/main/tests/test_physics_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp index 74f7453d1b..1f6217928d 100644 --- a/main/tests/test_render.cpp +++ b/main/tests/test_render.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_render.h b/main/tests/test_render.h index d7849c45ca..84b882de06 100644 --- a/main/tests/test_render.h +++ b/main/tests/test_render.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp index f9516dad99..ddb2ed5e75 100644 --- a/main/tests/test_shader_lang.cpp +++ b/main/tests/test_shader_lang.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -37,7 +37,6 @@ #include "scene/gui/control.h" #include "scene/gui/text_edit.h" #include "servers/visual/shader_language.h" -//#include "drivers/gles2/shader_compiler_gles2.h" typedef ShaderLanguage SL; @@ -317,8 +316,9 @@ MainLoop *test() { SL sl; print_line("tokens:\n\n" + sl.token_debug(code)); - Map<StringName, Map<StringName, SL::DataType> > dt; - dt["fragment"]["ALBEDO"] = SL::TYPE_VEC3; + Map<StringName, SL::FunctionInfo> dt; + dt["fragment"].built_ins["ALBEDO"] = SL::TYPE_VEC3; + dt["fragment"].can_discard = true; Set<String> rm; rm.insert("popo"); diff --git a/main/tests/test_shader_lang.h b/main/tests/test_shader_lang.h index 7d871b72e7..203f3ffa87 100644 --- a/main/tests/test_shader_lang.h +++ b/main/tests/test_shader_lang.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_sound.cpp b/main/tests/test_sound.cpp deleted file mode 100644 index d8737f6c8d..0000000000 --- a/main/tests/test_sound.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************/ -/* test_sound.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "test_sound.h" -#include "math_funcs.h" -#include "os/main_loop.h" -#include "servers/visual_server.h" - -#include "io/resource_loader.h" -#include "os/os.h" -#include "print_string.h" -#include "servers/audio_server.h" - -#if 0 -namespace TestSound { - - -class TestMainLoop : public MainLoop { - - bool quit; - Ref<Sample> sample; - -public: - virtual void input_event(const InputEvent& p_event) { - - - } - virtual void request_quit() { - - quit=true; - } - - virtual void init() { - - List<String> cmdline = OS::get_singleton()->get_cmdline_args(); - quit=false; - if (cmdline.size()) { - - sample=ResourceLoader::load(cmdline.back()->get()); - ERR_FAIL_COND(sample.is_null()); - print_line("Sample loaded OK"); - } - - RID voice = AudioServer::get_singleton()->voice_create(); - AudioServer::get_singleton()->voice_play( voice, sample->get_rid() ); - - - } - - virtual bool idle(float p_time) { - return false; - } - - - virtual bool iteration(float p_time) { - - return quit; - } - virtual void finish() { - - } - -}; - - -MainLoop* test() { - - return memnew( TestMainLoop ); - -} - -} -#endif diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index 0ff84a8286..88d7702acc 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/main/tests/test_string.h b/main/tests/test_string.h index 1060adbc8d..9c97b13626 100644 --- a/main/tests/test_string.h +++ b/main/tests/test_string.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ |