<commit_before>﻿// Copyright (c) 2017 Jackal Engine, MIT License.
#include "Win32WindowTest.hpp"
#include "Core/Win32/Win32Window.hpp"

// OpenGL Testing as well.
#include "OpenGLDevice/OpenGLDevice.hpp"
#include "OpenGLDevice/Win32/Win32OpenGL.hpp"

#include <gtest/gtest.h>

TEST(Win32, Win32WindowTest)
{
#if JACKAL_PLATFORM == JACKAL_WINDOWS
  jackal::int32 width = 1440;
  jackal::int32 height = 800;

  jackal::Win32Window *window = jackal::Win32Window::Create(width, height,
    JTEXT("これは簡単なテストです。"), NULL);

  jackal::Win32OpenGL::SetOpenGLContext(window);
  jackal::Win32OpenGL::MakeContextCurrent(window);

  jackal::OpenGLDevice::InitOpenGL();

  //jackal::OpenGLDevice device;

  ASSERT_EQ(window->width, width);
  ASSERT_EQ(window->height, height);

  jackal::PrintToStdConsole(JTEXT("Press close to continue through."));

  // Game loop.
  while (!window->ShouldClose()) {
    jackal::Win32OpenGL::SwapWindowBuffers(window);
    jackal::Win32Window::PollEvents();
  }

  jackal::Win32OpenGL::MakeContextCurrent(nullptr);
  window->Destroy();
  jackal::Win32CleanUpWindowLibs();
#endif
}



namespace win32test {


void WindowTest()
{
}
} // win32test<commit_msg>Added test for centering window for win32 windows<commit_after>﻿// Copyright (c) 2017 Jackal Engine, MIT License.
#include "Win32WindowTest.hpp"
#include "Core/Win32/Win32Window.hpp"

// OpenGL Testing as well.
#include "OpenGLDevice/OpenGLDevice.hpp"
#include "OpenGLDevice/Win32/Win32OpenGL.hpp"

#include <gtest/gtest.h>

TEST(Win32, Win32WindowTest)
{
#if JACKAL_PLATFORM == JACKAL_WINDOWS
  jackal::int32 width = 1440;
  jackal::int32 height = 800;

  jackal::Win32Window *window = jackal::Win32Window::Create(width, height,
    JTEXT("これは簡単なテストです。"), NULL);
  window->SetToCenter();

  jackal::Win32OpenGL::SetOpenGLContext(window);
  jackal::Win32OpenGL::MakeContextCurrent(window);

  jackal::OpenGLDevice::InitOpenGL();
  // This device is used to render. Will be used by the 
  // renderer.
  //jackal::OpenGLDevice device;

  ASSERT_EQ(window->width, width);
  ASSERT_EQ(window->height, height);

  jackal::PrintToStdConsole(JTEXT("Press close to continue through."));

  // Game loop.
  while (!window->ShouldClose()) {
    jackal::Win32OpenGL::SwapWindowBuffers(window);
    jackal::Win32Window::PollEvents();
  }

  jackal::Win32OpenGL::MakeContextCurrent(nullptr);
  window->Destroy();
  jackal::Win32CleanUpWindowLibs();
#endif
}



namespace win32test {


void WindowTest()
{
}
} // win32test
{'fraction_non_alphanumeric': 0.14440868865647627, 'fraction_numerical': 0.04022526146419952, 'mean_word_length': 5.579365079365079, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7578370', 'n_tokens_mistral': 958, 'n_tokens_neox': 868, 'n_words': 155}