Refactor: Fix spelling of Christmas

This commit is contained in:
DeepCrimson 2022-06-24 18:39:04 -07:00
parent 6a1fcfe37a
commit 59505feccb
3 changed files with 48 additions and 49 deletions

View file

@ -489,7 +489,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
}
}
public static boolean isChrismasTime(Date currentTime) {
public static boolean isChristmasTime(Date currentTime) {
// from december 15 to january 15
Calendar cal = new GregorianCalendar();
cal.setTime(currentTime);
@ -513,9 +513,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
String filename;
float ratio;
if (isChrismasTime(Calendar.getInstance().getTime())) {
// chrismass logo
LOGGER.info("Yo Ho Ho, Merry Christmas and a Happy New Year");
if (isChristmasTime(Calendar.getInstance().getTime())) {
// Christmas logo
LOGGER.info("Ho Ho Ho, Merry Christmas and a Happy New Year");
filename = "/label-xmage-christmas.png";
ratio = 539.0f / 318.0f;
} else {

View file

@ -1,45 +0,0 @@
package mage.client.util;
import org.junit.Assert;
import org.junit.Test;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static mage.client.MageFrame.isChrismasTime;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class ChrismasTest {
private Date getDate(int Year, int Month, int Day){
Calendar cal = new GregorianCalendar(Year, Month - 1, Day);
cal.add(Calendar.HOUR, 10);
return cal.getTime();
}
@Test
public void testChrismasDays() throws Exception {
// chrismas from 15 december to 15 january
assertFalse(isChrismasTime(getDate(2017, 11, 1)));
assertFalse(isChrismasTime(getDate(2017, 11, 15)));
assertFalse(isChrismasTime(getDate(2017, 11, 30)));
assertFalse(isChrismasTime(getDate(2017, 12, 1)));
assertFalse(isChrismasTime(getDate(2017, 12, 14)));
assertTrue(isChrismasTime(getDate(2017, 12, 15)));
assertTrue(isChrismasTime(getDate(2017, 12, 16)));
assertTrue(isChrismasTime(getDate(2017, 12, 31)));
assertTrue(isChrismasTime(getDate(2018, 1, 1)));
assertTrue(isChrismasTime(getDate(2018, 1, 14)));
assertTrue(isChrismasTime(getDate(2018, 1, 15)));
assertFalse(isChrismasTime(getDate(2018, 1, 16)));
assertFalse(isChrismasTime(getDate(2018, 1, 31)));
assertFalse(isChrismasTime(getDate(2018, 2, 1)));
assertFalse(isChrismasTime(getDate(2018, 12, 1)));
assertTrue(isChrismasTime(getDate(2018, 12, 20)));
assertTrue(isChrismasTime(getDate(2019, 1, 10)));
assertFalse(isChrismasTime(getDate(2019, 1, 25)));
}
}

View file

@ -0,0 +1,44 @@
package mage.client.util;
import org.junit.Test;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static mage.client.MageFrame.isChristmasTime;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class ChristmasTest {
private Date getDate(int Year, int Month, int Day){
Calendar cal = new GregorianCalendar(Year, Month - 1, Day);
cal.add(Calendar.HOUR, 10);
return cal.getTime();
}
@Test
public void testChristmasDays() throws Exception {
// Christmas from 15 december to 15 january
assertFalse(isChristmasTime(getDate(2017, 11, 1)));
assertFalse(isChristmasTime(getDate(2017, 11, 15)));
assertFalse(isChristmasTime(getDate(2017, 11, 30)));
assertFalse(isChristmasTime(getDate(2017, 12, 1)));
assertFalse(isChristmasTime(getDate(2017, 12, 14)));
assertTrue(isChristmasTime(getDate(2017, 12, 15)));
assertTrue(isChristmasTime(getDate(2017, 12, 16)));
assertTrue(isChristmasTime(getDate(2017, 12, 31)));
assertTrue(isChristmasTime(getDate(2018, 1, 1)));
assertTrue(isChristmasTime(getDate(2018, 1, 14)));
assertTrue(isChristmasTime(getDate(2018, 1, 15)));
assertFalse(isChristmasTime(getDate(2018, 1, 16)));
assertFalse(isChristmasTime(getDate(2018, 1, 31)));
assertFalse(isChristmasTime(getDate(2018, 2, 1)));
assertFalse(isChristmasTime(getDate(2018, 12, 1)));
assertTrue(isChristmasTime(getDate(2018, 12, 20)));
assertTrue(isChristmasTime(getDate(2019, 1, 10)));
assertFalse(isChristmasTime(getDate(2019, 1, 25)));
}
}