Skip to content

Commit

Permalink
lib: fix parser xpathisuri usage and related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlivio committed Apr 29, 2021
1 parent b993b0e commit 0808d3f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ endmacro ()
file(GLOB GINGA_TESTS_SRC
"./tests/*.cpp")

add_definitions (-DTOP_SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/./")
add_definitions (-DABS_TOP_SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/./")
add_definitions (-DTOP_SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/")
add_definitions (-DABS_TOP_SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/")
foreach (SRC ${GINGA_TESTS_SRC})
get_filename_component (TEST_NAME ${SRC} NAME_WE)
add_ginga_test (${TEST_NAME} ${SRC})
Expand Down
5 changes: 2 additions & 3 deletions lib/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3999,10 +3999,9 @@ ParserState::pushMedia (ParserState *st, ParserElt *elt)
xmlChar *s = xmlBuildURI (toXmlChar (src),
toXmlChar (st->getURI ()));
src = toCPPString (s);
// If fails makes the uri based in the current dir
if (!xpathisuri (src) && !xpathisabs (src))
if (!xpathisuri (src))
{
src = xpathmakeabs (src);
src = xurifromsrc (src, "");
}
xmlFree (s);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/test-Ginga-redraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ draw_callback (unused (GtkWidget *widget), cairo_t *cr,

g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
g_assert_cmpint (gdk_pixbuf_get_bits_per_sample (pixbuf), ==, 8);
// g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
// g_assert (n_channels == 4);
g_assert_cmpint (n_channels, ==, 3);
g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
g_assert (n_channels == 4);

WIDTH = gdk_pixbuf_get_width (pixbuf);
HEIGHT = gdk_pixbuf_get_height (pixbuf);
Expand Down
2 changes: 1 addition & 1 deletion tests/test-Media-mime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ main (void)
// --------------------------------
// main check
g_assert (m->getProperty ("uri")
== xstrbuild ("file:%s", samples[i].uri));
== xurifromsrc (samples[i].uri, ""));
g_assert (m->getProperty ("type") == samples[i].mime);

delete m;
Expand Down
14 changes: 7 additions & 7 deletions tests/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ vector<const char *> samples_keys
= { "RED", "GREEN", "YELLOW", "BLUE", "INFO" };
vector<sample> samples = {
{ "application/x-ginga-timer", "" },
{ "audio/mp3", ABS_TOP_SRCDIR "/tests-ncl/samples/arcade.mp3" },
{ "image/png", ABS_TOP_SRCDIR "/tests-ncl/samples/gnu.png" },
{ "audio/mp3", ABS_TOP_SRCDIR "tests-ncl/samples/arcade.mp3" },
{ "image/png", ABS_TOP_SRCDIR "tests-ncl/samples/gnu.png" },
#if defined WITH_NCLUA && WITH_NCLUA
{ "application/x-ginga-NCLua",
ABS_TOP_SRCDIR "/tests-ncl/samples/fps.lua" },
ABS_TOP_SRCDIR "tests-ncl/samples/fps.lua" },
#endif
#if defined WITH_LIBRSVG && WITH_LIBRSVG
{ "image/svg+xml", ABS_TOP_SRCDIR "/tests-ncl/samples/vector.svg" },
{ "image/svg+xml", ABS_TOP_SRCDIR "tests-ncl/samples/vector.svg" },
#endif
{ "text/plain", ABS_TOP_SRCDIR "/tests-ncl/samples/text.txt" },
{ "video/ogg", ABS_TOP_SRCDIR "/tests-ncl/samples/clock.ogv" },
{ "text/plain", ABS_TOP_SRCDIR "tests-ncl/samples/text.txt" },
{ "video/ogg", ABS_TOP_SRCDIR "tests-ncl/samples/clock.ogv" },
#if defined WITH_CEF && WITH_CEF
{ "text/html", ABS_TOP_SRCDIR "/tests-ncl/samples/page.html" },
{ "text/html", ABS_TOP_SRCDIR "tests-ncl/samples/page.html" },
#endif
};

Expand Down

0 comments on commit 0808d3f

Please sign in to comment.