Adding an XP-COM test for libmime.

This commit is contained in:
rhp%netscape.com 1999-01-28 21:28:02 +00:00
Родитель 20e19a60e8
Коммит 2433d5ff70
3 изменённых файлов: 166 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,32 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
CPPSRCS = \
test.cpp \
$(NULL)
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,96 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
NODEPEND=1
IGNORE_MANIFEST = 1
#//------------------------------------------------------------------------
#//
# New build system where zip dll is build indepenant of java stubs.
#//
#//------------------------------------------------------------------------
MODULE =testmsgfactory
#EXPORTS = \
# $(NULL)
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH= ..\..\..\..
MAKE_OBJ_TYPE=EXE
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
EXENAME=TestMIMEFactory
PDBFILE=TestMIMEFactory.pdb
MAPFILE=TestMIMEFactory.map
#//------------------------------------------------------------------------
#//
#// Define the files necessary to build the target (ie. OBJS)
#//
#//------------------------------------------------------------------------
OBJS= \
.\$(OBJDIR)\test.obj \
$(NULL)
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
PROGRAM=.\$(OBJDIR)\$(EXENAME).EXE
#//------------------------------------------------------------------------
#//
#// Define any local options for the make tools
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------
LCFLAGS=-DNETSCAPE
LLIBS= $(LLIBS) ole32.lib \
$(DIST)\lib\xpcom32.lib
LINCS=$(LINCS) -I. \
-I$(PUBLIC)\mailnews \
-I$(PUBLIC)\netlib \
-I$(PUBLIC)\raptor \
-I$(PUBLIC)\mime \
-I$(PUBLIC)\xpcom
# clobber and clobber_all will remove the following garbage:
GARBAGE = $(GARBAGE) _gen
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
install:: $(PROGRAM)
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin\
clobber::
rm -f $(EXENAME).exe

Просмотреть файл

@ -0,0 +1,38 @@
#include <stdio.h>
#include "nsRepository.h"
#include "nsRFC822toHTMLStreamConverter.h"
static NS_DEFINE_IID(kIStreamConverterIID, NS_ISTREAM_CONVERTER_IID);
static NS_DEFINE_CID(kRFC822toHTMLStreamConverterCID, NS_RFC822_HTML_STREAM_CONVERTER_CID);
/* This is just a testing stub added by mscott. All I'm doing is loading a component,
and querying it for a particular interface.
It is its only purpose / use....
*/
int main(int argc, char *argv[])
{
nsRFC822toHTMLStreamConverter *sample;
// register our dll
nsRepository::RegisterFactory(kRFC822toHTMLStreamConverterCID, "mime.dll", PR_FALSE, PR_FALSE);
nsresult res = nsRepository::CreateInstance(kRFC822toHTMLStreamConverterCID,
NULL,
kIStreamConverterIID,
(void **) &sample);
if (res == NS_OK && sample)
{
printf("We succesfully obtained a nsRFC822toHTMLStreamConverter interface....\n");
// sample->ParseRFC822Addresses("Scott MacGregor <mscott@netscape.com>", &names, &addresses);
printf("Releasing the interface now...\n");
sample->Release();
}
return 0;
}