Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006705 [Squeak] Multilingual minor always 10-07-07 07:20 12-17-10 23:03
Reporter wiz View Status public  
Assigned To RalphJohnson
Priority low Resolution fixed  
Status closed   Product Version 3.10
Summary 0006705: In sq7143 FontTest>>#testResetAfterEmphasized will always fail on the second pass.
Description For this
get a UnitTester
select Multilingual-Display>FontTest
the first time all seven tests pass
the second time one test has an error

'DF 5/25/2006 20:49 FontTest testResetAfterEmphasized {testing}'

FontTest>>#testResetAfterEmphasized will always fail on the second pass.

    "self debug: #testResetAfterEmphasized"
    | normal derivative |
    normal _ TextStyle defaultFont.
    derivative _ normal emphasized: 3.
    self assert: (normal derivativeFonts at: 3) == derivative.
    normal reset.
    self assert: normal derivativeFonts isEmpty

the message #derivitiveFonts returns the array of font derivitives without nils. On the second pass it will only have two entries ( one for bold and one for bold italic , the italic entry is not generated. ) so it has no third member and thus fails.
Additional Information I suspect other tests in this suite are also dependent on the initial conditions of the image.

In sq 7143
Running LanEnv... Test from Test-Bugz and then running FontTest has more tests that fail. I'll write that up separately when I get a new image to test it in. Right now there are so many known font bugs that I have a hard time knowing which tests may be expected to pass.

Also some of the tests in 7143 set up the recursive font system crash conditions.

Attached Files  M6705FontTestFix-wiz.1.cs [^] (1,503 bytes) 06-05-08 22:21

- Relationships
child of 0006570assigned tim A Mother for font and font test problems 

- Notes
(0011246 - 59 - 83 - 83 - 83 - 83 - 83)
10-07-07 07:23

Reminder sent to: RalphJohnson

Hi Ralph,

I think this is one you should know about.

(0011249 - 1611 - 1703 - 1703 - 1703 - 1703 - 1703)
10-07-07 09:24

You are right that it depends on the state of the image, but the real problem is that it assumes that "normal emphasized: 3" and "normal derivativeFonts at: 3" mean the same thing. They don't. "normal emphasized: 3" will make sure that there is a derivative font with the right emphasis. See StrikeFont>>emphasized: for an explanation of the emphasis numbers. There is an array of all the derivative fonts, indexed by the emphasis number. However, the #derivativeFonts methods does NOT return that array! Instead, it returns a copy without the nils. Since most elements of the array are nil, the font with emphasis N is not likely to be the N'th element of the return collection of #derivativeFonts.

An easy fix is to first send "normal emphasized: 1" and "normal emphasized: 2" to make sure that the first three elements of the derivativeFonts array are not nil.

I looked for a way to find the fonts without sending #derivativeFonts, and there aren't any. It then occurred to me that the first assertion is not only wrong, but pointless. The purpose of this test is to make sure #reset works. So, and easier fix is to delete the first assertion.

In general, this is a bad test. Which class is it testing? It depends on the default font. There should be a test for each of the subclasses of AbstractFont. Right now it basically is picking one at random, based on whatever happens to be the font of the default TextStyle. In the original image, this is StrikeFontSet. So, neither StrikeFont (which has a complex #reset method) nor TTCFont (which has a trivial #reset method) are tested.
(0011251 - 354 - 354 - 354 - 354 - 354 - 354)
10-07-07 14:59

I think that we need a FontTest class that has a setup method that creates StrikeFonts (or some other concrete class) instead of getting the default font. Then we could subclass that, change the setup method to create fonts of different classes, and reuse the font tests. This would make the tests more repeatable as well as check all the font classes.
(0011252 - 1290 - 1410 - 1410 - 1410 - 1410 - 1410)
10-07-07 19:02

Hi Ralph,

I think that there needs to be a general #resetFontsToTestableState method. It probably right now belongs in the Preference set of responsibilities. The tests and the test suite should have the privledge and duty of setting the font preferences to the reset state.

There should also be a #saveCurrent FontPreferences and #restoreFontPreferences which act as a push and pop on the Font testable state. This can be run before and after the test suite to get back the users state.

A first pass could leave the save and restore methods no-ops. We'd still be better off than with the current state of affairs.


About your earlier comment. I realized the test was way off base.

My policy when bug tracking is if (when) I find bugs while looking for other things is get them documented and on mantis before going back to my original task. Such was the case here.

Then when time and interest permit come back and add analysis and maybe a fix.

All of the font tests are somewhat state dependent. So I suspect I will be adding more reports rather than focusing on fixing things.

Also, it would be good to get the author to fix his work. And to get others involved in the process of bug tracking and repair.

Yours in curiosity and service, --Jerome Peace
(0012261 - 755 - 879 - 879 - 879 - 879 - 879)
06-05-08 22:21
edited on: 06-05-08 22:25

UpLoading M6705FontTestFix-wiz.1.cs

from the preamble:

"Change Set: FontTestFix-wiz
Date: 5 June 2008
Author: (wiz) Jerome Peace

wiz 6/5/2008 18:10
This corrects the symtom mentioned in
Problem was that the accessor for derivativeFonts gives a list of fonts but because it removes empty elements cannot be relied upon as an array indexed by emphasis.
So we weaken the test to check that the derivative font is identity included in the list rather than at the exact spot it is expected to be.
I also wrote a second test to do the check for the emphasized font after the reset. This makes a first pass error out of the other tests second pass error. To make this test work I had to use the same weakened condition.


(0012262 - 85 - 117 - 117 - 117 - 117 - 117)
06-05-08 22:23

"fix begin"
Installer mantis bug: 6705 fix: 'M6705FontTestFix-wiz.1.cs' .
"fix end"
(0013994 - 45 - 45 - 45 - 45 - 45 - 45)
nicolas cellier
12-17-10 23:03

Can't remember when it was fixed, but it was.

- Issue History
Date Modified Username Field Change
10-07-07 07:20 wiz New Issue
10-07-07 07:23 wiz Issue Monitored: RalphJohnson
10-07-07 07:23 wiz Note Added: 0011246
10-07-07 07:24 wiz Relationship added child of 0006570
10-07-07 09:24 RalphJohnson Note Added: 0011249
10-07-07 14:59 RalphJohnson Note Added: 0011251
10-07-07 14:59 RalphJohnson Assigned To  => RalphJohnson
10-07-07 14:59 RalphJohnson Priority high => low
10-07-07 14:59 RalphJohnson Status new => assigned
10-07-07 19:02 wiz Note Added: 0011252
06-05-08 22:21 wiz Note Added: 0012261
06-05-08 22:21 wiz File Added: M6705FontTestFix-wiz.1.cs
06-05-08 22:23 wiz Note Added: 0012262
06-05-08 22:25 wiz Note Edited: 0012261
01-10-09 02:00 Keith_Hodges Status assigned => pending
12-17-10 23:03 nicolas cellier Status pending => closed
12-17-10 23:03 nicolas cellier Note Added: 0013994
12-17-10 23:03 nicolas cellier Resolution open => fixed
12-17-10 23:03 nicolas cellier Fixed in Version  => 4.1

Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
78 total queries executed.
49 unique queries executed.
Powered by Mantis Bugtracker