[cogl/cogl-sharp: 27/29] cogl-sharp: Add a test for the new_from_file() Texture constructor
- From: Damien Lespiau <dlespiau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl-sharp: 27/29] cogl-sharp: Add a test for the new_from_file() Texture constructor
- Date: Tue, 9 Oct 2012 16:43:31 +0000 (UTC)
commit 40e934368b576f57f0a02c61d2a67f0ee4af817a
Author: Damien Lespiau <damien lespiau intel com>
Date: Sat Oct 6 15:48:46 2012 +0100
cogl-sharp: Add a test for the new_from_file() Texture constructor
.gitignore | 1 +
cogl-sharp/Makefile.am | 8 ++++++++
cogl-sharp/tests/Config.cs.in | 7 +++++++
cogl-sharp/tests/TestTexture.cs | 30 ++++++++++++++++++++++++++++++
cogl-sharp/tests/smiley.png | Bin 0 -> 2856 bytes
5 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8072e51..2b6a3b1 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 48073ba..fa705d6 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 0000000..d909b88
--- /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 0000000..64ea4e9
--- /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 0000000..5bcc67a
Binary files /dev/null and b/cogl-sharp/tests/smiley.png differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]