Many changes, refactoring, adding new features
This commit is contained in:
parent
042f6dc15c
commit
709ad0be94
@ -1,6 +1,8 @@
|
|||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
eclipse.project.name = appName + '-core'
|
eclipse.project.name = appName + '-core'
|
||||||
|
|
||||||
|
sourceSets.test.java.srcDirs = [ "src/test/java/" ]
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
|
api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
|
||||||
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
||||||
@ -17,4 +19,11 @@ dependencies {
|
|||||||
api "games.rednblack.miniaudio:miniaudio:$miniaudioVersion"
|
api "games.rednblack.miniaudio:miniaudio:$miniaudioVersion"
|
||||||
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
||||||
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3"
|
||||||
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform {
|
||||||
|
}
|
||||||
|
}
|
0
core/nbproject/project.properties
Normal file
0
core/nbproject/project.properties
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||||
|
// Copyright (C) 2024 the original author or authors.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
package com.openeggbert.compatibility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class FileExtension {
|
||||||
|
private FileExtension() {
|
||||||
|
//Not meant to be instantiated.
|
||||||
|
}
|
||||||
|
public boolean isOpenEggbertOnly(String fileExtension) {
|
||||||
|
return fileExtension != null && !fileExtension.toLowerCase().equals(BLP);
|
||||||
|
}
|
||||||
|
private static final String BLP = "blp";
|
||||||
|
}
|
@ -0,0 +1,131 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||||
|
// Copyright (C) 2024 the original author or authors.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
package com.openeggbert.compatibility;
|
||||||
|
|
||||||
|
import com.openeggbert.entity.common.OpenEggbertException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum FileNameCaseType {
|
||||||
|
UPPERCASE,
|
||||||
|
LOWERCASE,
|
||||||
|
CAPITALIZATION;
|
||||||
|
|
||||||
|
public static String convertToString(String string, FileNameCaseType fileNameCaseType) {
|
||||||
|
if (fileNameCaseType == null) {
|
||||||
|
throw new OpenEggbertException("Argument fileNameCaseType is null, which is forbidden");
|
||||||
|
}
|
||||||
|
if (string == null) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
if (string.isEmpty()) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
switch (fileNameCaseType) {
|
||||||
|
case UPPERCASE:
|
||||||
|
return string.toUpperCase();
|
||||||
|
case LOWERCASE:
|
||||||
|
return string.toLowerCase();
|
||||||
|
case CAPITALIZATION:
|
||||||
|
return Character.toUpperCase(string.charAt(0)) + (string.length() == 1 ? "" : string.substring(1).toLowerCase());
|
||||||
|
default:
|
||||||
|
throw new OpenEggbertException("Unsupported FileNameCaseType: " + fileNameCaseType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FileNameCaseType ofString(String string) {
|
||||||
|
|
||||||
|
boolean uppercaseOnly = true;
|
||||||
|
boolean lowercaseOnly = true;
|
||||||
|
|
||||||
|
for (char ch : string.toCharArray()) {
|
||||||
|
|
||||||
|
if (Character.isLetter(ch)) {
|
||||||
|
boolean uppercase = Character.isUpperCase(ch);
|
||||||
|
boolean lowercase = Character.isLowerCase(ch);
|
||||||
|
|
||||||
|
if (uppercase) {
|
||||||
|
lowercaseOnly = false;
|
||||||
|
}
|
||||||
|
if (lowercase) {
|
||||||
|
uppercaseOnly = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (uppercaseOnly) {
|
||||||
|
return UPPERCASE;
|
||||||
|
}
|
||||||
|
if (lowercaseOnly) {
|
||||||
|
return LOWERCASE;
|
||||||
|
}
|
||||||
|
if (!uppercaseOnly && !lowercaseOnly) {
|
||||||
|
char firstChar = string.charAt(0);
|
||||||
|
char[] charArray = string.toCharArray();
|
||||||
|
List<Character> charList = new ArrayList<>();
|
||||||
|
for (Character ch : charArray) {
|
||||||
|
charList.add(ch);
|
||||||
|
}
|
||||||
|
Stream<Character> charStream = charList.stream();
|
||||||
|
|
||||||
|
boolean thereIsNoUppercaseCharacterExcludingTheFirstCharacter
|
||||||
|
= charStream
|
||||||
|
.skip(1)
|
||||||
|
.filter(c -> Character.isLetter(c))
|
||||||
|
.filter(c -> Character.isUpperCase(c))
|
||||||
|
.count() == 0;
|
||||||
|
if ((Character.isLetter(firstChar) ? Character.isUpperCase(firstChar) : true)
|
||||||
|
&& thereIsNoUppercaseCharacterExcludingTheFirstCharacter) {
|
||||||
|
return CAPITALIZATION;
|
||||||
|
} else {
|
||||||
|
throw new OpenEggbertException("1Could not find FileNameCaseType from String: " + string);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
throw new OpenEggbertException("2Could not find FileNameCaseType from String: " + string);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sortStringsByFileNameCaseType(List<String> list) {
|
||||||
|
Collections.sort(list,
|
||||||
|
new FileNameCaseTypeStringComparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
static class FileNameCaseTypeStringComparator implements Comparator<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(String o1, String o2) {
|
||||||
|
FileNameCaseType t1 = FileNameCaseType.ofString(o1);
|
||||||
|
FileNameCaseType t2 = FileNameCaseType.ofString(o2);
|
||||||
|
int i1 = t1 == UPPERCASE ? 1 : (t1 == LOWERCASE ? 2 : 3);
|
||||||
|
int i2 = t2 == UPPERCASE ? 1 : (t2 == LOWERCASE ? 2 : 3);
|
||||||
|
return Integer.valueOf(i1).compareTo(i2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,21 +25,16 @@ import lombok.Getter;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public enum ImageFormats {
|
public enum ImageFormat {
|
||||||
BMP("blp", "bmp"),
|
BMP("blp", "bmp"),
|
||||||
PNG("png"),
|
PNG("png"),
|
||||||
JPEG("jpeg")
|
JPEG("jpeg")
|
||||||
;
|
;
|
||||||
@Getter
|
@Getter
|
||||||
private String[] fileExtensions;
|
private String[] fileExtensions;
|
||||||
@Getter
|
|
||||||
private boolean openEggbertOnly;
|
ImageFormat(String... fileExtensionsIn) {
|
||||||
ImageFormats(String... fileExtensionsIn) {
|
|
||||||
this(true, fileExtensionsIn);
|
|
||||||
}
|
|
||||||
ImageFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) {
|
|
||||||
this.fileExtensions = fileExtensionsIn;
|
this.fileExtensions = fileExtensionsIn;
|
||||||
this.openEggbertOnly = openEggbertOnlyIn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -25,22 +25,16 @@ import lombok.Getter;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public enum MusicFormats {
|
public enum MusicFormat {
|
||||||
MIDI("blp", "mid"),
|
MIDI("blp", "mid"),
|
||||||
|
WAV("wav"),
|
||||||
MP3("mp3"),
|
MP3("mp3"),
|
||||||
OGG("ogg"),
|
OGG("ogg"),
|
||||||
WAV("wav")
|
|
||||||
;
|
;
|
||||||
@Getter
|
@Getter
|
||||||
private String[] fileExtensions;
|
private String[] fileExtensions;
|
||||||
@Getter
|
MusicFormat(String... fileExtensionsIn) {
|
||||||
private boolean openEggbertOnly;
|
|
||||||
MusicFormats(String... fileExtensionsIn) {
|
|
||||||
this(true, fileExtensionsIn);
|
|
||||||
}
|
|
||||||
MusicFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) {
|
|
||||||
this.fileExtensions = fileExtensionsIn;
|
this.fileExtensions = fileExtensionsIn;
|
||||||
this.openEggbertOnly = openEggbertOnlyIn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -25,21 +25,15 @@ import lombok.Getter;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public enum SoundFormats {
|
public enum SoundFormat {
|
||||||
WAV("blp", "wav"),
|
WAV("blp", "wav"),
|
||||||
MP3("mp3"),
|
MP3("mp3"),
|
||||||
OGG("ogg")
|
OGG("ogg")
|
||||||
;
|
;
|
||||||
@Getter
|
@Getter
|
||||||
private String[] fileExtensions;
|
private String[] fileExtensions;
|
||||||
@Getter
|
SoundFormat(String... fileExtensionsIn) {
|
||||||
private boolean openEggbertOnly;
|
|
||||||
SoundFormats(String... fileExtensionsIn) {
|
|
||||||
this(true, fileExtensionsIn);
|
|
||||||
}
|
|
||||||
SoundFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) {
|
|
||||||
this.fileExtensions = fileExtensionsIn;
|
this.fileExtensions = fileExtensionsIn;
|
||||||
this.openEggbertOnly = openEggbertOnlyIn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,23 @@
|
|||||||
/*
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
// Copyright (C) 2024 the original author or authors.
|
||||||
*/
|
//
|
||||||
|
// 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
|
||||||
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
package com.openeggbert.entity.common;
|
package com.openeggbert.entity.common;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,5 +25,5 @@ package com.openeggbert.entity.common;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public enum GameFileType {
|
public enum GameFileType {
|
||||||
CONFIG, WORLD, MUSIC, SOUND, IMAGE8, IMAGE16, IMAGE32;
|
CONFIG, WORLD, DEMO, SAVE, USER_INFO, MUSIC, SOUND, IMAGE8, IMAGE16, IMAGE32;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||||
|
// Copyright (C) 2024 the original author or authors.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
package com.openeggbert.entity.common;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum ImageType {
|
||||||
|
SPRITE, SCREEN_BACKGROUND;
|
||||||
|
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.openeggbert.main;
|
package com.openeggbert.main;
|
||||||
|
|
||||||
|
import com.openeggbert.utils.AssetsTxt;
|
||||||
import com.badlogic.gdx.Game;
|
import com.badlogic.gdx.Game;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
|
@ -25,5 +25,5 @@ package com.openeggbert.mods;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public enum ModType {
|
public enum ModType {
|
||||||
FULL, LEVEL, SOUND, MUSIC, IMAGE08, IMAGE16, IMAGE24,IMAGE24X2, PARTIAL;
|
FULL, LEVEL, SOUND, MUSIC, IMAGE08, IMAGE16, IMAGE24, IMAGE24X2, TEXT, PARTIAL;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.openeggbert.main;
|
package com.openeggbert.utils;
|
||||||
|
|
||||||
import com.badlogic.gdx.Application;
|
import com.badlogic.gdx.Application;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
@ -19,6 +19,13 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.openeggbert.utils;
|
package com.openeggbert.utils;
|
||||||
|
|
||||||
|
import com.openeggbert.compatibility.FileNameCaseType;
|
||||||
|
import com.openeggbert.compatibility.ImageFormat;
|
||||||
|
import com.openeggbert.compatibility.MusicFormat;
|
||||||
|
import com.openeggbert.compatibility.SoundFormat;
|
||||||
|
import com.openeggbert.entity.common.GameFileType;
|
||||||
|
import com.openeggbert.entity.common.OpenEggbertException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -29,14 +36,83 @@ import java.util.stream.Stream;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class OpenEggbertUtils {
|
public class OpenEggbertUtils {
|
||||||
|
|
||||||
private OpenEggbertUtils() {
|
private OpenEggbertUtils() {
|
||||||
//Not meant to be instantiated.
|
//Not meant to be instantiated.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stream<String> lines(String string) {
|
public static Stream<String> lines(String string) {
|
||||||
return Arrays.asList(string.split("\\r?\\n")).stream();
|
return Arrays.asList(string.split("\\r?\\n")).stream();
|
||||||
}
|
}
|
||||||
public static <T> List<T> streamToList(Stream<T> stream) {
|
|
||||||
|
public static <T> List<T> streamToList(Stream<T> stream) {
|
||||||
return stream.collect(Collectors.toList());
|
return stream.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<String> createPossibleFileNames(GameFileType gameFileType, String fileName) {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
if (gameFileType.name().startsWith(IMAGE)) {
|
||||||
|
String fileNameWithoutExtension = getFileNameWithoutExtension(fileName);
|
||||||
|
|
||||||
|
for (ImageFormat imageFormat : ImageFormat.values()) {
|
||||||
|
fillListWithPossibleFileNamesForGivenFileExtension(imageFormat.getFileExtensions(), fileNameWithoutExtension, list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameFileType == GameFileType.MUSIC) {
|
||||||
|
String fileNameWithoutExtension = getFileNameWithoutExtension(fileName);
|
||||||
|
|
||||||
|
for (MusicFormat musicFormat : MusicFormat.values()) {
|
||||||
|
fillListWithPossibleFileNamesForGivenFileExtension(musicFormat.getFileExtensions(), fileNameWithoutExtension, list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameFileType == GameFileType.SOUND) {
|
||||||
|
String fileNameWithoutExtension = getFileNameWithoutExtension(fileName);
|
||||||
|
|
||||||
|
for (SoundFormat soundFormat : SoundFormat.values()) {
|
||||||
|
fillListWithPossibleFileNamesForGivenFileExtension(soundFormat.getFileExtensions(), fileNameWithoutExtension, list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
gameFileType == GameFileType.CONFIG ||
|
||||||
|
gameFileType == GameFileType.WORLD ||
|
||||||
|
gameFileType == GameFileType.DEMO ||
|
||||||
|
gameFileType == GameFileType.SAVE ||
|
||||||
|
gameFileType == GameFileType.USER_INFO
|
||||||
|
) {
|
||||||
|
for (FileNameCaseType fileNameCaseType : FileNameCaseType.values()) {
|
||||||
|
list.add(FileNameCaseType.convertToString(fileName, fileNameCaseType));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
throw new OpenEggbertException("Unsupported GameFileType: " + gameFileType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fillListWithPossibleFileNamesForGivenFileExtension(String[] fileExtensions, String fileNameWithoutExtension, List<String> list) {
|
||||||
|
for (String fileExtension : fileExtensions) {
|
||||||
|
String fileNameWithExtension = fileNameWithoutExtension + "." + fileExtension;
|
||||||
|
for (FileNameCaseType fileNameCaseType : FileNameCaseType.values()) {
|
||||||
|
list.add(FileNameCaseType.convertToString(fileNameWithExtension, fileNameCaseType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static final String IMAGE = "IMAGE";
|
||||||
|
|
||||||
|
public static String getFileNameWithoutExtension(String fileName) {
|
||||||
|
int dotIndex = -1;
|
||||||
|
for (int i = fileName.length() - 1; i >= 0; i--) {
|
||||||
|
char ch = fileName.charAt(i);
|
||||||
|
if (ch == '.') {
|
||||||
|
dotIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dotIndex == -1 ? fileName : fileName.substring(0, dotIndex);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,236 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||||
|
// Copyright (C) 2024 the original author or authors.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
package com.openeggbert.compatibility;
|
||||||
|
|
||||||
|
import com.openeggbert.entity.common.GameFileType;
|
||||||
|
import com.openeggbert.entity.common.OpenEggbertException;
|
||||||
|
import com.openeggbert.utils.OpenEggbertUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class FileNameCaseTypeTest {
|
||||||
|
|
||||||
|
public FileNameCaseTypeTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.jupiter.api.BeforeAll
|
||||||
|
public static void setUpClass() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.jupiter.api.AfterAll
|
||||||
|
public static void tearDownClass() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.jupiter.api.BeforeEach
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.jupiter.api.AfterEach
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Test of values method, of class FileNameCaseType.
|
||||||
|
// */
|
||||||
|
// @org.junit.jupiter.api.Test
|
||||||
|
// public void testValues() {
|
||||||
|
// System.out.println("values");
|
||||||
|
// FileNameCaseType[] expResult = null;
|
||||||
|
// FileNameCaseType[] result = FileNameCaseType.values();
|
||||||
|
// assertArrayEquals(expResult, result);
|
||||||
|
// // TODO review the generated test code and remove the default call to fail.
|
||||||
|
// fail("The test case is a prototype.");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Test of valueOf method, of class FileNameCaseType.
|
||||||
|
// */
|
||||||
|
// @org.junit.jupiter.api.Test
|
||||||
|
// public void testValueOf() {
|
||||||
|
// System.out.println("valueOf");
|
||||||
|
// String name = "";
|
||||||
|
// FileNameCaseType expResult = null;
|
||||||
|
// FileNameCaseType result = FileNameCaseType.valueOf(name);
|
||||||
|
// assertEquals(expResult, result);
|
||||||
|
// // TODO review the generated test code and remove the default call to fail.
|
||||||
|
// fail("The test case is a prototype.");
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* Test of ofString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@org.junit.jupiter.api.Test
|
||||||
|
public void ofStringExpectedReturnedValueIsUPPERCASE() {
|
||||||
|
System.out.println("ofString");
|
||||||
|
String string = "BLUPI000.BLP";
|
||||||
|
|
||||||
|
FileNameCaseType expResult = FileNameCaseType.UPPERCASE;
|
||||||
|
FileNameCaseType result = FileNameCaseType.ofString(string);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of ofString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@org.junit.jupiter.api.Test
|
||||||
|
public void ofStringExpectedReturnedValueIsLOWERCASE() {
|
||||||
|
System.out.println("ofString");
|
||||||
|
String string = "blupi000.blp";
|
||||||
|
|
||||||
|
FileNameCaseType expResult = FileNameCaseType.LOWERCASE;
|
||||||
|
FileNameCaseType result = FileNameCaseType.ofString(string);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of ofString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@org.junit.jupiter.api.Test
|
||||||
|
public void ofStringExpectedReturnedValueIsCAPITALIZATION() {
|
||||||
|
System.out.println("ofString");
|
||||||
|
String string = "Blupi000.blp";
|
||||||
|
|
||||||
|
FileNameCaseType expResult = FileNameCaseType.CAPITALIZATION;
|
||||||
|
FileNameCaseType result = FileNameCaseType.ofString(string);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of ofString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@org.junit.jupiter.api.Test
|
||||||
|
public void ofStringExpectedThrowingException() {
|
||||||
|
String string = "BlupI000.blp";
|
||||||
|
assertThrows(OpenEggbertException.class, () -> {
|
||||||
|
FileNameCaseType.ofString(string);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of ofString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@org.junit.jupiter.api.Test
|
||||||
|
public void ofStringExpectedThrowingException2() {
|
||||||
|
String string = "Blupi000.Blp";
|
||||||
|
assertThrows(OpenEggbertException.class, () -> {
|
||||||
|
FileNameCaseType.ofString(string);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of ofString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@org.junit.jupiter.api.Test
|
||||||
|
public void ofStringExpectedThrowingException3() {
|
||||||
|
String string = "Blupi000.BLP";
|
||||||
|
assertThrows(OpenEggbertException.class, () -> {
|
||||||
|
FileNameCaseType.ofString(string);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of convertToString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testConvertToString() {
|
||||||
|
System.out.println("convertToString");
|
||||||
|
String string = "BLUPI000.BLP";
|
||||||
|
FileNameCaseType fileNameCaseType = FileNameCaseType.LOWERCASE;
|
||||||
|
String expResult = "blupi000.blp";
|
||||||
|
String result = FileNameCaseType.convertToString(string, fileNameCaseType);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of convertToString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testConvertToString2() {
|
||||||
|
System.out.println("convertToString");
|
||||||
|
String string = "blupi000.blp";
|
||||||
|
FileNameCaseType fileNameCaseType = FileNameCaseType.UPPERCASE;
|
||||||
|
String expResult = "BLUPI000.BLP";
|
||||||
|
String result = FileNameCaseType.convertToString(string, fileNameCaseType);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of convertToString method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testConvertToString3() {
|
||||||
|
System.out.println("convertToString");
|
||||||
|
String string = "blupi000.blp";
|
||||||
|
FileNameCaseType fileNameCaseType = FileNameCaseType.CAPITALIZATION;
|
||||||
|
String expResult = "Blupi000.blp";
|
||||||
|
String result = FileNameCaseType.convertToString(string, fileNameCaseType);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of sortStringsByFileNameCaseType method, of class FileNameCaseType.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSortStringsByFileNameCaseType() {
|
||||||
|
System.out.println("testSortStringsByFileNameCaseType");
|
||||||
|
GameFileType gameFileType = GameFileType.SOUND;
|
||||||
|
String fileName = "BLUPI";
|
||||||
|
String string = "BLUPI.BLP\n"
|
||||||
|
+ "blupi.blp\n"
|
||||||
|
+ "Blupi.blp\n"
|
||||||
|
+ "BLUPI.WAV\n"
|
||||||
|
+ "blupi.wav\n"
|
||||||
|
+ "Blupi.wav\n"
|
||||||
|
+ "BLUPI.MP3\n"
|
||||||
|
+ "blupi.mp3\n"
|
||||||
|
+ "Blupi.mp3\n"
|
||||||
|
+ "BLUPI.OGG\n"
|
||||||
|
+ "blupi.ogg\n"
|
||||||
|
+ "Blupi.ogg";
|
||||||
|
String expResult = "BLUPI.BLP\n"
|
||||||
|
+ "BLUPI.WAV\n"
|
||||||
|
+ "BLUPI.MP3\n"
|
||||||
|
+ "BLUPI.OGG\n"
|
||||||
|
+ "blupi.blp\n"
|
||||||
|
+ "blupi.wav\n"
|
||||||
|
+ "blupi.mp3\n"
|
||||||
|
+ "blupi.ogg\n"
|
||||||
|
+ "Blupi.blp\n"
|
||||||
|
+ "Blupi.wav\n"
|
||||||
|
+ "Blupi.mp3\n"
|
||||||
|
+ "Blupi.ogg";
|
||||||
|
|
||||||
|
List<String> list = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName);
|
||||||
|
FileNameCaseType.sortStringsByFileNameCaseType(list);
|
||||||
|
String result = list.stream().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,231 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
|
||||||
|
// Copyright (C) 2024 the original author or authors.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
package com.openeggbert.utils;
|
||||||
|
|
||||||
|
import com.openeggbert.entity.common.GameFileType;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class OpenEggbertUtilsTest {
|
||||||
|
|
||||||
|
public OpenEggbertUtilsTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
public static void setUpClass() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
public static void tearDownClass() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Test of lines method, of class OpenEggbertUtils.
|
||||||
|
// */
|
||||||
|
// @Test
|
||||||
|
// public void testLines() {
|
||||||
|
// System.out.println("lines");
|
||||||
|
// String string = "";
|
||||||
|
// Stream<String> expResult = null;
|
||||||
|
// Stream<String> result = OpenEggbertUtils.lines(string);
|
||||||
|
// assertEquals(expResult, result);
|
||||||
|
// // TODO review the generated test code and remove the default call to fail.
|
||||||
|
// fail("The test case is a prototype.");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Test of streamToList method, of class OpenEggbertUtils.
|
||||||
|
// */
|
||||||
|
// @Test
|
||||||
|
// public void testStreamToList() {
|
||||||
|
// System.out.println("streamToList");
|
||||||
|
// List expResult = null;
|
||||||
|
// List result = OpenEggbertUtils.streamToList(null);
|
||||||
|
// assertEquals(expResult, result);
|
||||||
|
// // TODO review the generated test code and remove the default call to fail.
|
||||||
|
// fail("The test case is a prototype.");
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* Test of createPossibleFileNames method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreatePossibleFileNamesForImage() {
|
||||||
|
System.out.println("createPossibleFileNames");
|
||||||
|
GameFileType gameFileType = GameFileType.IMAGE8;
|
||||||
|
String fileName = "BLUPI";
|
||||||
|
String expResult = "BLUPI.BLP\n"
|
||||||
|
+ "blupi.blp\n"
|
||||||
|
+ "Blupi.blp\n"
|
||||||
|
+ "BLUPI.BMP\n"
|
||||||
|
+ "blupi.bmp\n"
|
||||||
|
+ "Blupi.bmp\n"
|
||||||
|
+ "BLUPI.PNG\n"
|
||||||
|
+ "blupi.png\n"
|
||||||
|
+ "Blupi.png\n"
|
||||||
|
+ "BLUPI.JPEG\n"
|
||||||
|
+ "blupi.jpeg\n"
|
||||||
|
+ "Blupi.jpeg";
|
||||||
|
String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of createPossibleFileNames method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreatePossibleFileNamesForMusic() {
|
||||||
|
System.out.println("createPossibleFileNames");
|
||||||
|
GameFileType gameFileType = GameFileType.MUSIC;
|
||||||
|
String fileName = "BLUPI";
|
||||||
|
String expResult = "BLUPI.BLP\n"
|
||||||
|
+ "blupi.blp\n"
|
||||||
|
+ "Blupi.blp\n"
|
||||||
|
+ "BLUPI.MID\n"
|
||||||
|
+ "blupi.mid\n"
|
||||||
|
+ "Blupi.mid\n"
|
||||||
|
+ "BLUPI.WAV\n"
|
||||||
|
+ "blupi.wav\n"
|
||||||
|
+ "Blupi.wav\n"
|
||||||
|
+ "BLUPI.MP3\n"
|
||||||
|
+ "blupi.mp3\n"
|
||||||
|
+ "Blupi.mp3\n"
|
||||||
|
+ "BLUPI.OGG\n"
|
||||||
|
+ "blupi.ogg\n"
|
||||||
|
+ "Blupi.ogg";
|
||||||
|
String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of createPossibleFileNames method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreatePossibleFileNamesForSound() {
|
||||||
|
System.out.println("createPossibleFileNames");
|
||||||
|
GameFileType gameFileType = GameFileType.SOUND;
|
||||||
|
String fileName = "BLUPI";
|
||||||
|
String expResult = "BLUPI.BLP\n"
|
||||||
|
+ "blupi.blp\n"
|
||||||
|
+ "Blupi.blp\n"
|
||||||
|
+ "BLUPI.WAV\n"
|
||||||
|
+ "blupi.wav\n"
|
||||||
|
+ "Blupi.wav\n"
|
||||||
|
+ "BLUPI.MP3\n"
|
||||||
|
+ "blupi.mp3\n"
|
||||||
|
+ "Blupi.mp3\n"
|
||||||
|
+ "BLUPI.OGG\n"
|
||||||
|
+ "blupi.ogg\n"
|
||||||
|
+ "Blupi.ogg";
|
||||||
|
String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of createPossibleFileNames method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreatePossibleFileNamesForConfig() {
|
||||||
|
System.out.println("createPossibleFileNames");
|
||||||
|
GameFileType gameFileType = GameFileType.CONFIG;
|
||||||
|
String fileName = "CONFIG.DEF";
|
||||||
|
String expResult = "CONFIG.DEF\n"
|
||||||
|
+ "config.def\n"
|
||||||
|
+ "Config.def";
|
||||||
|
String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of createPossibleFileNames method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreatePossibleFileNamesForWorld() {
|
||||||
|
System.out.println("createPossibleFileNames");
|
||||||
|
GameFileType gameFileType = GameFileType.WORLD;
|
||||||
|
String fileName = "WORLD031.BLP";
|
||||||
|
String expResult = "WORLD031.BLP\n"
|
||||||
|
+ "world031.blp\n"
|
||||||
|
+ "World031.blp";
|
||||||
|
String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getFileNameWithoutExtension method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetFileNameWithoutExtension() {
|
||||||
|
System.out.println("getFileNameWithoutExtension");
|
||||||
|
String fileName = "BLUPI000.BLP";
|
||||||
|
String expResult = "BLUPI000";
|
||||||
|
String result = OpenEggbertUtils.getFileNameWithoutExtension(fileName);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getFileNameWithoutExtension method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetFileNameWithoutExtension2() {
|
||||||
|
System.out.println("getFileNameWithoutExtension");
|
||||||
|
String fileName = "BLUPI000.BLP.PNG";
|
||||||
|
String expResult = "BLUPI000.BLP";
|
||||||
|
String result = OpenEggbertUtils.getFileNameWithoutExtension(fileName);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getFileNameWithoutExtension method, of class OpenEggbertUtils.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetFileNameWithoutExtension3() {
|
||||||
|
System.out.println("getFileNameWithoutExtension");
|
||||||
|
String fileName = "BLUPI000";
|
||||||
|
String expResult = "BLUPI000";
|
||||||
|
String result = OpenEggbertUtils.getFileNameWithoutExtension(fileName);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -19,7 +19,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.openeggbert.lwjgl3;
|
package com.openeggbert.lwjgl3;
|
||||||
|
|
||||||
import com.openeggbert.main.AssetsTxt;
|
import com.openeggbert.utils.AssetsTxt;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user