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.

69 lines
1.4 KiB

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