Skip to content

Commit

Permalink
Fixed linear progress indicator tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SandroMaglione committed Apr 26, 2020
1 parent 3d01197 commit 6889a39
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
4 changes: 2 additions & 2 deletions lib/src/step_progress_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class _ProgressStep extends StatelessWidget {
}

/// Build the actual single step [Widget]
Widget get _buildStep => onTap != null && customStep != null
Widget get _buildStep => onTap != null && customStep == null
? Material(
color: color,
child: InkWell(
Expand All @@ -482,7 +482,7 @@ class _ProgressStep extends StatelessWidget {
child: _stepContainer(),
),
)
: onTap == null && customStep != null
: onTap != null && customStep != null
? SizedBox(
width: width,
height: height,
Expand Down
49 changes: 25 additions & 24 deletions test/step_progress_indicator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ void main() {
width: tWidth,
child: StepProgressIndicator(
totalSteps: tTotalSteps,
onTap: (_) => () {},
),
),
),
);

// Build all the step (each step has a GestureDetector)
final steps = find.byType(GestureDetector);
// Build all the step
final steps = find.byType(Container);

// Find all the steps
// Find all the steps (plus the indicator container)
expect(
steps,
findsNWidgets(tTotalSteps),
findsNWidgets(tTotalSteps + 1),
);
});

Expand Down Expand Up @@ -174,12 +175,12 @@ void main() {
),
);

// Build all the step (each step has a GestureDetector)
final steps = find.byType(GestureDetector);
// Build all the step
final steps = find.byType(Container);

// Find all the steps
// Find all the steps (skip the indicator container)
expect(
steps.evaluate().map((element) => element.size.width),
steps.evaluate().skip(1).map((element) => element.size.width),
List<double>.filled(tTotalSteps, tWidth),
);
});
Expand All @@ -201,12 +202,12 @@ void main() {
),
);

// Build all the step (each step has a GestureDetector)
final steps = find.byType(GestureDetector);
// Build all the step
final steps = find.byType(Container);

// Find all the steps
// Find all the steps (skip the indicator container)
expect(
steps.evaluate().map((element) => element.size.height),
steps.evaluate().skip(1).map((element) => element.size.height),
List<double>.filled(tTotalSteps, tHeight),
);
});
Expand All @@ -229,13 +230,13 @@ void main() {
),
);

// Build all the step (each step has a GestureDetector)
final steps = find.byType(GestureDetector);
// Build all the step
final steps = find.byType(Container);

// Find all the steps
// Find all the steps (plus the container of the indicator)
expect(
steps,
findsNWidgets(2),
findsNWidgets(3),
);
});

Expand All @@ -257,12 +258,12 @@ void main() {
),
);

// Build all the step (each step has a GestureDetector)
final steps = find.byType(GestureDetector);
// Build all the step
final steps = find.byType(Container);

// Find all the steps
// Find all the steps (skip the indicator container)
expect(
steps.evaluate().map((element) => element.size.width),
steps.evaluate().skip(1).map((element) => element.size.width),
List<double>.filled(
tTotalSteps, (tWidth - (tTotalSteps * 2.0 * 2)) / tTotalSteps),
);
Expand Down Expand Up @@ -336,7 +337,7 @@ void main() {
),
);

final steps = find.byType(GestureDetector);
final steps = find.byType(Container);

expect(steps.evaluate().map((element) => element.size.height),
List<double>.filled(tTotalSteps, 30.0));
Expand All @@ -361,7 +362,7 @@ void main() {
),
);

final steps = find.byType(GestureDetector);
final steps = find.byType(Container);

expect(steps.evaluate().map((element) => element.size.width),
List<double>.filled(tTotalSteps, 30.0));
Expand All @@ -387,7 +388,7 @@ void main() {
),
);

final steps = find.byType(GestureDetector);
final steps = find.byType(Container);

expect(
steps.evaluate().where((element) => element.size.height == 20).length,
Expand Down Expand Up @@ -459,7 +460,7 @@ void main() {
),
);

final steps = find.byType(GestureDetector);
final steps = find.byType(Container);

expect(
steps.evaluate().where((element) => element.size.height == 20).length,
Expand Down

0 comments on commit 6889a39

Please sign in to comment.