Bug 571989 part 4: Reorganize all the tests directories below gfx/. r=joedrew

--HG--
rename : gfx/thebes/crashtests/122875-1.html => gfx/tests/crashtests/122875-1.html
rename : gfx/thebes/crashtests/156882-1.html => gfx/tests/crashtests/156882-1.html
rename : gfx/thebes/crashtests/157320-1.html => gfx/tests/crashtests/157320-1.html
rename : gfx/thebes/crashtests/199379-1.html => gfx/tests/crashtests/199379-1.html
rename : gfx/thebes/crashtests/206561-1.html => gfx/tests/crashtests/206561-1.html
rename : gfx/thebes/crashtests/248518-1.html => gfx/tests/crashtests/248518-1.html
rename : gfx/thebes/crashtests/306649-1.xml => gfx/tests/crashtests/306649-1.xml
rename : gfx/src/thebes/crashtests/306902-1.xml => gfx/tests/crashtests/306902-1.xml
rename : gfx/thebes/crashtests/333861-1.html => gfx/tests/crashtests/333861-1.html
rename : gfx/thebes/crashtests/334735-1.html => gfx/tests/crashtests/334735-1.html
rename : gfx/thebes/crashtests/345576-1.html => gfx/tests/crashtests/345576-1.html
rename : gfx/thebes/crashtests/345629-1.html => gfx/tests/crashtests/345629-1.html
rename : gfx/thebes/crashtests/348462-1.html => gfx/tests/crashtests/348462-1.html
rename : gfx/thebes/crashtests/348462-2.html => gfx/tests/crashtests/348462-2.html
rename : gfx/thebes/crashtests/369688-1.html => gfx/tests/crashtests/369688-1.html
rename : gfx/thebes/crashtests/369947-1.html => gfx/tests/crashtests/369947-1.html
rename : gfx/thebes/crashtests/372094-1.xhtml => gfx/tests/crashtests/372094-1.xhtml
rename : gfx/thebes/crashtests/376627-1.html => gfx/tests/crashtests/376627-1.html
rename : gfx/thebes/crashtests/377231-1.html => gfx/tests/crashtests/377231-1.html
rename : gfx/thebes/crashtests/377232-1.xhtml => gfx/tests/crashtests/377232-1.xhtml
rename : gfx/thebes/crashtests/377461-1.xhtml => gfx/tests/crashtests/377461-1.xhtml
rename : gfx/thebes/crashtests/383473-1.html => gfx/tests/crashtests/383473-1.html
rename : gfx/src/thebes/crashtests/383872-1.svg => gfx/tests/crashtests/383872-1.svg
rename : gfx/thebes/crashtests/385228-1.svg => gfx/tests/crashtests/385228-1.svg
rename : gfx/thebes/crashtests/385228-2.svg => gfx/tests/crashtests/385228-2.svg
rename : gfx/thebes/crashtests/385289-1.xhtml => gfx/tests/crashtests/385289-1.xhtml
rename : gfx/thebes/crashtests/385417-1.html => gfx/tests/crashtests/385417-1.html
rename : gfx/thebes/crashtests/385417-2.html => gfx/tests/crashtests/385417-2.html
rename : gfx/thebes/crashtests/385423-1.html => gfx/tests/crashtests/385423-1.html
rename : gfx/thebes/crashtests/385423-2.html => gfx/tests/crashtests/385423-2.html
rename : gfx/thebes/crashtests/385719-1.html => gfx/tests/crashtests/385719-1.html
rename : gfx/thebes/crashtests/389326-1-inner.xhtml => gfx/tests/crashtests/389326-1-inner.xhtml
rename : gfx/thebes/crashtests/389326-1.html => gfx/tests/crashtests/389326-1.html
rename : gfx/thebes/crashtests/393746-1.xhtml => gfx/tests/crashtests/393746-1.xhtml
rename : gfx/thebes/crashtests/393749-1.html => gfx/tests/crashtests/393749-1.html
rename : gfx/thebes/crashtests/393822-1.html => gfx/tests/crashtests/393822-1.html
rename : gfx/thebes/crashtests/394246-1.html => gfx/tests/crashtests/394246-1.html
rename : gfx/thebes/crashtests/394246-2.html => gfx/tests/crashtests/394246-2.html
rename : gfx/thebes/crashtests/394384-1.html => gfx/tests/crashtests/394384-1.html
rename : gfx/thebes/crashtests/395335-1.xhtml => gfx/tests/crashtests/395335-1.xhtml
rename : gfx/thebes/crashtests/395458-1.html => gfx/tests/crashtests/395458-1.html
rename : gfx/thebes/crashtests/396321-1.svg => gfx/tests/crashtests/396321-1.svg
rename : gfx/thebes/crashtests/398042-1.xhtml => gfx/tests/crashtests/398042-1.xhtml
rename : gfx/thebes/crashtests/398042-2.xhtml => gfx/tests/crashtests/398042-2.xhtml
rename : gfx/thebes/crashtests/402307-1.html => gfx/tests/crashtests/402307-1.html
rename : gfx/thebes/crashtests/403464-1.html => gfx/tests/crashtests/403464-1.html
rename : gfx/thebes/crashtests/404112-1.html => gfx/tests/crashtests/404112-1.html
rename : gfx/thebes/crashtests/404112-2.html => gfx/tests/crashtests/404112-2.html
rename : gfx/thebes/crashtests/405268-1.xhtml => gfx/tests/crashtests/405268-1.xhtml
rename : gfx/thebes/crashtests/407761-1.html => gfx/tests/crashtests/407761-1.html
rename : gfx/thebes/crashtests/407842.html => gfx/tests/crashtests/407842.html
rename : gfx/thebes/crashtests/408754-1.html => gfx/tests/crashtests/408754-1.html
rename : gfx/thebes/crashtests/410728-1.xml => gfx/tests/crashtests/410728-1.xml
rename : gfx/thebes/crashtests/416637-1.html => gfx/tests/crashtests/416637-1.html
rename : gfx/thebes/crashtests/419095-1.html => gfx/tests/crashtests/419095-1.html
rename : gfx/thebes/crashtests/419255-1.html => gfx/tests/crashtests/419255-1.html
rename : gfx/thebes/crashtests/420945-1.html => gfx/tests/crashtests/420945-1.html
rename : gfx/thebes/crashtests/420962-1.html => gfx/tests/crashtests/420962-1.html
rename : gfx/thebes/crashtests/421393-1.html => gfx/tests/crashtests/421393-1.html
rename : gfx/thebes/crashtests/421813-1.html => gfx/tests/crashtests/421813-1.html
rename : gfx/src/thebes/crashtests/423110-1.xhtml => gfx/tests/crashtests/423110-1.xhtml
rename : gfx/thebes/crashtests/423270-1.html => gfx/tests/crashtests/423270-1.html
rename : gfx/thebes/crashtests/429899-1.html => gfx/tests/crashtests/429899-1.html
rename : gfx/thebes/crashtests/441360.html => gfx/tests/crashtests/441360.html
rename : gfx/thebes/crashtests/441360_data.gif => gfx/tests/crashtests/441360_data.gif
rename : gfx/src/thebes/crashtests/445711.html => gfx/tests/crashtests/445711.html
rename : gfx/thebes/crashtests/463307-1.html => gfx/tests/crashtests/463307-1.html
rename : gfx/thebes/crashtests/467703-1.xhtml => gfx/tests/crashtests/467703-1.xhtml
rename : gfx/thebes/crashtests/467873-1.html => gfx/tests/crashtests/467873-1.html
rename : gfx/thebes/crashtests/470418-1.html => gfx/tests/crashtests/470418-1.html
rename : gfx/thebes/crashtests/474410-1.html => gfx/tests/crashtests/474410-1.html
rename : gfx/thebes/crashtests/483120-1.xhtml => gfx/tests/crashtests/483120-1.xhtml
rename : gfx/thebes/crashtests/483120-2.xhtml => gfx/tests/crashtests/483120-2.xhtml
rename : gfx/thebes/crashtests/487549-1.html => gfx/tests/crashtests/487549-1.html
rename : gfx/thebes/crashtests/487549-bad_kern_table.ttf => gfx/tests/crashtests/487549-bad_kern_table.ttf
rename : gfx/thebes/crashtests/487724-1.html => gfx/tests/crashtests/487724-1.html
rename : gfx/thebes/crashtests/490777-1.html => gfx/tests/crashtests/490777-1.html
rename : gfx/thebes/crashtests/532726-1.html => gfx/tests/crashtests/532726-1.html
rename : gfx/thebes/crashtests/538065-1.html => gfx/tests/crashtests/538065-1.html
rename : gfx/thebes/crashtests/546870-1.html => gfx/tests/crashtests/546870-1.html
rename : gfx/thebes/crashtests/balinese-letter-spacing.html => gfx/tests/crashtests/balinese-letter-spacing.html
rename : gfx/thebes/crashtests/crashtests.list => gfx/tests/crashtests/crashtests.list
rename : gfx/thebes/test/gfxColorManagementTest.cmtest => gfx/tests/gfxColorManagementTest.cmtest
rename : gfx/thebes/test/gfxColorManagementTest.cpp => gfx/tests/gfxColorManagementTest.cpp
rename : gfx/thebes/test/gfxFontSelectionTest.cpp => gfx/tests/gfxFontSelectionTest.cpp
rename : gfx/thebes/test/gfxFontSelectionTests.h => gfx/tests/gfxFontSelectionTests.h
rename : gfx/thebes/test/gfxSurfaceRefCountTest.cpp => gfx/tests/gfxSurfaceRefCountTest.cpp
rename : gfx/thebes/test/gfxTestCocoaHelper.h => gfx/tests/gfxTestCocoaHelper.h
rename : gfx/thebes/test/gfxTestCocoaHelper.mm => gfx/tests/gfxTestCocoaHelper.mm
rename : gfx/thebes/test/gfxTextRunPerfTest.cpp => gfx/tests/gfxTextRunPerfTest.cpp
rename : gfx/thebes/test/gfxWordCacheTest.cpp => gfx/tests/gfxWordCacheTest.cpp
rename : gfx/thebes/mochitest/test_bug509244.html => gfx/tests/mochitest/test_bug509244.html
rename : gfx/thebes/mochitest/test_bug513439.html => gfx/tests/mochitest/test_bug513439.html
rename : gfx/thebes/test/per-word-runs.h => gfx/tests/per-word-runs.h
rename : gfx/thebes/test/process-textruns.pl => gfx/tests/process-textruns.pl
rename : gfx/thebes/test/testprofiles/DELL2407WFP-2B283C91.icc => gfx/tests/testprofiles/DELL2407WFP-2B283C91.icc
rename : gfx/thebes/test/testprofiles/G22LWk-2489A79.icc => gfx/tests/testprofiles/G22LWk-2489A79.icc
rename : gfx/thebes/test/testprofiles/MBP20080419-1.icc => gfx/tests/testprofiles/MBP20080419-1.icc
rename : gfx/thebes/test/testprofiles/PhLCD17a.icm => gfx/tests/testprofiles/PhLCD17a.icm
rename : gfx/thebes/test/testprofiles/identity.icc => gfx/tests/testprofiles/identity.icc
rename : gfx/thebes/test/testprofiles/murphy.icc => gfx/tests/testprofiles/murphy.icc
rename : gfx/thebes/test/testprofiles/sRGB_IEC61966-2-1_noBPC.icc => gfx/tests/testprofiles/sRGB_IEC61966-2-1_noBPC.icc
rename : gfx/thebes/test/testprofiles/sRGB_IEC61966-2-1_withBPC.icc => gfx/tests/testprofiles/sRGB_IEC61966-2-1_withBPC.icc
rename : gfx/thebes/test/testprofiles/sRGB_v4_ICC_preference.icc => gfx/tests/testprofiles/sRGB_v4_ICC_preference.icc
This commit is contained in:
Zack Weinberg 2010-07-13 14:54:18 -07:00
parent 74d7a05a98
commit 00dd731d9b
116 changed files with 68 additions and 722 deletions

View File

@ -67,9 +67,7 @@ DIRS += ipc
endif
ifdef ENABLE_TESTS
ifndef MOZ_ENABLE_LIBXUL
TOOL_DIRS += tests
endif
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,4 +0,0 @@
load 306902-1.xml
load 383872-1.svg
load 423110-1.xhtml
load 445711.html

View File

@ -43,9 +43,17 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = gfx
MOZILLA_INTERNAL_API = 1
XPCSHELL_TESTS = unit
_TEST_FILES = $(addprefix mochitest/, \
test_bug509244.html \
test_bug513439.html \
)
ifndef MOZ_ENABLE_LIBXUL
ifndef BUILD_STATIC_LIBS
CPP_UNIT_TESTS = \
TestColorNames.cpp \
@ -53,16 +61,59 @@ CPP_UNIT_TESTS = \
TestRegion.cpp \
$(NULL)
# These are built but not run. gfxColorManagementTest.cpp can't even
# be built, because it has not been updated for qcms.
CPP_DISABLED_UNIT_TESTS = \
gfxFontSelectionTest.cpp \
gfxSurfaceRefCountTest.cpp \
gfxTextRunPerfTest.cpp \
gfxWordCacheTest.cpp \
$(NULL)
# gfxColorManagementTest.cpp \
# rules.mk will put the CPP_UNIT_TESTS into SIMPLE_PROGRAMS twice if we
# define SIMPLE_PROGRAMS based on CPPSRCS directly.
CPPSRCS = $(CPP_DISABLED_UNIT_TESTS)
SIMPLE_PROGRAMS = $(CPP_DISABLED_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CMMSRCS = gfxTestCocoaHelper.mm
HELPER_OBJS = gfxTestCocoaHelper.$(OBJ_SUFFIX)
EXTRA_DEPS += gfxTestCocoaHelper.$(OBJ_SUFFIX)
endif
LIBS = \
$(HELPER_OBJS) \
$(call EXPAND_LIBNAME_PATH,thebes,../thebes) \
$(call EXPAND_LIBNAME_PATH,gkgfx,../src) \
$(MOZ_UNICHARUTIL_LIBS) \
$(XPCOM_LIBS) \
$(MOZ_JS_LIBS) \
$(TK_LIBS) \
$(NULL)
XPCSHELL_TESTS = unit
endif
endif
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../src
CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
OS_LIBS += $(call EXPAND_LIBNAME,usp10)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
OS_LIBS += -framework Cocoa
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
OS_LIBS += $(MOZ_PANGO_LIBS) $(XLIBS)
CXXFLAGS += $(MOZ_PANGO_CFLAGS)
endif
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") \
$(DEPTH)/_tests/testing/mochitest/tests/gfx

View File

@ -70,18 +70,15 @@ int main(int argc, char** argv)
{
ScopedXPCOM xpcom("TestColorNames");
if (xpcom.failed())
return -1;
return 1;
nscolor rgb;
int rv = 0;
// Everything appears to assert if we don't do this first...
nsColorNames::AddRefTable();
// First make sure we can find all of the tags that are supposed to
// be in the table. Futz with the case to make sure any case will
// work
for (PRUint32 index = 0 ; index < NS_ARRAY_LENGTH(kColorNames); index++) {
// Lookup color by name and make sure it has the right id
nsCString tagName(kColorNames[index]);
@ -89,24 +86,24 @@ int main(int argc, char** argv)
// Check that color lookup by name gets the right rgb value
if (!NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tagName), &rgb)) {
fail("can't find '%s'", tagName.get());
rv = -1;
rv = 1;
}
if (rgb != kColors[index]) {
fail("name='%s' ColorNameToRGB=%x kColors[%d]=%08x",
tagName.get(), rgb, index, kColors[index]);
rv = -1;
rv = 1;
}
// fiddle with the case to make sure we can still find it
tagName.SetCharAt(tagName.CharAt(0) - 32, 0);
if (!NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tagName), &rgb)) {
fail("can't find '%s'", tagName.get());
rv = -1;
rv = 1;
}
if (rgb != kColors[index]) {
fail("name='%s' ColorNameToRGB=%x kColors[%d]=%08x",
tagName.get(), rgb, index, kColors[index]);
rv = -1;
rv = 1;
}
// Check that parsing an RGB value in hex gets the right values
@ -123,11 +120,11 @@ int main(int argc, char** argv)
nscolor hexrgb;
if (!NS_HexToRGB(NS_ConvertASCIItoUTF16(cbuf), &hexrgb)) {
fail("hex conversion to color of '%s'", cbuf);
rv = -1;
rv = 1;
}
if (hexrgb != rgb) {
fail("rgb=%x hexrgb=%x", rgb, hexrgb);
rv = -1;
rv = 1;
}
}
@ -136,12 +133,10 @@ int main(int argc, char** argv)
nsCString tag(kJunkNames[i]);
if (NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tag), &rgb)) {
fail("found '%s'", kJunkNames[i] ? kJunkNames[i] : "(null)");
rv = -1;
rv = 1;
}
}
nsColorNames::ReleaseTable();
if (rv == 0)
passed("TestColorNames");
return rv;

View File

@ -152,12 +152,7 @@ int main(int argc, char** argv) {
ScopedXPCOM xpcom("TestRegion");
if (xpcom.failed())
return -1;
if (NS_FAILED(nsRegion::InitStatic())) {
fail("Could not initialize region statics");
return -1;
}
if (!TestLargestRegion::Test())
return -1;
nsRegion::ShutdownStatic();
return 0;
}

View File

@ -1,65 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PROGRAM = widget
MOZILLA_INTERNAL_API = 1
CPPSRCS = \
main.cpp \
nsWidgetTest.cpp \
$(NULL)
LIBS = \
$(XPCOM_LIBS) \
$(MOZ_JS_LIBS) \
$(MOZ_WIDGET_SUPPORT_LIBS) \
-lgkgfx \
$(NSPR_LIBS) \
$(TK_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS)

View File

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
extern nsresult CoverageTest(int * argc, char **argv);
#if defined(XP_WIN) || defined(XP_OS2)
#include <windows.h>
void main(int argc, char **argv)
{
int argC = argc;
CoverageTest(&argC, argv);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine,
int nCmdShow)
{
int argC = 0;
char ** argv = NULL;
return(CoverageTest(&argC, argv));
}
#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
int main(int argc, char **argv)
{
int argC = argc;
CoverageTest(&argC, argv);
return 0;
}
#endif
#ifdef XP_MAC
int main(int argc, char **argv)
{
int argC = argc;
CoverageTest(&argC, argv);
return 0;
}
#endif

View File

@ -1,388 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//---- Factory Includes & Stuff -----//
#include "nsIFactory.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
#include "nsIEventQueue.h"
#include "nsGfxCIID.h"
#include "nsWidgetsCID.h"
#include "nsIWidget.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include "nsRect.h"
#include "nsIRenderingContext.h"
#include "nsIDeviceContext.h"
#include "nsFont.h"
#include "nsIComponentManager.h"
#include "nsWidgetsCID.h"
#include "nsIAppShell.h"
//------------------------------------------------------------------------------
nsIWidget *gWindow = NULL;
#if defined(XP_WIN) || defined(XP_OS2)
#define TEXT_HEIGHT 25
#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
#define TEXT_HEIGHT 30
#endif
#ifdef XP_MAC
#define TEXT_HEIGHT 30
#endif
// class ids
static NS_DEFINE_CID(kCWindowCID, NS_WINDOW_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kCAppShellCID, NS_APPSHELL_CID);
// Scroll offsets
nscoord gOffsetX = 0;
nscoord gOffsetY = 0;
nscoord pixelLoc(nscoord aPixelValue, float aP2t, nscoord aOffset)
{
return NSToIntRound((aPixelValue + aOffset) * aP2t);
}
PRInt32
drawtest(nsIRenderingContext *aSurface)
{
nsFont *font;
nsPoint *pointlist;
// Get the size of a pixel.
nsCOMPtr<nsIDeviceContext> deviceContext;
aSurface->GetDeviceContext(*getter_AddRefs(deviceContext));
float p2t; // pixel to twips conversion
p2t = deviceContext->DevUnitsToAppUnits();
font = new nsFont("Times", NS_FONT_STYLE_NORMAL,NS_FONT_VARIANT_NORMAL,NS_FONT_WEIGHT_BOLD,0,12);
aSurface->SetFont(*font);
// Clear surface.
nsRect rect;
gWindow->GetClientBounds(rect);
aSurface->SetColor(NS_RGB(255, 255, 255));
aSurface->FillRect(0,0,rect.width,rect.height);
aSurface->SetColor(NS_RGB(255, 0, 0));
nsAutoString strText6(NS_LITERAL_STRING("GFX - Pixel coverage test"));
aSurface->DrawString(strText6,150,30);
nsAutoString strText5(NS_LITERAL_STRING("(Use (u, d, r, l) keys to scroll the window contents)"));
aSurface->DrawString(strText5,150,50);
aSurface->Translate(gOffsetX, gOffsetY);
// Starting coordinates
nscoord ox = 90; // pixels
nscoord oy = 100; // pixels
// Spacing between tests
nscoord yspacing = 50; // pixels
//--------------
// DrawLine TEST
//--------------
aSurface->SetColor(NS_RGB(255, 0, 0));
aSurface->DrawLine(pixelLoc(12, p2t, ox),
pixelLoc(0, p2t, oy),
pixelLoc(12, p2t, ox),
pixelLoc(10, p2t, oy));
aSurface->SetColor(NS_RGB(0, 0, 0));
aSurface->DrawLine(pixelLoc(0, p2t, ox),
pixelLoc(10,p2t, oy),
pixelLoc(12,p2t, ox),
pixelLoc(10, p2t, oy));
nsAutoString strText4(NS_LITERAL_STRING("DrawLine - There should be a one pixel gap where the red and black lines meet"));
aSurface->DrawString(strText4, ox + 30, oy);
oy += yspacing;
//------------------
// DrawPolyline TEST
//------------------
pointlist = new nsPoint[5];
pointlist[0].x = pixelLoc(0, p2t, ox);
pointlist[0].y = pixelLoc(0, p2t, oy);
pointlist[1].x = pixelLoc(10, p2t, ox);
pointlist[1].y = pixelLoc(0, p2t, oy);
pointlist[2].x = pixelLoc(10, p2t, ox);
pointlist[2].y = pixelLoc(10, p2t, oy);
pointlist[3].x = pixelLoc(0, p2t, ox);
pointlist[3].y = pixelLoc(10, p2t, oy);
pointlist[4].x = pixelLoc(0, p2t, ox);
pointlist[4].y = pixelLoc(1, p2t, oy);
aSurface->DrawPolyline(pointlist,5);
nsAutoString strText3(NS_LITERAL_STRING("DrawPolyline - There should be a one pixel gap in the rectangle"));
aSurface->DrawString(strText3, ox + 30, oy);
delete [] pointlist;
oy += yspacing;
//--------------
// FillRect TEST
//--------------
aSurface->SetColor(NS_RGB(255, 0, 0));
aSurface->DrawLine(pixelLoc(9,p2t, ox),
pixelLoc(0,p2t, oy),
pixelLoc(9,p2t, ox),
pixelLoc(30,p2t, oy));
aSurface->SetColor(NS_RGB(0, 0, 0));
aSurface->FillRect(pixelLoc(0, p2t, ox),
pixelLoc(10, p2t, oy),
pixelLoc(10, p2t, 0),
pixelLoc(10, p2t, 0));
nsAutoString strText2(NS_LITERAL_STRING("FillRect - The red line should be at the right edge under the rectangle"));
aSurface->DrawString(strText2, ox + 30, oy);
oy += yspacing;
//--------------
// DrawRect TEST
//--------------
aSurface->SetColor(NS_RGB(255, 0, 0));
aSurface->DrawLine(pixelLoc(9,p2t, ox),
pixelLoc(0,p2t, oy),
pixelLoc(9,p2t, ox),
pixelLoc(30,p2t, oy));
aSurface->SetColor(NS_RGB(0, 0, 0));
aSurface->DrawRect(pixelLoc(0, p2t, ox),
pixelLoc(10, p2t, oy),
pixelLoc(10, p2t, 0),
pixelLoc(10, p2t, 0));
nsAutoString strText1(NS_LITERAL_STRING("DrawRect - The red line should be at the right edge under the rectangle"));
aSurface->DrawString(strText1, ox + 30, oy);
oy += yspacing;
/*
#ifdef WINDOWSBROKEN
pointlist = new nsPoint[5];
pointlist[0].x = 200;pointlist[0].y = 200;
pointlist[1].x = 250;pointlist[1].y = 200;
pointlist[2].x = 240;pointlist[2].y = 220;
pointlist[3].x = 260;pointlist[3].y = 240;
pointlist[4].x = 225;pointlist[4].y = 225;
aSurface->DrawPolygon(pointlist,6);
aSurface->DrawString("This is an open Polygon\0",250,200);
delete [] pointlist;
#endif
aSurface->DrawEllipse(30, 150,50,100);
aSurface->DrawString("This is an Ellipse\0",30,140);
*/
return(30);
}
/**--------------------------------------------------------------------------------
* Main Handler
*--------------------------------------------------------------------------------
*/
nsEventStatus HandleEvent(nsGUIEvent *aEvent)
{
nsEventStatus result = nsEventStatus_eIgnore;
switch(aEvent->message) {
case NS_PAINT:
// paint the background
if (aEvent->widget == gWindow) {
nsIRenderingContext *drawCtx = ((nsPaintEvent*)aEvent)->renderingContext;
drawCtx->SetColor(aEvent->widget->GetBackgroundColor());
drawCtx->FillRect(*(((nsPaintEvent*)aEvent)->rect));
drawtest(drawCtx);
return nsEventStatus_eIgnore;
}
break;
case NS_KEY_UP: {
nsKeyEvent * ke = (nsKeyEvent*)aEvent;
char str[256];
sprintf(str, "Key Event Key Code[%d] Key [%c] Shift [%s] Control [%s] Alt [%s]",
ke->keyCode, ke->keyCode,
(ke->isShift?"Pressed":"Released"),
(ke->isControl?"Pressed":"Released"),
(ke->isAlt?"Pressed":"Released"));
printf("%s\n", str);
nsIntRect clientRect;
gWindow->GetClientBounds(clientRect);
switch(ke->keyCode) {
case 'U':
gOffsetY -= 9;
gWindow->Invalidate(clientRect, PR_FALSE);
break;
case 'D':
gOffsetY += 10;
gWindow->Invalidate(clientRect, PR_FALSE);
break;
case 'R':
gOffsetX += 9;
gWindow->Invalidate(clientRect, PR_FALSE);
break;
case 'L':
gOffsetX -= 10;
gWindow->Invalidate(clientRect, PR_FALSE);
break;
}
}
break;
case NS_DESTROY:
exit(0); // for now
break;
default:
result = nsEventStatus_eIgnore;
}
return result;
}
/**--------------------------------------------------------------------------------
*
*/
nsresult CoverageTest(int *argc, char **argv)
{
nsresult res = NS_InitXPCOM2(nsnull, nsnull, nsnull);
if (NS_FAILED(res))
return res;
// Create the Event Queue for the UI thread...
nsCOMPtr<nsIEventQueueService> eventQService =
do_GetService(kEventQueueServiceCID, &res);
if (NS_OK != res) {
NS_ASSERTION(PR_FALSE, "Could not obtain the event queue service");
return res;
}
// Create a application shell
nsIAppShell *appShell;
CallCreateInstance(kCAppShellCID, &appShell);
if (appShell != nsnull) {
fputs("Created AppShell\n", stderr);
appShell->Create(argc, argv);
} else {
printf("AppShell is null!\n");
}
nsIDeviceContext* deviceContext = 0;
// Create a device context for the widgets
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
//
// create the main window
//
CallCreateInstance(kCWindowCID, &gWindow);
nsRect rect(100, 100, 600, 700);
gWindow->Create((nsIWidget*) nsnull, rect, HandleEvent,
(nsIDeviceContext *) nsnull,
appShell);
nsAutoString strTitle(NS_LITERAL_STRING("Pixel coverage test"));
gWindow->SetTitle(strTitle);
//
// Create Device Context based on main window
//
res = CallCreateInstance(kDeviceContextCID, &deviceContext);
if (NS_OK == res)
{
deviceContext->Init(gWindow);
NS_ADDREF(deviceContext);
}
gWindow->Show(PR_TRUE);
return(appShell->Run());
}

View File

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 350 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 549 B

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

Before

Width:  |  Height:  |  Size: 73 B

After

Width:  |  Height:  |  Size: 73 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -5,6 +5,7 @@ load 199379-1.html
load 206561-1.html
load 248518-1.html
load 306649-1.xml
load 306902-1.xml
load 333861-1.html
load 334735-1.html
load 345576-1.html
@ -19,6 +20,7 @@ load 377231-1.html
load 377232-1.xhtml
load 377461-1.xhtml
load 383473-1.html
load 383872-1.svg
load 385289-1.xhtml
load 385228-1.svg
skip load 385228-2.svg # bug 523255 / bug 385228
@ -55,9 +57,11 @@ load 420945-1.html
load 420962-1.html
load 421393-1.html
load 421813-1.html
load 423110-1.xhtml
load 423270-1.html
load 429899-1.html
load 441360.html
load 445711.html
load 463307-1.html
load 467703-1.xhtml
load 467873-1.html

Some files were not shown because too many files have changed in this diff Show More