Removed random bridge tile in 2-5. Implemented case insensitivity test function and corresponding unit test. Release Build 13345.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m1s
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m1s
This commit is contained in:
parent
33ef7e47cd
commit
0300a1133e
@ -108,6 +108,13 @@ namespace FileTests
|
||||
SetupTest();
|
||||
SetupMockMap();
|
||||
}
|
||||
TEST_METHOD(ImageLoadsProperRegardlessOfCaseSensitivity){
|
||||
Sprite testSpr;
|
||||
Assert::AreEqual(int(olc::rcode::OK),int(testSpr.LoadFromFile("assets/title_transparent.png")),L"Normal image loading works");
|
||||
Assert::ExpectException<std::runtime_error>([&testSpr](){testSpr.LoadFromFile("assets/title_transparentfdjakl.png");},L"Expected loading an invalid sprite to fail.");
|
||||
Assert::AreEqual(int(olc::rcode::OK),int(testSpr.LoadFromFile("assets/title_transparent.png")),L"Normal image loading works");
|
||||
Assert::AreEqual(int(olc::rcode::OK),int(testSpr.LoadFromFile("ASSets/TITle_transparent.PNg")),L"Alternate casing also works and results in proper loading.");
|
||||
}
|
||||
TEST_METHOD_CLEANUP(CleanupFileTests){
|
||||
testGame->EndGame();
|
||||
testGame->OnUserUpdate(0.f);
|
||||
|
||||
@ -430,5 +430,19 @@ namespace ItemTests
|
||||
Assert::AreEqual(size_t(0),itemCount,util::wformat("UI component count in inventory window is still empty in category {} during file saving",category).c_str());
|
||||
}
|
||||
}
|
||||
TEST_METHOD(ConsumedLoadoutSlotTest){
|
||||
Inventory::AddItem("Health Potion"s,4);
|
||||
Inventory::AddItem("Mana Potion"s,2);
|
||||
Inventory::AddItem("Elixir of the Wind"s,1);
|
||||
Inventory::AddItem("Boar Meat"s,3);
|
||||
game->SetLoadoutItem(0,"Health Potion");
|
||||
game->SetLoadoutItem(1,"Mana Potion");
|
||||
game->SetLoadoutItem(2,"Elixir of the Wind");
|
||||
const bool usedItemResult{game->UseLoadoutItem(2)};
|
||||
const bool usedItemResult2{game->UseLoadoutItem(2)};
|
||||
Assert::AreEqual(true,usedItemResult,L"Item should have been consumed.");
|
||||
Assert::AreEqual(false,usedItemResult2,L"No valid item anymore in slot.");
|
||||
game->SetLoadoutItem(2,"Boar Meat");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -21,7 +21,11 @@ Check block slowdown effect for monster
|
||||
Monster visual effect for block not working
|
||||
|
||||
Detailed Descriptions
|
||||
Advanced Tooltips
|
||||
Finish Advanced Tooltips
|
||||
Case Insensitivity
|
||||
Enemy Sprites for Chapter 4 to pixel artist
|
||||
Google Unit Testing
|
||||
|
||||
|
||||
Buy-Sell ability to reach the tab buttons
|
||||
Item Loadout inventory selector
|
||||
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 13331
|
||||
#define VERSION_BUILD 13345
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
@ -953,7 +953,7 @@
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
@ -24,7 +24,7 @@ CAMPAIGN_2_1 = 2026-01-21 20:30:58.3756334
|
||||
CAMPAIGN_2_2 = 2026-01-21 20:30:58.3769261
|
||||
CAMPAIGN_2_3 = 2026-04-13 20:04:48.1801993
|
||||
CAMPAIGN_2_4 = 2026-01-21 20:30:58.3804324
|
||||
CAMPAIGN_2_5 = 2026-01-21 20:30:58.3825577
|
||||
CAMPAIGN_2_5 = 2026-04-22 02:07:26.4326535
|
||||
CAMPAIGN_2_6 = 2026-01-21 20:30:58.3836104
|
||||
CAMPAIGN_2_7 = 2026-01-21 20:30:58.3846135
|
||||
CAMPAIGN_2_8 = 2026-01-21 20:30:58.3866133
|
||||
|
||||
@ -356,6 +356,7 @@ namespace olc
|
||||
{
|
||||
ma_sound_uninit(vecSounds.at(id));
|
||||
delete vecSounds.at(id);
|
||||
if(vecSounds.size()<id)return;
|
||||
vecSounds.at(id) = nullptr;
|
||||
if(vecResourceData.count(id)){
|
||||
if(ma_resource_manager_unregister_data(ma_engine_get_resource_manager(&engine),vecResourceData[id].pathName.data())!=MA_SUCCESS)ERR(std::format("WARNING! Could not clear resources for {}!",vecResourceData[id].pathName));
|
||||
|
||||
@ -408,6 +408,7 @@ return 0;
|
||||
#include "Error.h"
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#include "Pixel.h"
|
||||
#include "util.h"
|
||||
#include "TEST_DEFINES.h"
|
||||
#pragma endregion
|
||||
|
||||
@ -1698,7 +1699,7 @@ namespace olc
|
||||
olc::rcode Sprite::LoadFromFile(const std::string& sImageFile, olc::ResourcePack* pack)
|
||||
{
|
||||
UNUSED(pack);
|
||||
return loader->LoadImageResource(this, sImageFile, pack);
|
||||
return loader->LoadImageResource(this, util::GetCaseInsensitiveFilename(sImageFile), pack);
|
||||
}
|
||||
|
||||
olc::Sprite* Sprite::Duplicate()
|
||||
|
||||
@ -37,8 +37,8 @@ All rights reserved.
|
||||
#pragma endregion
|
||||
#include "util.h"
|
||||
#include "olcPixelGameEngine.h"
|
||||
#include "olcPGEX_TTF.h"
|
||||
#include "Entity.h"
|
||||
#include"olcPGEX_TTF.h"
|
||||
#include <string>
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 rng(rd());
|
||||
@ -236,4 +236,23 @@ const float util::dirToAngle(const Direction dir){
|
||||
}
|
||||
ERR(std::format("WARNING! Could not find Direction {}! THIS SHOULD NOT BE HAPPENING!",int(dir)));
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
|
||||
const std::string util::toLower(const std::string oldStr){
|
||||
std::string newStr;
|
||||
std::ranges::transform(oldStr,std::back_inserter(newStr),[](char c)->char{return std::tolower(c);});
|
||||
return newStr;
|
||||
}
|
||||
|
||||
const std::string util::GetCaseInsensitiveFilename(const std::string&filename){
|
||||
if(std::filesystem::exists(filename))return filename;
|
||||
if(!std::filesystem::path{filename}.has_parent_path())ERR("WARNING! Invalid path {} for filename {}! THIS SHOULD NOT BE HAPPENING!");
|
||||
for(auto&path:std::filesystem::recursive_directory_iterator(std::filesystem::path{filename}.parent_path())){
|
||||
if(path.is_regular_file()&&util::toLower(path.path().filename().string())==util::toLower(std::filesystem::path{filename}.filename().string())){
|
||||
return path.path().string();
|
||||
}
|
||||
}
|
||||
ERR("WARNING! Could not find or match case for filename {}! THIS SHOULD NOT BE HAPPENING!");
|
||||
std::unreachable();
|
||||
}
|
||||
@ -38,13 +38,18 @@ All rights reserved.
|
||||
#pragma once
|
||||
#include <stdlib.h>
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#include "olcPGEX_TTF.h"
|
||||
#include "Direction.h"
|
||||
#include"Pixel.h"
|
||||
#include <random>
|
||||
#include <optional>
|
||||
|
||||
class Entity;
|
||||
|
||||
namespace olc{
|
||||
class Font;
|
||||
class PixelGameEngine;
|
||||
};
|
||||
|
||||
namespace olc::util{
|
||||
//Returns 0-range (as a float).
|
||||
float random(float range);
|
||||
@ -113,6 +118,10 @@ namespace olc::util{
|
||||
T map_range(T x, T in_min, T in_max, T out_min, T out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
|
||||
const std::string toLower(const std::string oldStr);
|
||||
|
||||
const std::string GetCaseInsensitiveFilename(const std::string&filename);
|
||||
}
|
||||
|
||||
template<class TL, class TR>
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user