comparison tests/libclient/js-color/main.cpp @ 42:a47a4477f347

Misc: new style, closes #578
author David Demelier <markand@malikania.fr>
date Tue, 29 Nov 2016 21:21:36 +0100
parents 9af360f34c7d
children fabbe1759cec
comparison
equal deleted inserted replaced
41:3645200f46bf 42:a47a4477f347
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19 #include <gtest/gtest.h> 19 #include <gtest/gtest.h>
20 20
21 #include <malikania/js-color.hpp> 21 #include <malikania/js_color.hpp>
22 22
23 using namespace malikania; 23 using namespace malikania;
24 24
25 class TestColor : public testing::Test { 25 class TestColor : public testing::Test {
26 protected: 26 protected:
485 485
486 TEST_F(TestColor, requireSuccess) 486 TEST_F(TestColor, requireSuccess)
487 { 487 {
488 try { 488 try {
489 duk_push_c_function(m_ctx, [] (auto ctx) { 489 duk_push_c_function(m_ctx, [] (auto ctx) {
490 Color color = dukx_require_color(ctx, 0); 490 auto color = dukx_require_color(ctx, 0);
491 491
492 duk_push_uint(ctx, color.red()); 492 duk_push_uint(ctx, color.red());
493 duk_put_global_string(ctx, "r"); 493 duk_put_global_string(ctx, "r");
494 duk_push_uint(ctx, color.green()); 494 duk_push_uint(ctx, color.green());
495 duk_put_global_string(ctx, "g"); 495 duk_put_global_string(ctx, "g");
599 599
600 TEST_F(TestColor, getNormal) 600 TEST_F(TestColor, getNormal)
601 { 601 {
602 try { 602 try {
603 duk_push_c_function(m_ctx, [] (auto ctx) { 603 duk_push_c_function(m_ctx, [] (auto ctx) {
604 Color color = dukx_get_color(ctx, 0); 604 auto color = dukx_get_color(ctx, 0);
605 605
606 duk_push_uint(ctx, color.red()); 606 duk_push_uint(ctx, color.red());
607 duk_put_global_string(ctx, "r"); 607 duk_put_global_string(ctx, "r");
608 duk_push_uint(ctx, color.green()); 608 duk_push_uint(ctx, color.green());
609 duk_put_global_string(ctx, "g"); 609 duk_put_global_string(ctx, "g");
640 640
641 TEST_F(TestColor, getAdjustRgb) 641 TEST_F(TestColor, getAdjustRgb)
642 { 642 {
643 try { 643 try {
644 duk_push_c_function(m_ctx, [] (auto ctx) { 644 duk_push_c_function(m_ctx, [] (auto ctx) {
645 Color color = dukx_get_color(ctx, 0); 645 auto color = dukx_get_color(ctx, 0);
646 646
647 duk_push_uint(ctx, color.red()); 647 duk_push_uint(ctx, color.red());
648 duk_put_global_string(ctx, "r"); 648 duk_put_global_string(ctx, "r");
649 duk_push_uint(ctx, color.green()); 649 duk_push_uint(ctx, color.green());
650 duk_put_global_string(ctx, "g"); 650 duk_put_global_string(ctx, "g");
681 681
682 TEST_F(TestColor, getAdjustAll) 682 TEST_F(TestColor, getAdjustAll)
683 { 683 {
684 try { 684 try {
685 duk_push_c_function(m_ctx, [] (auto ctx) { 685 duk_push_c_function(m_ctx, [] (auto ctx) {
686 Color color = dukx_get_color(ctx, 0); 686 auto color = dukx_get_color(ctx, 0);
687 687
688 duk_push_uint(ctx, color.red()); 688 duk_push_uint(ctx, color.red());
689 duk_put_global_string(ctx, "r"); 689 duk_put_global_string(ctx, "r");
690 duk_push_uint(ctx, color.green()); 690 duk_push_uint(ctx, color.green());
691 duk_put_global_string(ctx, "g"); 691 duk_put_global_string(ctx, "g");
722 722
723 TEST_F(TestColor, getSomethingElse) 723 TEST_F(TestColor, getSomethingElse)
724 { 724 {
725 try { 725 try {
726 duk_push_c_function(m_ctx, [] (auto ctx) { 726 duk_push_c_function(m_ctx, [] (auto ctx) {
727 Color color = dukx_get_color(ctx, 0); 727 auto color = dukx_get_color(ctx, 0);
728 728
729 duk_push_uint(ctx, color.red()); 729 duk_push_uint(ctx, color.red());
730 duk_put_global_string(ctx, "r"); 730 duk_put_global_string(ctx, "r");
731 duk_push_uint(ctx, color.green()); 731 duk_push_uint(ctx, color.green());
732 duk_put_global_string(ctx, "g"); 732 duk_put_global_string(ctx, "g");