summaryrefslogtreecommitdiffstats
path: root/generic/tkTest.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-05-14 20:58:24 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-05-14 20:58:24 (GMT)
commit63b954a5775049b63f7067e80d9c1b31c8176222 (patch)
tree288d4d74decb1ae3a9c5616c310ea88b3b8bee31 /generic/tkTest.c
parente34b1b4d9d3de8cc8c9af59dc8e6927c0af02283 (diff)
downloadtk-63b954a5775049b63f7067e80d9c1b31c8176222.zip
tk-63b954a5775049b63f7067e80d9c1b31c8176222.tar.gz
tk-63b954a5775049b63f7067e80d9c1b31c8176222.tar.bz2
[Tk Bug 1712081]
* unix/Makefile.in: Updates to account for new and deleted files * win/Makefile.in: tkStubImg.c and tkOldTest.c. * win/makefile.bc: * win/makefile.vc: * generic/tkOldTest.c (new): New file used to create testing * generic/tkTest.c: commands for testing various Tk * tests/constraints.tcl: legacy interfaces where a separate * tests/image.test: compilation unit is needed in order to #define suitable macros during compilation. Only the effect of USE_OLD_IMAGE on Tk_CreateImageType() is currently tested, but more similar testing commands can be added to this same file. New constraint defined to detect presence of the image type provided by the new testing code, and a few tests added to exercise it. Having USE_OLD_IMAGE support tested by the default test suite should reduce chance of a recurrence of this bug. * doc/CrtImgType.3: Revised docs to better indicate the legacy * doc/CrtPhImgFmt.3: nature of the interfaces supported by USE_OLD_IMAGE. * generic/tkDecls.h: make genstubs * generic/tkStubInit.c: * generic/tk.decls: Reworked USE_OLD_IMAGE support to use * generic/tk.h: the same support mechanisms both with * generic/tkStubImg.c (deleted):and without a stub-enabled build. In each case, route the legacy calls to Tk_CreateImageType and Tk_CreatePhotoImageFormat through the Tk_CreateOldImageType and Tk_CreateOldPhotoImageFormat routines. Add those routines to the public stub table so they're available to a stub-enabled extension. Remove the definition of Tk_InitImageArgs() and use a macro to convert any calls to it in source code into a comment. * generic/tkImage.c: Removed the MODULE_SCOPE declarations that * generic/tkImgPhoto.c: broke USE_OLD_IMAGE support.
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r--generic/tkTest.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 2f16372..b5be7a2 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTest.c,v 1.31 2007/01/03 05:06:26 nijtmans Exp $
+ * RCS: @(#) $Id: tkTest.c,v 1.32 2007/05/14 20:58:27 dgp Exp $
*/
#include "tkInt.h"
@@ -61,17 +61,10 @@ typedef struct TImageInstance {
* The type record for test images:
*/
-#ifdef USE_OLD_IMAGE
-static int ImageCreate(Tcl_Interp *interp,
- char *name, int argc, char **argv,
- Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *clientDataPtr);
-#else
static int ImageCreate(Tcl_Interp *interp,
char *name, int argc, Tcl_Obj *CONST objv[],
Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr);
-#endif
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
Display *display, Drawable drawable,
@@ -83,7 +76,7 @@ static void ImageDelete(ClientData clientData);
static Tk_ImageType imageType = {
"test", /* name */
- (Tk_ImageCreateProc *) ImageCreate, /* createProc */
+ ImageCreate, /* createProc */
ImageGet, /* getProc */
ImageDisplay, /* displayProc */
ImageFree, /* freeProc */
@@ -220,6 +213,11 @@ static void TrivialEventProc(ClientData clientData,
#else
MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
#endif
+
+/*
+ * External legacy testing initialization routine:
+ */
+MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
/*
*----------------------------------------------------------------------
@@ -301,6 +299,14 @@ Tktest_Init(
}
/*
+ * Enable testing of legacy interfaces.
+ */
+
+ if (TkOldTestInit(interp) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /*
* And finally add any platform specific test commands.
*/
@@ -1487,15 +1493,9 @@ ImageCreate(
Tcl_Interp *interp, /* Interpreter for application containing
* image. */
char *name, /* Name to use for image. */
-#ifdef USE_OLD_IMAGE
- int argc, /* Number of arguments. */
- char **argv, /* Argument strings for options (doesn't
- * include image name or type). */
-#else
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[], /* Argument strings for options (doesn't
* include image name or type). */
-#endif /* USE_OLD_IMAGE */
Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
Tk_ImageMaster master, /* Token for image, to be used by us in later
* callbacks. */
@@ -1506,23 +1506,6 @@ ImageCreate(
char *varName;
int i;
-#ifdef USE_OLD_IMAGE
- Tk_InitImageArgs(interp, argc, &argv);
- varName = "log";
- for (i = 0; i < argc; i += 2) {
- if (strcmp(argv[i], "-variable") != 0) {
- Tcl_AppendResult(interp, "bad option name \"",
- argv[i], "\"", NULL);
- return TCL_ERROR;
- }
- if ((i+1) == argc) {
- Tcl_AppendResult(interp, "no value given for \"",
- argv[i], "\" option", NULL);
- return TCL_ERROR;
- }
- varName = argv[i+1];
- }
-#else
varName = "log";
for (i = 0; i < objc; i += 2) {
if (strcmp(Tcl_GetString(objv[i]), "-variable") != 0) {
@@ -1537,7 +1520,6 @@ ImageCreate(
}
varName = Tcl_GetString(objv[i+1]);
}
-#endif /* USE_OLD_IMAGE */
timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
timPtr->master = master;