Starter project for SDL2.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.3 KiB

  1. #include "../../../__mocks__/minIni.mock.h"
  2. #include "../__mocks__/IZ_config.mock.h"
  3. #include "IZ_video.h"
  4. spec("output/video") {
  5. describe("LoadVideoConfig") {
  6. static IZ_VideoConfig config;
  7. after_each() {
  8. mock_reset(IZ_GetConfigPath);
  9. }
  10. after_each() {
  11. mock_reset(ini_getl);
  12. }
  13. it("calls load method") {
  14. mock_set_expected_calls(ini_getl, 3);
  15. IZ_LoadVideoConfig(&config);
  16. check(
  17. mock_is_called(IZ_GetConfigPath),
  18. "SDL_GetBasePath() not called."
  19. );
  20. check(
  21. mock_get_expected_calls(ini_getl) == mock_get_actual_calls(ini_getl),
  22. "Call count mismatch for ini_getl() (expected %u, received %u).",
  23. mock_get_expected_calls(ini_getl),
  24. mock_get_actual_calls(ini_getl)
  25. );
  26. }
  27. }
  28. describe("SaveVideoConfig") {
  29. static IZ_VideoConfig config;
  30. after_each() {
  31. mock_reset(IZ_GetConfigPath);
  32. }
  33. after_each() {
  34. mock_reset(ini_putl);
  35. }
  36. before_each() {
  37. config.width = 1337;
  38. config.height = 420;
  39. config.max_fps = 69;
  40. }
  41. it("calls save method") {
  42. mock_set_expected_calls(ini_putl, 3);
  43. IZ_SaveVideoConfig(&config);
  44. check(
  45. mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl),
  46. "Call count mismatch for ini_putl() (expected %u, received %u).",
  47. mock_get_expected_calls(ini_putl),
  48. mock_get_actual_calls(ini_putl)
  49. );
  50. }
  51. }
  52. }