engine/gamesys/src/gamesys/test/test_gamesys.cpp
// Test that tries to reload shaders with errors in them.
Test that tries to reload shaders with errors in them.
Test that tries to reload shaders with errors in them .
TEST_F(ComponentTest, ReloadInvalidMaterial)
{
    const char path_material[] = "/material/valid.materialc";
    const char path_frag[] = "/fragment_program/valid.fpc";
    const char path_vert[] = "/vertex_program/valid.vpc";
    void* resource;
    ASSERT_EQ(dmResource::RESULT_OK, dmResource::Get(m_Factory, path_material, &resource));
    dmGraphics::SetForceVertexReloadFail(true);
    ASSERT_NE(dmResource::RESULT_OK, dmResource::ReloadResource(m_Factory, path_vert, 0));
    dmGraphics::SetForceVertexReloadFail(false);
    ASSERT_EQ(dmResource::RESULT_OK, dmResource::ReloadResource(m_Factory, path_vert, 0));
    dmGraphics::SetForceFragmentReloadFail(true);
    ASSERT_NE(dmResource::RESULT_OK, dmResource::ReloadResource(m_Factory, path_frag, 0));
    dmGraphics::SetForceFragmentReloadFail(false);
    ASSERT_EQ(dmResource::RESULT_OK, dmResource::ReloadResource(m_Factory, path_frag, 0));
    dmResource::Release(m_Factory, resource);
}
TEST_F ( ComponentTest , ReloadInvalidMaterial ) { const char path_material [ ] = " " ; const char path_frag [ ] = " " ; const char path_vert [ ] = " " ; void * resource ; ASSERT_EQ ( dmResource :: RESULT_OK , dmResource :: Get ( m_Factory , path_material , & resource ) ) ; dmGraphics :: SetForceVertexReloadFail ( true ) ; ASSERT_NE ( dmResource :: RESULT_OK , dmResource :: ReloadResource ( m_Factory , path_vert , 0 ) ) ; dmGraphics :: SetForceVertexReloadFail ( false ) ; ASSERT_EQ ( dmResource :: RESULT_OK , dmResource :: ReloadResource ( m_Factory , path_vert , 0 ) ) ; dmGraphics :: SetForceFragmentReloadFail ( true ) ; ASSERT_NE ( dmResource :: RESULT_OK , dmResource :: ReloadResource ( m_Factory , path_frag , 0 ) ) ; dmGraphics :: SetForceFragmentReloadFail ( false ) ; ASSERT_EQ ( dmResource :: RESULT_OK , dmResource :: ReloadResource ( m_Factory , path_frag , 0 ) ) ; dmResource :: Release ( m_Factory , resource ) ; }
Test that tries to reload shaders with errors in them.
Test that tries to reload shaders with errors in them .
// Modify resource with simulated syntax error // Reload, validate fail // Modify resource with correction // Reload, validate success // Same as above but for fragment shader