aboutsummaryrefslogtreecommitdiff
path: root/fonts/mono_dejavu_sans_20.xml
diff options
context:
space:
mode:
authorMarkus Mattes <markus@mmattes.de>2019-05-25 22:41:47 +0200
committerrubenwardy <rw@rubenwardy.com>2019-06-21 01:29:35 +0100
commite3738c2f61b4ebff97eadce88dda10c9a7610d3d (patch)
treefc3e55eb244c0ed97bb2d2c177c4e02fcf4def10 /fonts/mono_dejavu_sans_20.xml
parent7eb110d503aad0a149df388e1a56d0e468c7efd3 (diff)
downloadminetest-e3738c2f61b4ebff97eadce88dda10c9a7610d3d.tar.gz
minetest-e3738c2f61b4ebff97eadce88dda10c9a7610d3d.tar.bz2
minetest-e3738c2f61b4ebff97eadce88dda10c9a7610d3d.zip
Fix handling of --color and --worldlist command line arguments
They verify the provided value and error if a wrong value got provided command line description for color was differnt on win32 but code did not handle any differenc extended the command line description for world and worldname that it is clear that they only start a local game if used with --go Fixes #7875
Diffstat (limited to 'fonts/mono_dejavu_sans_20.xml')
0 files changed, 0 insertions, 0 deletions
='#n129'>129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
 /*
Minetest
Copyright (C) 2010-2014 kwolekr, Ryan Kwolek <kwolekr@minetest.net>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "test.h"

#include "mapgen/mg_schematic.h"
#include "gamedef.h"
#include "nodedef.h"

class TestSchematic : public TestBase {
public:
	TestSchematic() { TestManager::registerTestModule(this); }
	const char *getName() { return "TestSchematic"; }

	void runTests(IGameDef *gamedef);

	void testMtsSerializeDeserialize(const NodeDefManager *ndef);
	void testLuaTableSerialize(const NodeDefManager *ndef);
	void testFileSerializeDeserialize(const NodeDefManager *ndef);

	static const content_t test_schem1_data[7 * 6 * 4];
	static const content_t test_schem2_data[3 * 3 * 3];
	static const u8 test_schem2_prob[3 * 3 * 3];
	static const char *expected_lua_output;
};

static TestSchematic g_test_instance;

void TestSchematic::runTests(IGameDef *gamedef)
{
	NodeDefManager *ndef =
		(NodeDefManager *)gamedef->getNodeDefManager();

	ndef->setNodeRegistrationStatus(true);

	TEST(testMtsSerializeDeserialize, ndef);
	TEST(testLuaTableSerialize, ndef);
	TEST(testFileSerializeDeserialize, ndef);

	ndef->resetNodeResolveState();
}

////////////////////////////////////////////////////////////////////////////////

void TestSchematic::testMtsSerializeDeserialize(const NodeDefManager *ndef)
{
	static const v3s16 size(7, 6, 4);
	static const u32 volume = size.X * size.Y * size.Z;

	std::stringstream ss(std::ios_base::binary |
		std::ios_base::in | std::ios_base::out);

	Schematic schem;
	{
		std::vector<std::string> &names = schem.m_nodenames;
		names.emplace_back("foo");
		names.emplace_back("bar");
		names.emplace_back("baz");
		names.emplace_back("qux");
	}

	schem.flags       = 0;
	schem.size        = size;
	schem.schemdata   = new MapNode[volume];
	schem.slice_probs = new u8[size.Y];
	for (size_t i = 0; i != volume; i++)
		schem.schemdata[i] = MapNode(test_schem1_data[i], MTSCHEM_PROB_ALWAYS, 0);
	for (s16 y = 0; y != size.Y; y++)
		schem.slice_probs[y] = MTSCHEM_PROB_ALWAYS;

	UASSERT(schem.serializeToMts(&ss));

	ss.seekg(0);

	Schematic schem2;
	UASSERT(schem2.deserializeFromMts(&ss));

	{
		std::vector<std::string> &names = schem2.m_nodenames;
		UASSERTEQ(size_t, names.size(), 4);
		UASSERTEQ(std::string, names[0], "foo");
		UASSERTEQ(std::string, names[1], "bar");
		UASSERTEQ(std::string, names[2], "baz");
		UASSERTEQ(std::string, names[3], "qux");
	}

	UASSERT(schem2.size == size);
	for (size_t i = 0; i != volume; i++)
		UASSERT(schem2.schemdata[i] == schem.schemdata[i]);