mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 11:36:11 +01:00
WorldGuard has good unit tests for regions, why not use them for PRTreeRegionManager?
LET'S WATCH THE WORLD BURN.
This commit is contained in:
parent
b8642b7ca3
commit
5715e2c835
@ -0,0 +1,47 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldGuard
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldguard.protection;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.BlockVector;
|
||||||
|
import com.sk89q.worldedit.BlockVector2D;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldguard.TestPlayer;
|
||||||
|
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||||
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
|
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||||
|
import com.sk89q.worldguard.protection.managers.FlatRegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
public class FlatRegionManagerTest extends RegionOverlapTest {
|
||||||
|
protected RegionManager createRegionManager() throws Exception {
|
||||||
|
return new FlatRegionManager(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldGuard
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldguard.protection;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.BlockVector;
|
||||||
|
import com.sk89q.worldedit.BlockVector2D;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldguard.TestPlayer;
|
||||||
|
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||||
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
|
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||||
|
import com.sk89q.worldguard.protection.managers.PRTreeRegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
public class PRTreeRegionManagerTest extends RegionOverlapTest {
|
||||||
|
protected RegionManager createRegionManager() throws Exception {
|
||||||
|
return new PRTreeRegionManager(null);
|
||||||
|
}
|
||||||
|
}
|
@ -40,7 +40,7 @@
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class RegionOverlapTest {
|
public abstract class RegionOverlapTest {
|
||||||
static String COURTYARD_ID = "courtyard";
|
static String COURTYARD_ID = "courtyard";
|
||||||
static String FOUNTAIN_ID = "fountain";
|
static String FOUNTAIN_ID = "fountain";
|
||||||
static String NO_FIRE_ID = "nofire";
|
static String NO_FIRE_ID = "nofire";
|
||||||
@ -58,11 +58,13 @@ public class RegionOverlapTest {
|
|||||||
TestPlayer player1;
|
TestPlayer player1;
|
||||||
TestPlayer player2;
|
TestPlayer player2;
|
||||||
|
|
||||||
|
protected abstract RegionManager createRegionManager() throws Exception;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
setUpGlobalRegion();
|
setUpGlobalRegion();
|
||||||
|
|
||||||
manager = new FlatRegionManager(null);
|
manager = createRegionManager();
|
||||||
|
|
||||||
setUpPlayers();
|
setUpPlayers();
|
||||||
setUpCourtyardRegion();
|
setUpCourtyardRegion();
|
||||||
|
Loading…
Reference in New Issue
Block a user