/**************************************************************************/1/* test_parallax_2d.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "scene/2d/parallax_2d.h"33#include "tests/test_macros.h"3435namespace TestParallax2D {3637// Test cases for the Parallax2D class to ensure its properties are set and retrieved correctly.3839TEST_CASE("[SceneTree][Parallax2D] Scroll Scale") {40// Test setting and getting the scroll scale.41Parallax2D *parallax = memnew(Parallax2D);42Size2 scale(2, 2);43parallax->set_scroll_scale(scale);44CHECK(parallax->get_scroll_scale() == scale);45memdelete(parallax);46}4748TEST_CASE("[SceneTree][Parallax2D] Repeat Size") {49// Test setting and getting the repeat size.50Parallax2D *parallax = memnew(Parallax2D);51Size2 size(100, 100);52parallax->set_repeat_size(size);53CHECK(parallax->get_repeat_size() == size);54memdelete(parallax);55}5657TEST_CASE("[SceneTree][Parallax2D] Repeat Times") {58// Test setting and getting the repeat times.59Parallax2D *parallax = memnew(Parallax2D);60int times = 5;61parallax->set_repeat_times(times);62CHECK(parallax->get_repeat_times() == times);63memdelete(parallax);64}6566TEST_CASE("[SceneTree][Parallax2D] Autoscroll") {67// Test setting and getting the autoscroll values.68Parallax2D *parallax = memnew(Parallax2D);69Point2 autoscroll(1, 1);70parallax->set_autoscroll(autoscroll);71CHECK(parallax->get_autoscroll() == autoscroll);72memdelete(parallax);73}7475TEST_CASE("[SceneTree][Parallax2D] Scroll Offset") {76// Test setting and getting the scroll offset.77Parallax2D *parallax = memnew(Parallax2D);78Point2 offset(10, 10);79parallax->set_scroll_offset(offset);80CHECK(parallax->get_scroll_offset() == offset);81memdelete(parallax);82}8384TEST_CASE("[SceneTree][Parallax2D] Screen Offset") {85// Test setting and getting the screen offset.86Parallax2D *parallax = memnew(Parallax2D);87Point2 offset(20, 20);88parallax->set_screen_offset(offset);89CHECK(parallax->get_screen_offset() == offset);90memdelete(parallax);91}9293TEST_CASE("[SceneTree][Parallax2D] Limit Begin") {94// Test setting and getting the limit begin values.95Parallax2D *parallax = memnew(Parallax2D);96Point2 limit_begin(-100, -100);97parallax->set_limit_begin(limit_begin);98CHECK(parallax->get_limit_begin() == limit_begin);99memdelete(parallax);100}101102TEST_CASE("[SceneTree][Parallax2D] Limit End") {103// Test setting and getting the limit end values.104Parallax2D *parallax = memnew(Parallax2D);105Point2 limit_end(100, 100);106parallax->set_limit_end(limit_end);107CHECK(parallax->get_limit_end() == limit_end);108memdelete(parallax);109}110111TEST_CASE("[SceneTree][Parallax2D] Follow Viewport") {112// Test setting and getting the follow viewport flag.113Parallax2D *parallax = memnew(Parallax2D);114parallax->set_follow_viewport(false);115CHECK_FALSE(parallax->get_follow_viewport());116memdelete(parallax);117}118119TEST_CASE("[SceneTree][Parallax2D] Ignore Camera Scroll") {120// Test setting and getting the ignore camera scroll flag.121Parallax2D *parallax = memnew(Parallax2D);122parallax->set_ignore_camera_scroll(true);123CHECK(parallax->is_ignore_camera_scroll());124memdelete(parallax);125}126127} // namespace TestParallax2D128129130