summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2012-10-06 15:48:46 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2013-01-04 20:29:35 +0000
commit6c792e2efa29a55d25f6afbbcee6a24a05d59f64 (patch)
treefaa5714524fde3f06c4461fa4085ca9744f68831
parentbb77538dc905065c2fcc5474a61429f5b9439c27 (diff)
downloadcogl-6c792e2efa29a55d25f6afbbcee6a24a05d59f64.tar.gz
cogl-sharp: Add a test for the new_from_file() Texture constructor
-rw-r--r--.gitignore1
-rw-r--r--cogl-sharp/Makefile.am8
-rw-r--r--cogl-sharp/tests/Config.cs.in7
-rw-r--r--cogl-sharp/tests/TestTexture.cs30
-rw-r--r--cogl-sharp/tests/smiley.pngbin0 -> 2856 bytes
5 files changed, 46 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 8072e51c..2b6a3b17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ stamp-marshal
/cogl-pango/cogl-pango.rc
/cogl-sharp/AssemblyInfo.cs
/cogl-sharp/TestResult.xml
+/cogl-sharp/tests/Config.cs
/cogl/cogl.rc
/cogl/cogl-defines.h
/cogl/cogl-defines.h.win32
diff --git a/cogl-sharp/Makefile.am b/cogl-sharp/Makefile.am
index 48073bae..fa705d6a 100644
--- a/cogl-sharp/Makefile.am
+++ b/cogl-sharp/Makefile.am
@@ -64,13 +64,21 @@ TESTS = launch-tests
launch-tests: CoglTests.dll
tests_sources = \
+ tests/Config.cs \
tests/TestColor.cs \
tests/TestMatrix.cs \
+ tests/TestTexture.cs \
$(NULL)
CoglTests.dll: $(tests_sources)
$(V_MCS)$(MCS) $(CSFLAGS) @$(srcdir)/CoglTests.rsp -lib:$(top_builddir)/cogl-sharp -r:cogl2-sharp.dll $(MONO_NUNIT_LIBS) $(tests_sources)
+REWRITE = sed -e "s|\@testsdir\@|$(srcdir)/tests|g"
+
+tests/Config.cs: tests/Config.cs.in Makefile
+ $(AM_V_GEN)$(REWRITE) $@.in > $@.tmp
+ @mv $@.tmp $@
+
EXTRA_DIST += $(tests_sources)
CLEANFILES += CoglTests.dll
endif
diff --git a/cogl-sharp/tests/Config.cs.in b/cogl-sharp/tests/Config.cs.in
new file mode 100644
index 00000000..d909b883
--- /dev/null
+++ b/cogl-sharp/tests/Config.cs.in
@@ -0,0 +1,7 @@
+namespace Cogl.Test
+{
+ internal static class Config
+ {
+ internal const string TESTSDIR = "@testsdir@";
+ }
+}
diff --git a/cogl-sharp/tests/TestTexture.cs b/cogl-sharp/tests/TestTexture.cs
new file mode 100644
index 00000000..64ea4e9a
--- /dev/null
+++ b/cogl-sharp/tests/TestTexture.cs
@@ -0,0 +1,30 @@
+using System.IO;
+
+using Cogl;
+using NUnit.Framework;
+
+namespace Cogl.Test
+{
+ [TestFixture]
+ public class TestTexture : AssertionHelper
+ {
+ private Context ctx;
+
+ [SetUp]
+ public void Init()
+ {
+ ctx = new Context();
+ }
+
+ [Test]
+ public void NewFromFile()
+ {
+ Texture tex;
+
+ tex = new Texture(Path.Combine(Config.TESTSDIR, "smiley.png"));
+
+ Expect(tex.GetWidth(), EqualTo(100));
+ Expect(tex.GetHeight(), EqualTo(100));
+ }
+ }
+}
diff --git a/cogl-sharp/tests/smiley.png b/cogl-sharp/tests/smiley.png
new file mode 100644
index 00000000..5bcc67a2
--- /dev/null
+++ b/cogl-sharp/tests/smiley.png
Binary files differ