MantisBT - Open CASCADE
View Issue Details
0031092Open CASCADE[OCCT] OCCT:DRAWpublic2019-10-21 17:142019-11-10 11:41
osa 
apn 
normalminor 
verifiedfixed 
[OCCT] 6.3.1 
[OCCT] 7.5.0* 
bugs fclasses bug31092
0031092: Foundation Classes - incorrect last output value for Infinite progress indicator
ะก++ code to reproduce:
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);

Message_ProgressSentry aPSentry (aProgress, "Global sentry", 0, 1, 1);
{
  Message_ProgressSentry aSubPSentry (aProgress, "Sub sentry 1", 0, 1, 1, true);
  for (size_t anIdx = 0; anIdx < 10; ++anIdx)
  {
    aSubPSentry.Next (anIdx / 10.0);
  }
}
aPSentry.Next();

If activate progress indicator in text mode using XProgress +t -g the result output will be:
Progress: 0% Global sentry: 1 / 1
Progress: 50% Global sentry: 1 / 1 Sub sentry 1: 1
Progress: 52% Global sentry: 1 / 1 Sub sentry 1: 1
Progress: 57% Global sentry: 1 / 1 Sub sentry 1: 1
Progress: 62% Global sentry: 1 / 1 Sub sentry 1: 2
Progress: 67% Global sentry: 1 / 1 Sub sentry 1: 2
Progress: 71% Global sentry: 1 / 1 Sub sentry 1: 3
Progress: 76% Global sentry: 1 / 1 Sub sentry 1: 3
Progress: 79% Global sentry: 1 / 1 Sub sentry 1: 4
Progress: 82% Global sentry: 1 / 1 Sub sentry 1: 5
Progress: 85% Global sentry: 1 / 1 Sub sentry 1: 6
Progress: 100% Global sentry: 1 / 1 Sub sentry 1: 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104

The last output is value of Infinite constant (1e100).That is not correct.

test bugs fclasses bug31092
No tags attached.
related to 0025748assigned msv Open CASCADE Foundation Classes - Parallel version of progress indicator 
Issue History
2019-10-21 17:14osaNew Issue
2019-10-21 17:14osaAssigned To => abv
2019-10-21 17:18kgvRelationship addedrelated to 0031091
2019-10-21 17:19kgvRelationship addedrelated to 0025748
2019-10-22 15:08kgvNote Added: 0088421
2019-10-22 15:09kgvNote Edited: 0088421bug_revision_view_page.php?bugnote_id=88421#r22101
2019-10-25 17:13gitNote Added: 0088611
2019-10-25 20:13abvNote Added: 0088615
2019-10-25 20:13abvAssigned Toabv => osa
2019-10-25 20:13abvStatusnew => resolved
2019-10-25 20:13abvResolutionopen => fixed
2019-10-25 20:13abvCategoryOCCT:Foundation Classes => OCCT:DRAW
2019-10-25 20:13abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22120#r22120
2019-10-25 22:17kgvNote Added: 0088619
2019-10-25 22:17kgvNote Edited: 0088619bug_revision_view_page.php?bugnote_id=88619#r22122
2019-10-25 22:18kgvNote Edited: 0088619bug_revision_view_page.php?bugnote_id=88619#r22123
2019-10-30 15:11osaNote Added: 0088666
2019-10-30 15:11osaAssigned Toosa => abv
2019-10-30 15:11osaStatusresolved => assigned
2019-10-30 16:28gitNote Added: 0088670
2019-10-30 17:35abvNote Added: 0088676
2019-10-30 17:35abvAssigned Toabv => kgv
2019-10-30 17:35abvStatusassigned => resolved
2019-10-30 17:53kgvAssigned Tokgv => bugmaster
2019-10-30 17:53kgvStatusresolved => reviewed
2019-10-30 17:53kgvProduct Version => 6.3.1
2019-10-30 23:23apnTest case number => bugs fclasses bug31092
2019-10-31 10:59apnStatusreviewed => tested
2019-11-02 17:43apnChangeset attached => occt master 53d770b3
2019-11-02 17:43apnAssigned Tobugmaster => apn
2019-11-02 17:43apnStatustested => verified
2019-11-10 11:41gitNote Added: 0088846

Notes
(0088421)
kgv   
2019-10-22 15:08   
(edited on: 2019-10-22 15:09)
From old project code...
      // print progress info differently for finite and infinite scopes
      if (scale.GetInfinite())
      {
        Standard_Real aVal = scale.BaseToLocal(locPos);
        if ( Precision::IsInfinite(aVal) )
        {
          n += sprintf_s (&text[n], BUFSIZE - n, "\n    %s: finished",
                          scale.GetName()->ToCString());
        }
        else {
          n += sprintf_s (&text[n], BUFSIZE - n, "\n    %s: %.0f",
                          scale.GetName()->ToCString(), aVal);
        }
      }


(0088611)
git   
2019-10-25 17:13   
Branch CR31092 has been created by abv.

SHA-1: 1e4851198011d89126edf9aa3160eb51a9c8456e


Detailed log of new commits:

Author: abv
Date: Fri Oct 25 17:11:33 2019 +0300

    0031092: Foundation Classes - incorrect last output value for Infinite progress indicator
    
    DRAW implementation of progress indicator is corrected to print "finished" instead of 1e100 for the end of infinite range.
    Added test bugs fclasses bug31092
(0088615)
abv   
2019-10-25 20:13   
Fix is pushed to branch CR31092 and tested, see Jenkins job CR31092-abv. Please review
(0088619)
kgv   
2019-10-25 22:17   
(edited on: 2019-10-25 22:18)
+    {
+        Standard_Real aVal = scale.BaseToLocal(locPos);

Unexpected indentation.
     else 
-      n += Sprintf ( &text[n], " %s: %.0f / %.0f", scale.GetName()->ToCString(), 


-                     scale.BaseToLocal ( locPos ), scale.GetMax() );
+      aText << scale.BaseToLocal ( locPos ) << " / " << scale.GetMax();


Brackets are desired for else statement.

(0088666)
osa   
2019-10-30 15:11   
Please take a look at kgv remarks. I don't have others.
(0088670)
git   
2019-10-30 16:28   
Branch CR31092 has been updated forcibly by abv.

SHA-1: 5f52175c9e2f393b3123a0a09e75439c09a5739b
(0088676)
abv   
2019-10-30 17:35   
Indentation is corrected and braces added, please review again
(0088846)
git   
2019-11-10 11:41   
Branch CR31092 has been deleted by inv.

SHA-1: 5f52175c9e2f393b3123a0a09e75439c09a5739b