Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrose committed Apr 3, 2023
1 parent f08f5dd commit 01a4a9f
Show file tree
Hide file tree
Showing 28 changed files with 210 additions and 238 deletions.
6 changes: 4 additions & 2 deletions assets/soundHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class SFXHandler:
def __init__(self):
pygame.mixer.init()
self.currentSong = "NA"
self.sound_volume(settingIO.SFX_Volume * (settingIO.Master_Volume / 100))
self.music_volume(settingIO.Music_Volume * (settingIO.Master_Volume / 100))
self.sound_volume(settingIO.SFX_Volume *
(settingIO.Master_Volume / 100))
self.music_volume(settingIO.Music_Volume *
(settingIO.Master_Volume / 100))

def sound_volume(self, newVol):
# Make sure it is a valid volume
Expand Down
4 changes: 4 additions & 0 deletions assets/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,18 @@ def setSkin(skin):
global current_skin
current_skin = skin


def setBackground(bg):
global current_background
current_background = bg


def updateCoins():
global coins_in_game
customizationIO.coins += coins_in_game
customizationIO.save_customization()


def getBG(index):
if index == 0:
return "assets/backgrounds/base_bg.jpg"
Expand All @@ -106,6 +109,7 @@ def getBG(index):
else:
return "assets/backgrounds/pixelSpace.png"


newHighScore = False
newHighScoreId = -1

Expand Down
1 change: 1 addition & 0 deletions fileio/customizationIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
global coins, current_skin, current_hat
global current_background


def load_customization():
"""summary: Loads the customization from the file
"""
Expand Down
1 change: 0 additions & 1 deletion fileio/settingIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
global SFX_Volume, DifficultyLevel, keys



class difficulty(Enum):
EASY = 1
MEDIUM = 2
Expand Down
2 changes: 0 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
pygame.display.set_caption("Ducks In Space")
pygame.display.update()



statsIO.load_stats()
settingIO.load_settings(values.SETTING_PATH)
highScoreIO.load_high_scores()
Expand Down
1 change: 0 additions & 1 deletion test/test_SettingIO.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys

sys.path.append('..')
import pygame

from fileio import settingIO

Expand Down
2 changes: 1 addition & 1 deletion test/test_StatIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_postgame_update():
assert statsIO.totalGamesPlayed == 1
assert statsIO.totalGameTime == 100
assert statsIO.enemyDefeated == 100
#assert statsIO.spaceshipKills == 100
#assert statsIO.spaceshipKills == 100
#assert statsIO.meteroidKills == 100
assert statsIO.allTimeCurrency == 100
assert statsIO.averageGameTime == 100
Expand Down
7 changes: 1 addition & 6 deletions test/test_behavior_customizeScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

sys.path.append('..')
#import pytest_bdd methods and feature file for this test
from pytest_bdd import *
import pygame

import menuStructure as menuS
#from views import customizeScreen
from assets import values
from assets import soundHandler

#scenario('../test/features/customizeScreen.feature', '<scenario name>')
#Use given when then structure for tests
#Use given when then structure for tests
8 changes: 1 addition & 7 deletions test/test_behavior_gameOverScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

sys.path.append('..')
#import pytest_bdd methods and feature file for this test
from pytest_bdd import *
import pygame

import menuStructure as menuS
from views import gameOverScreen
from assets import values
from assets import soundHandler

#scenario('../test/features/gameOverScreen.feature', '<scenario name>')
#Use given when then structure for tests
#Use given when then structure for tests
8 changes: 1 addition & 7 deletions test/test_behavior_gameScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

sys.path.append('..')
#import pytest_bdd methods and feature file for this test
from pytest_bdd import *
import pygame

import menuStructure as menuS
from views import gameScreen
from assets import values
from assets import soundHandler

#scenario('../test/features/gameScreen.feature', '<scenario name>')
#Use given when then structure for tests
#Use given when then structure for tests
8 changes: 1 addition & 7 deletions test/test_behavior_highScoreScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

sys.path.append('..')
#import pytest_bdd methods and feature file for this test
from pytest_bdd import *
import pygame

import menuStructure as menuS
from views import highScoreScreen
from assets import values
from assets import soundHandler

#scenario('../test/features/highScoreScreen.feature', '<scenario name>')
#Use given when then structure for tests
#Use given when then structure for tests
8 changes: 1 addition & 7 deletions test/test_behavior_settingsScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

sys.path.append('..')
#import pytest_bdd methods and feature file for this test
from pytest_bdd import *
import pygame

import menuStructure as menuS
from views import settingScreen
from assets import values
from assets import soundHandler

#scenario('../test/features/settingsScreen.feature', '<scenario name>')
#Use given when then structure for tests
#Use given when then structure for tests
8 changes: 1 addition & 7 deletions test/test_behavior_statScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

sys.path.append('..')
#import pytest_bdd methods and feature file for this test
from pytest_bdd import *
import pygame

import menuStructure as menuS
from views import statScreen
from assets import values
from assets import soundHandler

#scenario('../test/features/statScreen.feature', '<scenario name>')
#Use given when then structure for tests
#Use given when then structure for tests
17 changes: 6 additions & 11 deletions test/test_customizationIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,29 @@

sys.path.append('..')
import os
import pytest

from fileio import customizationIO


def test_load_customization():
customizationIO.load_new_customization()
customizationIO.load_customization()

assert customizationIO.skins == []
assert customizationIO.hats == []
assert customizationIO.backgrounds == []
assert customizationIO.coins == 0
assert customizationIO.current_skin == 0
assert customizationIO.current_hat == 0
assert customizationIO.current_background == 0



def test_save_customization():
customizationIO.save_customization()
assert os.path.exists("fileio\\Customization.json")



def test_add_currency():
customizationIO.load_new_customization()
customizationIO.add_currency(69)
assert customizationIO.coins == 69







11 changes: 3 additions & 8 deletions test/test_customizeScreen.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import sys
import pygame

sys.path.append('..')
import os
import pytest

from views import customizeScreen


normalSkins = ['normal1.png', 'normal2.png', 'normal3.png']
Expand All @@ -15,7 +10,6 @@
graySkins = ['gray1.png', 'gray2.png', 'gray3.png']
greenSkins = ['green1.png', 'green2.png']
richSkins = ['rich1.png']

"""
def test_load_assets():
# Define test input
Expand All @@ -39,6 +33,7 @@ def test_load_assets():
assert len(result[5]) == len(greenSkins)
assert len(result[6]) == len(richSkins)
"""



def test_customize_screen():
assert True
assert True
9 changes: 4 additions & 5 deletions test/test_gameOverScreen.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import sys

sys.path.append('..')
import os
import pytest

from views import gameOverScreen


def test_start_screen():
assert True;
assert True


def test_shareScoreGraphic():
assert True;
assert True
6 changes: 2 additions & 4 deletions test/test_gameScreen.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import sys

sys.path.append('..')
import os
import pytest

from views import gameScreen


def testt_loadImage():
assert True
assert True
17 changes: 9 additions & 8 deletions test/test_highScoreScreen.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import sys
import pygame

sys.path.append('..')
import os
import pytest

from views import highScoreScreen


def test_high_score_screen():
assert True



def test_write_scores_text():
assert True



def test_write_no_high_score():
assert True



def test_draw_buttons():
assert True



def test_check_cords():
assert True
15 changes: 8 additions & 7 deletions test/test_homeScreen.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import sys

sys.path.append('..')
import os
import pytest

from views import homeScreen


def test_home_screen():
assert True



def test_check_highlight():
assert True



def test_click_handler():
assert True



def test_check_click():
assert True
assert True
12 changes: 4 additions & 8 deletions test/test_main.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import sys
import unittest.mock as mock
import main
import menuStructure as menuS

sys.path.append('..')
import os
import pytest

import main


def test_main():
# Untestable
assert True



def test_quit_game():
# Untestable
assert True
assert True
Loading

0 comments on commit 01a4a9f

Please sign in to comment.