зеркало из https://github.com/mozilla/pjs.git
Some testing enhancements and fixes
This commit is contained in:
Родитель
a0c92d4a8a
Коммит
7d8d697842
|
@ -1,29 +0,0 @@
|
|||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
# Reserved. Use of this Source Code is subject to the terms of the
|
||||
# applicable license agreement from Netscape Communications Corporation.
|
||||
# The copyright notice(s) in this Source Code does not indicate actual or
|
||||
# intended publication of this Source Code.
|
||||
#
|
||||
GDEPTH = ../../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsCalendarWidget.h \
|
||||
nsCalendarShell.h \
|
||||
nsCalendarContainer.h \
|
||||
nsCalShellCIID.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nscalcids.h \
|
||||
nsCalShellCIID.h \
|
||||
nsCalendarShell.h \
|
||||
nsCalendarWidget.h \
|
||||
nsCalShellFactory.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = trex
|
||||
|
||||
REQUIRES = raptor
|
|
@ -0,0 +1,37 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef nsCalTestStrings_h___
|
||||
#define nsCalTestStrings_h___
|
||||
|
||||
#define ZULUCOMMAND_HELP "Valid JS commands are:\r\n\r\n" \
|
||||
" zulucommand(\"help\",\"help\"); Get even more help on help\r\n" \
|
||||
" zulucommand(\"help\",\"panel\"); Get help on specifying methods for panels\r\n"
|
||||
|
||||
#define ZULUCOMMAND_HELP_PANEL "***panel syntax is:***\r\n\r\n" \
|
||||
" zulucommand(\"panel\",\"name\",\"method\",\"param1\",...,\"paramN\");\r\n\r\n" \
|
||||
" where: \r\n" \
|
||||
" name: XML Name of the panel\r\n" \
|
||||
" method: Method to be invoked on panel\r\n" \
|
||||
" paramX: Arbitrary list of parameters to be passed to method\r\n\r\n" \
|
||||
"***Available Methods include:***\r\n" \
|
||||
" \"getbackgroundcolor\" - Get the background color for named canvas\r\n" \
|
||||
" \"setbackgroundcolor\",\"#RRGGBB\" - Set the background color to named canvas\r\n" \
|
||||
|
||||
#endif //nsCalTestStrings_h___
|
||||
|
|
@ -135,6 +135,8 @@ static NS_DEFINE_IID(kCMIMEServiceCID, NS_MIME_SERVICE_CID);
|
|||
#include "nsIXPFCObserver.h"
|
||||
#define kNotFound -1
|
||||
|
||||
#include "nsCalTestStrings.h"
|
||||
|
||||
// All Application Must implement this function
|
||||
nsresult NS_RegisterApplicationShellFactory()
|
||||
{
|
||||
|
@ -1228,6 +1230,7 @@ extern "C" void XP_Trace( const char *, ... )
|
|||
|
||||
// XXX: Move Me. This code was in the CommandCanvas, but is really
|
||||
// independent of any UI
|
||||
// XXX: Lots of testing code is going here, needs to be moved...
|
||||
|
||||
nsresult nsCalendarShell :: SendCommand(nsString& aCommand, nsString& aReply)
|
||||
{
|
||||
|
@ -1235,46 +1238,52 @@ nsresult nsCalendarShell :: SendCommand(nsString& aCommand, nsString& aReply)
|
|||
/*
|
||||
* Extract the CanvasName, method and params out
|
||||
*/
|
||||
|
||||
|
||||
nsString target, name, method, param;
|
||||
|
||||
aCommand.Trim(" \r\n\t");
|
||||
|
||||
PRInt32 offset = aCommand.Find(' ');
|
||||
|
||||
if (offset == kNotFound)
|
||||
return NS_OK;
|
||||
|
||||
aCommand.Left(target,offset);
|
||||
aCommand.Cut(0,offset);
|
||||
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
|
||||
|
||||
offset = aCommand.Find(' ');
|
||||
|
||||
if (offset == kNotFound)
|
||||
return NS_OK;
|
||||
|
||||
aCommand.Left(name,offset);
|
||||
aCommand.Cut(0,offset);
|
||||
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
|
||||
|
||||
offset = aCommand.Find(' ');
|
||||
|
||||
if (offset == kNotFound)
|
||||
{
|
||||
method = aCommand;
|
||||
param = "";
|
||||
} else
|
||||
{
|
||||
aCommand.Left(method,offset);
|
||||
target = aCommand;
|
||||
} else {
|
||||
|
||||
aCommand.Left(target,offset);
|
||||
aCommand.Cut(0,offset);
|
||||
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
|
||||
|
||||
param = aCommand;
|
||||
offset = aCommand.Find(' ');
|
||||
|
||||
if (offset == kNotFound)
|
||||
{
|
||||
name = aCommand;
|
||||
} else {
|
||||
|
||||
aCommand.Left(name,offset);
|
||||
aCommand.Cut(0,offset);
|
||||
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
|
||||
|
||||
offset = aCommand.Find(' ');
|
||||
|
||||
if (offset == kNotFound)
|
||||
{
|
||||
method = aCommand;
|
||||
param = "";
|
||||
} else
|
||||
{
|
||||
aCommand.Left(method,offset);
|
||||
aCommand.Cut(0,offset);
|
||||
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
|
||||
|
||||
param = aCommand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fint the canvas by this name
|
||||
* Find the canvas by this name
|
||||
*/
|
||||
|
||||
if (target.EqualsIgnoreCase(XPFC_STRING_PANEL))
|
||||
|
@ -1332,8 +1341,30 @@ nsresult nsCalendarShell :: SendCommand(nsString& aCommand, nsString& aReply)
|
|||
|
||||
NS_IF_RELEASE(command);
|
||||
NS_IF_RELEASE(observer);
|
||||
} else if (target.EqualsIgnoreCase(XPFC_STRING_HELP)) {
|
||||
|
||||
/*
|
||||
* Return basic help?
|
||||
*/
|
||||
|
||||
if (name.Length() == 0)
|
||||
{
|
||||
aReply = ZULUCOMMAND_HELP;
|
||||
|
||||
} else if (name.EqualsIgnoreCase(XPFC_STRING_PANEL)) {
|
||||
|
||||
aReply = ZULUCOMMAND_HELP_PANEL;
|
||||
|
||||
} else {
|
||||
|
||||
aReply = "ERROR: Command Not Known:\r\n";
|
||||
aReply += ZULUCOMMAND_HELP;
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
aReply = "ERROR: target class unknown\n";
|
||||
aReply = "ERROR: target class unknown\r\n";
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -219,7 +219,7 @@ static void PR_CALLBACK CommandServerClientThread(void * arg)
|
|||
{
|
||||
nsString string = "BOBO";
|
||||
|
||||
string.SetString(in_buf->data, bytes2);
|
||||
string.SetString(in_buf->data, nsCRT::strlen(in_buf->data));
|
||||
|
||||
// XXX: We really need an interface for receiving string results
|
||||
// for CommandInvoker queries. Right now, we can dispatch
|
||||
|
@ -232,6 +232,7 @@ static void PR_CALLBACK CommandServerClientThread(void * arg)
|
|||
//
|
||||
// I believe sman had an idea on how to do these things, check my notes...
|
||||
//
|
||||
#if 0
|
||||
if (string.EqualsIgnoreCase(XPFC_STRING_HELP) || string.EqualsIgnoreCase(XPFC_STRING_QUESTIONMARK))
|
||||
{
|
||||
|
||||
|
@ -240,7 +241,7 @@ static void PR_CALLBACK CommandServerClientThread(void * arg)
|
|||
nsCRT::memcpy(in_buf->data, "Help Not Yet Implemented ... Sorry Steve!!!\n", bytes);
|
||||
|
||||
} else {
|
||||
|
||||
#endif
|
||||
nsString reply("Command Received and Executed!!!\n");
|
||||
|
||||
gApplicationShell->ReceiveCommand(string, reply);
|
||||
|
@ -255,8 +256,10 @@ static void PR_CALLBACK CommandServerClientThread(void * arg)
|
|||
nsCRT::memcpy(in_buf->data, cstring, reply.Length());
|
||||
|
||||
delete cstring;
|
||||
#if 0
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче